Compare commits
3 Commits
main
...
feat-cjy-t
| Author | SHA1 | Date | |
|---|---|---|---|
| 8ac97ac379 | |||
| c3e6ede59c | |||
| 883140d2cd |
10
cmd/app.go
10
cmd/app.go
@ -34,6 +34,16 @@ func main() {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// // 一次性执行任务余额同步(幂等):若已执行或存在数据则跳过
|
||||
// if syncErr := dao.RunInitialTaskBalanceSync(); syncErr != nil {
|
||||
// app.ModuleClients.Lg.Warn("initial task-balance sync failed", zap.Error(syncErr))
|
||||
// }
|
||||
|
||||
// // 增量同步:每次服务重启时执行,同步套餐余额表中的新数据到任务余额表
|
||||
// if incrementalSyncErr := dao.RunIncrementalTaskBalanceSync(); incrementalSyncErr != nil {
|
||||
// app.ModuleClients.Lg.Warn("incremental task-balance sync failed", zap.Error(incrementalSyncErr))
|
||||
// }
|
||||
|
||||
//l, err := net.Listen("tcp", ":8883")
|
||||
//if err != nil {
|
||||
// fmt.Printf("failed to listen: %v", err)
|
||||
|
||||
@ -127,6 +127,3 @@ func (b *BundleProvider) ListUnfinishedInfos(_ context.Context, req *bundle.Auto
|
||||
func (b *BundleProvider) SoftDeleteUnfinishedInfo(_ context.Context, req *bundle.SoftDeleteUnfinishedInfoRequest) (res *bundle.CommonResponse, err error) {
|
||||
return logic.SoftDeleteUnfinishedInfo(req)
|
||||
}
|
||||
func (b *BundleProvider) ReSignTheContract(_ context.Context, req *bundle.ReSignTheContractRequest) (res *bundle.CommonResponse, err error) {
|
||||
return logic.ReSignTheContract(req)
|
||||
}
|
||||
|
||||
@ -61,11 +61,6 @@ func (b *BundleProvider) ConfirmWork(_ context.Context, req *bundle.ConfirmWorkR
|
||||
return logic.ConfirmWork(req)
|
||||
}
|
||||
|
||||
// 获取待确认作品列表
|
||||
func (b *BundleProvider) GetWaitConfirmWorkList(_ context.Context, req *bundle.GetWaitConfirmWorkListReq) (*bundle.GetWaitConfirmWorkListResp, error) {
|
||||
return logic.GetWaitConfirmWorkList(req)
|
||||
}
|
||||
|
||||
// 套餐激活
|
||||
func (b *BundleProvider) BundleActivate(_ context.Context, req *bundle.BundleActivateReq) (*bundle.BundleActivateResp, error) {
|
||||
return nil, logic.BundleActivate(req)
|
||||
|
||||
@ -29,7 +29,3 @@ func (b *BundleProvider) MetricsArtistAccountExport(_ context.Context, req *bund
|
||||
func (b *BundleProvider) MetricsVideoSubmitExport(_ context.Context, req *bundle.MetricsVideoSubmitExportReq) (*bundle.MetricsVideoSubmitExportResp, error) {
|
||||
return logic.MetricsVideoSubmitExport(req)
|
||||
}
|
||||
|
||||
func (b *BundleProvider) ExportWorkCastInfo(_ context.Context, req *bundle.ExportWorkCastInfoReq) (*bundle.ExportWorkCastInfoResp, error) {
|
||||
return logic.ExportWorkCastInfo(req)
|
||||
}
|
||||
|
||||
@ -51,6 +51,3 @@ func (b *BundleProvider) BatchGetValueAddServiceLang(ctx context.Context, req *b
|
||||
func (b *BundleProvider) BundleListH5V2(_ context.Context, req *bundle.BundleListRequest) (res *bundle.BundleListResponse, err error) {
|
||||
return logic.BundleListH5V2(req)
|
||||
}
|
||||
func (b *BundleProvider) QueryTheOrderSnapshotInformation(_ context.Context, req *bundle.QueryTheOrderSnapshotInformationReq) (res *bundle.QueryTheOrderSnapshotInformationResp, err error) {
|
||||
return logic.QueryTheOrderSnapshotInformation(req)
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@ package controller
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"micro-bundle/internal/dto"
|
||||
"micro-bundle/internal/dao"
|
||||
"micro-bundle/internal/logic"
|
||||
"micro-bundle/internal/model"
|
||||
"micro-bundle/pb/bundle"
|
||||
@ -13,12 +13,57 @@ import (
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
// GetPendingTaskList 查询待指派任务记录
|
||||
func (b *BundleProvider) GetPendingTaskList(_ context.Context, req *bundle.TaskQueryRequest) (*bundle.TaskQueryResponse, error) {
|
||||
// 转换请求参数
|
||||
daoReq := &dao.TaskQueryRequest{
|
||||
Keyword: req.Keyword,
|
||||
Page: int(req.Page),
|
||||
PageSize: int(req.PageSize),
|
||||
SortBy: req.SortBy,
|
||||
SortType: req.SortType,
|
||||
}
|
||||
|
||||
// 调用logic层
|
||||
tasks, total, err := logic.GetPendingTaskList(daoReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// 转换响应数据
|
||||
var taskInfos []*bundle.TaskManagementInfo
|
||||
for _, task := range tasks {
|
||||
taskInfo := &bundle.TaskManagementInfo{
|
||||
SubNum: task.SubNum,
|
||||
TelNum: task.TelNum,
|
||||
ArtistName: task.ArtistName,
|
||||
PendingVideoCount: int32(task.PendingVideoCount),
|
||||
PendingPostCount: int32(task.PendingPostCount),
|
||||
PendingDataCount: int32(task.PendingDataCount),
|
||||
ProgressTaskCount: int32(task.ProgressTaskCount),
|
||||
CompleteTaskCount: int32(task.CompleteTaskCount),
|
||||
LastTaskAssignee: task.LastTaskAssignee,
|
||||
TaskAssigneeNum: task.TaskAssigneeNum,
|
||||
PendingVideoScriptCount: 0,
|
||||
}
|
||||
taskInfos = append(taskInfos, taskInfo)
|
||||
}
|
||||
|
||||
return &bundle.TaskQueryResponse{
|
||||
Tasks: taskInfos,
|
||||
Total: total,
|
||||
Page: req.Page,
|
||||
PageSize: req.PageSize,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// AssignTask 指派某位员工完成某个艺人的任务
|
||||
func (b *BundleProvider) AssignTask(_ context.Context, req *bundle.TaskAssignRequest) (*bundle.CommonResponse, error) {
|
||||
daoReq := &dto.TaskAssignRequest{
|
||||
// 转换请求参数
|
||||
daoReq := &dao.TaskAssignRequest{
|
||||
SubNum: req.SubNum,
|
||||
TelNum: req.TelNum,
|
||||
ArtistName: req.ArtistName,
|
||||
ArtistName: req.ArtistName, // 添加缺失的ArtistName字段
|
||||
TaskAssignee: req.TaskAssignee,
|
||||
TaskAssigneeNum: req.TaskAssigneeNum,
|
||||
Operator: req.Operator,
|
||||
@ -30,6 +75,7 @@ func (b *BundleProvider) AssignTask(_ context.Context, req *bundle.TaskAssignReq
|
||||
AssignVideoScriptCount: int(req.AssignVideoScriptCount),
|
||||
}
|
||||
|
||||
// 调用logic层
|
||||
err := logic.AssignTask(daoReq)
|
||||
if err != nil {
|
||||
return &bundle.CommonResponse{
|
||||
@ -42,6 +88,35 @@ func (b *BundleProvider) AssignTask(_ context.Context, req *bundle.TaskAssignReq
|
||||
}, nil
|
||||
}
|
||||
|
||||
// UpdatePendingCount 修改待发数量
|
||||
func (b *BundleProvider) UpdatePendingCount(_ context.Context, req *bundle.UpdatePendingCountRequest) (*bundle.CommonResponse, error) {
|
||||
// 转换请求参数
|
||||
daoReq := &dao.UpdatePendingCountRequest{
|
||||
SubNum: req.SubNum,
|
||||
TelNum: req.TelNum,
|
||||
ArtistName: req.ArtistName, // 添加缺失的ArtistName字段
|
||||
PendingVideoCount: int(req.PendingVideoCount),
|
||||
PendingPostCount: int(req.PendingPostCount),
|
||||
PendingDataCount: int(req.PendingDataCount),
|
||||
Operator: req.Operator,
|
||||
OperatorNum: req.OperatorNum,
|
||||
TaskAssignee: req.TaskAssignee,
|
||||
TaskAssigneeNum: req.TaskAssigneeNum,
|
||||
}
|
||||
|
||||
// 调用logic层
|
||||
err := logic.UpdatePendingCount(daoReq)
|
||||
if err != nil {
|
||||
return &bundle.CommonResponse{
|
||||
Msg: err.Error(),
|
||||
}, err
|
||||
}
|
||||
|
||||
return &bundle.CommonResponse{
|
||||
Msg: "待发数量修改成功",
|
||||
}, nil
|
||||
}
|
||||
|
||||
// GetRecentAssignRecords 查询最近被指派记录
|
||||
func (b *BundleProvider) GetRecentAssignRecords(_ context.Context, req *bundle.RecentAssignRecordsRequest) (*bundle.RecentAssignRecordsResponse, error) {
|
||||
limit := int(req.Limit)
|
||||
@ -67,7 +142,8 @@ func (b *BundleProvider) GetEmployeeAssignedTasks(_ context.Context, req *bundle
|
||||
if int(req.Status) == 2 {
|
||||
req.SortBy = "complete_time"
|
||||
}
|
||||
daoReq := &dto.EmployeeTaskQueryRequest{
|
||||
// 转换请求参数
|
||||
daoReq := &dao.EmployeeTaskQueryRequest{
|
||||
TaskAssigneeNum: req.TaskAssigneeNum,
|
||||
Keyword: req.Keyword,
|
||||
Operator: req.Operator,
|
||||
@ -82,11 +158,13 @@ func (b *BundleProvider) GetEmployeeAssignedTasks(_ context.Context, req *bundle
|
||||
TaskBatch: req.TaskBatch,
|
||||
}
|
||||
|
||||
// 调用logic层
|
||||
records, total, err := logic.GetEmployeeAssignedTasks(daoReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// 转换响应数据
|
||||
var recordInfos []*bundle.TaskAssignRecordInfo
|
||||
for _, record := range records {
|
||||
recordInfo := convertToTaskAssignRecordInfo(record)
|
||||
@ -103,6 +181,7 @@ func (b *BundleProvider) GetEmployeeAssignedTasks(_ context.Context, req *bundle
|
||||
|
||||
// CompleteTaskManually 员工手动点击完成任务
|
||||
func (b *BundleProvider) CompleteTaskManually(_ context.Context, req *bundle.CompleteTaskManuallyRequest) (*bundle.CommonResponse, error) {
|
||||
// 调用logic层
|
||||
err := logic.CompleteTaskManually(req.AssignRecordsUUID, req.TaskAssigneeNum)
|
||||
if err != nil {
|
||||
return &bundle.CommonResponse{
|
||||
@ -117,7 +196,8 @@ func (b *BundleProvider) CompleteTaskManually(_ context.Context, req *bundle.Com
|
||||
|
||||
// UpdateTaskProgress 员工实际完成任务状态更新
|
||||
func (b *BundleProvider) UpdateTaskProgress(_ context.Context, req *bundle.UpdateTaskProgressRequest) (*bundle.CommonResponse, error) {
|
||||
daoReq := &dto.CompleteTaskRequest{
|
||||
// 转换请求参数
|
||||
daoReq := &dao.CompleteTaskRequest{
|
||||
AssignRecordsUUID: req.AssignRecordsUUID,
|
||||
EmployeeName: req.EmployeeName,
|
||||
EmployeeNum: req.EmployeeNum,
|
||||
@ -126,6 +206,7 @@ func (b *BundleProvider) UpdateTaskProgress(_ context.Context, req *bundle.Updat
|
||||
UUID: req.Uuid,
|
||||
}
|
||||
|
||||
// 调用logic层
|
||||
err := logic.UpdateTaskProgress(daoReq)
|
||||
if err != nil {
|
||||
return &bundle.CommonResponse{
|
||||
@ -138,8 +219,9 @@ func (b *BundleProvider) UpdateTaskProgress(_ context.Context, req *bundle.Updat
|
||||
}, nil
|
||||
}
|
||||
|
||||
// TerminateTaskByUUID 根据指派记录UUID终止任务
|
||||
// TerminateTaskByUUID 根据指派记录UUID终止任务(实际状态置为已中止)
|
||||
func (b *BundleProvider) TerminateTaskByUUID(_ context.Context, req *bundle.TerminateTaskByUUIDRequest) (*bundle.ComResponse, error) {
|
||||
// 调用logic层
|
||||
err := logic.TerminateTaskByUUID(req.AssignRecordsUUID)
|
||||
if err != nil {
|
||||
return &bundle.ComResponse{Msg: err.Error()}, err
|
||||
@ -192,7 +274,8 @@ func (b *BundleProvider) GetTaskAssignRecordsList(_ context.Context, req *bundle
|
||||
if sortBy, ok := model.OrderByPending[req.SortBy]; ok {
|
||||
req.SortBy = sortBy
|
||||
}
|
||||
daoReq := &dto.TaskAssignRecordsQueryRequest{
|
||||
// 转换请求参数
|
||||
daoReq := &dao.TaskAssignRecordsQueryRequest{
|
||||
Keyword: req.Keyword,
|
||||
TaskAssignee: req.TaskAssignee,
|
||||
Operator: req.Operator,
|
||||
@ -214,6 +297,7 @@ func (b *BundleProvider) GetTaskAssignRecordsList(_ context.Context, req *bundle
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// 转换响应数据
|
||||
var recordInfos []*bundle.TaskAssignRecordInfo
|
||||
for _, record := range records {
|
||||
recordInfo := convertToTaskAssignRecordInfo(record)
|
||||
@ -230,7 +314,7 @@ func (b *BundleProvider) GetTaskAssignRecordsList(_ context.Context, req *bundle
|
||||
}
|
||||
|
||||
// convertToTaskAssignRecordInfo 转换TaskAssignRecords模型为proto消息
|
||||
func convertToTaskAssignRecordInfo(record *dto.TaskAssignRecordsResponse) *bundle.TaskAssignRecordInfo {
|
||||
func convertToTaskAssignRecordInfo(record *dao.TaskAssignRecordsResponse) *bundle.TaskAssignRecordInfo {
|
||||
var completeTime string
|
||||
if record.CompleteTime != nil {
|
||||
completeTime = record.CompleteTime.Format("2006-01-02 15:04:05")
|
||||
@ -264,7 +348,7 @@ func convertToTaskAssignRecordInfo(record *dto.TaskAssignRecordsResponse) *bundl
|
||||
}
|
||||
|
||||
// convertToTaskAssignRecordsSummary 转换汇总结构到proto
|
||||
func convertToTaskAssignRecordsSummary(s *dto.TaskAssignRecordsSummary) *bundle.TaskAssignRecordsSummary {
|
||||
func convertToTaskAssignRecordsSummary(s *dao.TaskAssignRecordsSummary) *bundle.TaskAssignRecordsSummary {
|
||||
if s == nil {
|
||||
return &bundle.TaskAssignRecordsSummary{}
|
||||
}
|
||||
@ -280,20 +364,64 @@ func convertToTaskAssignRecordsSummary(s *dto.TaskAssignRecordsSummary) *bundle.
|
||||
}
|
||||
}
|
||||
|
||||
// BatchAssignTask 批量指派
|
||||
// GetArtistBundleBalance 查询艺人的当前任务余额与待发数量(区分套餐/增值两类)
|
||||
// 说明:
|
||||
// - 查询条件优先使用艺人编号(customerNum),为空时使用手机号(telNum)
|
||||
// - 返回同时包含“套餐类型”和“增值类型”的余额与待发数量,均按视频/图文/数据分析三类区分
|
||||
func (b *BundleProvider) GetArtistBundleBalance(_ context.Context, req *bundle.ArtistBundleBalanceRequest) (*bundle.ArtistBundleBalanceResponse, error) {
|
||||
// 参数校验:艺人编号与手机号不能同时为空
|
||||
if req.CustomerNum == "" && req.TelNum == "" {
|
||||
return nil, fmt.Errorf("艺人编号和手机号不能同时为空")
|
||||
}
|
||||
|
||||
// 仅使用艺人编号进行查询(与DAO层 GetRemainingPendingBySubNum 一致)
|
||||
subNum := req.CustomerNum
|
||||
if subNum == "" {
|
||||
// 暂不支持通过手机号查询剩余待发数据
|
||||
return nil, fmt.Errorf("暂不支持通过手机号查询剩余待发数据,请传入艺人编号")
|
||||
}
|
||||
|
||||
// 调用逻辑层:仅查询剩余待发数量(区分套餐/增值)
|
||||
resp, err := logic.GetArtistRemainingPending(subNum)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// 组装proto响应:非DAO返回字段统一置为0
|
||||
return &bundle.ArtistBundleBalanceResponse{
|
||||
// 套餐类型余额(暂置0)
|
||||
BundleVideoBalance: 0,
|
||||
BundleImageBalance: 0,
|
||||
BundleDataAnalysisBalance: 0,
|
||||
// 增值类型余额(暂置0)
|
||||
IncreaseVideoBalance: 0,
|
||||
IncreaseImageBalance: 0,
|
||||
IncreaseDataAnalysisBalance: 0,
|
||||
// 套餐类型待发数量
|
||||
BundlePendingVideoCount: int32(resp.PendingBundleVideoCount),
|
||||
BundlePendingImageCount: int32(resp.PendingBundleImageCount),
|
||||
BundlePendingDataAnalysisCount: int32(resp.PendingBundleDataAnalysisCount),
|
||||
// 增值类型待发数量
|
||||
IncreasePendingVideoCount: int32(resp.PendingIncreaseVideoCount),
|
||||
IncreasePendingImageCount: int32(resp.PendingIncreaseImageCount),
|
||||
IncreasePendingDataAnalysisCount: int32(resp.PendingIncreaseDataAnalysisCount),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// BatchAssignTask 批量指派(仅写入指派记录,不更新任务管理表)
|
||||
func (b *BundleProvider) BatchAssignTask(_ context.Context, req *bundle.BatchAssignTaskRequest) (*bundle.ComResponse, error) {
|
||||
if req == nil || len(req.Items) == 0 {
|
||||
return &bundle.ComResponse{Msg: "批量指派项不能为空"}, fmt.Errorf("批量指派项不能为空")
|
||||
}
|
||||
|
||||
// 转换请求项为DAO层结构
|
||||
var items []*dto.BatchAssignItem
|
||||
items = make([]*dto.BatchAssignItem, 0, len(req.Items))
|
||||
var items []*dao.BatchAssignItem
|
||||
items = make([]*dao.BatchAssignItem, 0, len(req.Items))
|
||||
for _, it := range req.Items {
|
||||
if it == nil {
|
||||
return &bundle.ComResponse{Msg: "存在空的指派项"}, fmt.Errorf("存在空的指派项")
|
||||
}
|
||||
items = append(items, &dto.BatchAssignItem{
|
||||
items = append(items, &dao.BatchAssignItem{
|
||||
SubNum: it.SubNum,
|
||||
TelNum: it.TelNum,
|
||||
ArtistName: it.ArtistName,
|
||||
@ -323,7 +451,8 @@ func (b *BundleProvider) GetArtistUploadStatsList(_ context.Context, req *bundle
|
||||
if sortBy, ok := model.OrderByDataAnalysis[req.SortBy]; ok {
|
||||
req.SortBy = sortBy
|
||||
}
|
||||
daoReq := &dto.TaskQueryRequest{
|
||||
// 构造 DAO 请求参数
|
||||
daoReq := &dao.TaskQueryRequest{
|
||||
Keyword: req.Keyword,
|
||||
Page: int(req.Page),
|
||||
PageSize: int(req.PageSize),
|
||||
@ -333,11 +462,13 @@ func (b *BundleProvider) GetArtistUploadStatsList(_ context.Context, req *bundle
|
||||
SubNums: req.SubNums,
|
||||
}
|
||||
|
||||
// 调用逻辑层
|
||||
items, total, err := logic.GetArtistUploadStatsList(daoReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// 转换响应数据
|
||||
formatTime := func(s string) string {
|
||||
if s == "" {
|
||||
return ""
|
||||
@ -394,6 +525,29 @@ func (b *BundleProvider) GetArtistUploadStatsList(_ context.Context, req *bundle
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (b *BundleProvider) GetPendingUploadBreakdown(_ context.Context, req *bundle.PendingUploadBreakdownRequest) (*bundle.PendingUploadBreakdownResponse, error) {
|
||||
items, total, err := logic.GetPendingUploadBreakdownBySubNums(req.SubNums, int(req.Page), int(req.PageSize))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
respItems := make([]*bundle.PendingUploadBreakdownItem, 0, len(items))
|
||||
for _, it := range items {
|
||||
respItems = append(respItems, &bundle.PendingUploadBreakdownItem{
|
||||
SubNum: it.SubNum,
|
||||
TelNum: it.TelNum,
|
||||
ArtistName: it.UserName,
|
||||
PendingVideoScriptCount: int32(it.PendingVideoScriptCount),
|
||||
PendingBundleVideoCount: int32(it.PendingBundleVideoCount),
|
||||
PendingIncreaseVideoCount: int32(it.PendingIncreaseVideoCount),
|
||||
PendingBundlePostCount: int32(it.PendingBundlePostCount),
|
||||
PendingIncreasePostCount: int32(it.PendingIncreasePostCount),
|
||||
PendingBundleDataCount: int32(it.PendingBundleDataCount),
|
||||
PendingIncreaseDataCount: int32(it.PendingIncreaseDataCount),
|
||||
})
|
||||
}
|
||||
return &bundle.PendingUploadBreakdownResponse{Items: respItems, Total: total, Page: req.Page, PageSize: req.PageSize}, nil
|
||||
}
|
||||
|
||||
// GetPendingAssign 查询艺人可指派数量
|
||||
func (b *BundleProvider) GetPendingAssign(_ context.Context, req *bundle.PendingAssignRequest) (*bundle.PendingAssignResponse, error) {
|
||||
items, total, err := logic.GetPendingAssignBySubNums(req.SubNums, int(req.Page), int(req.PageSize))
|
||||
@ -436,35 +590,3 @@ func (b *BundleProvider) AddHiddenTaskAssignee(_ context.Context, req *bundle.Ad
|
||||
}
|
||||
return &bundle.ComResponse{Msg: "删除该指派人成功"}, nil
|
||||
}
|
||||
|
||||
// CreateTaskWorkLog 创建任务日志记录
|
||||
func (b *BundleProvider) CreateTaskWorkLog(_ context.Context, req *bundle.CreateTaskWorkLogRequest) (*bundle.CommonResponse, error) {
|
||||
// 转换请求参数
|
||||
daoReq := &dto.CreateTaskWorkLogRequest{
|
||||
AssignRecordsUUID: req.AssignRecordsUUID,
|
||||
WorkUUID: req.WorkUUID,
|
||||
Title: req.Title,
|
||||
ArtistUUID: req.ArtistUUID,
|
||||
SubNum: req.SubNum,
|
||||
TelNum: req.TelNum,
|
||||
ArtistName: req.ArtistName,
|
||||
OperationType: int(req.OperationType),
|
||||
TaskType: int(req.TaskType),
|
||||
TaskCount: int(req.TaskCount),
|
||||
Remark: req.Remark,
|
||||
OperatorName: req.OperatorName,
|
||||
OperatorNum: req.OperatorNum,
|
||||
}
|
||||
|
||||
// 调用logic层
|
||||
err := logic.CreateTaskWorkLog(daoReq)
|
||||
if err != nil {
|
||||
return &bundle.CommonResponse{
|
||||
Msg: err.Error(),
|
||||
}, err
|
||||
}
|
||||
|
||||
return &bundle.CommonResponse{
|
||||
Msg: "任务日志创建成功",
|
||||
}, nil
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package dao
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"micro-bundle/internal/model"
|
||||
"micro-bundle/pb/bundle"
|
||||
"micro-bundle/pkg/app"
|
||||
@ -465,40 +464,7 @@ func BundleListH5V2(req *bundle.BundleListRequest) (res *bundle.BundleListRespon
|
||||
|
||||
}
|
||||
|
||||
func GetUnconfirmed() (data []model.CastWork, err error) {
|
||||
func GetUnconfirmed() (data []model.CastWork,err error) {
|
||||
err = app.ModuleClients.BundleDB.Model(&model.CastWork{}).Where("status = ? and update_time < ?", 4, time.Now().Add(-time.Hour*24)).Find(&data).Error
|
||||
return
|
||||
}
|
||||
func QueryTheOrderSnapshotInformation(req *bundle.QueryTheOrderSnapshotInformationReq) (res *bundle.QueryTheOrderSnapshotInformationResp, err error) {
|
||||
res = new(bundle.QueryTheOrderSnapshotInformationResp)
|
||||
var record model.BundleOrderRecords
|
||||
err = app.ModuleClients.BundleDB.
|
||||
Preload("BundleOrderValueAdd").
|
||||
Where("order_no = ?", req.OrderNo).
|
||||
First(&record).Error
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var temp struct {
|
||||
Content string `json:"content"`
|
||||
}
|
||||
if len(record.BundleCommonJson) > 0 {
|
||||
_ = json.Unmarshal(record.BundleCommonJson, &temp) // 失败也不会影响
|
||||
}
|
||||
res.BundleContent = temp.Content // 如果失败,这里就是空字符串
|
||||
res.BundleOrder = make([]*bundle.ServiceInformation, 0)
|
||||
res.AddBundleOrder = make([]*bundle.ServiceInformation, 0)
|
||||
for _, v := range record.BundleOrderValueAdd {
|
||||
info := &bundle.ServiceInformation{
|
||||
ServiceType: uint64(v.ServiceType),
|
||||
Num: uint64(v.Num),
|
||||
Unit: v.Unit,
|
||||
}
|
||||
if v.EquityType == 1 {
|
||||
res.BundleOrder = append(res.BundleOrder, info)
|
||||
} else if v.EquityType == 2 {
|
||||
res.AddBundleOrder = append(res.AddBundleOrder, info)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@ -3,13 +3,13 @@ package dao
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"micro-bundle/internal/model"
|
||||
"micro-bundle/pb/bundle"
|
||||
"micro-bundle/pkg/app"
|
||||
"micro-bundle/pkg/utils"
|
||||
"time"
|
||||
|
||||
"dubbo.apache.org/dubbo-go/v3/common/logger"
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
)
|
||||
@ -83,7 +83,7 @@ func GetBundleBalanceList(req *bundle.GetBundleBalanceListReq) (data []model.Bun
|
||||
WHEN bb.expired_at > NOW() THEN 2
|
||||
ELSE 1
|
||||
END AS balance_status`).
|
||||
Joins("LEFT JOIN `micro-account`.real_name rn ON u.real_name_id = rn.id and rn.deleted_at = 0").
|
||||
Joins("LEFT JOIN `micro-account`.real_name rn ON u.real_name_id = rn.id").
|
||||
Joins("LEFT JOIN (?) as bor ON bor.customer_id = u.id", subQuery).
|
||||
Joins("LEFT JOIN bundle_balance bb ON u.id = bb.user_id AND bb.order_uuid = bor.uuid and bb.deleted_at is null").
|
||||
Joins("LEFT JOIN bundle_activate bc on bc.user_id = u.id").
|
||||
@ -134,11 +134,11 @@ func GetBundleBalanceList(req *bundle.GetBundleBalanceListReq) (data []model.Bun
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(req.Month) == 0 {
|
||||
if req.Month == "" {
|
||||
newestMonthQuery := app.ModuleClients.BundleDB.Model(&model.BundleBalance{}).Select("max(month) as month,user_id").Group("user_id")
|
||||
session.Joins("LEFT JOIN (?) as newest_month on newest_month.user_id = bb.user_id", newestMonthQuery).Where("")
|
||||
} else {
|
||||
session = session.Where("bb.month in (?)", req.Month)
|
||||
session = session.Where("bb.month = ?", req.Month)
|
||||
}
|
||||
err = session.Count(&total).Error
|
||||
if err != nil {
|
||||
@ -201,7 +201,7 @@ func AddBundleBalanceByUserId(data model.BundleBalanceUsePo) (usedType int, err
|
||||
if oldData.ManualAccountConsumptionNumber < oldData.ManualAccountNumber { // 最后消耗手动扩展的
|
||||
oldData.ManualAccountConsumptionNumber++
|
||||
oldData.MonthlyManualAccountConsumptionNumber++
|
||||
usedType = 2
|
||||
usedType = 3
|
||||
goto Over
|
||||
}
|
||||
return errors.New("账号数不足")
|
||||
@ -209,7 +209,7 @@ func AddBundleBalanceByUserId(data model.BundleBalanceUsePo) (usedType int, err
|
||||
if oldData.ManualAccountConsumptionNumber > 0 { // 最后消耗手动扩展的
|
||||
oldData.ManualAccountConsumptionNumber--
|
||||
oldData.MonthlyManualAccountConsumptionNumber--
|
||||
usedType = 2
|
||||
usedType = 3
|
||||
goto Over
|
||||
}
|
||||
if oldData.IncreaseAccountConsumptionNumber > 0 {
|
||||
@ -268,13 +268,14 @@ func AddBundleBalanceByUserId(data model.BundleBalanceUsePo) (usedType int, err
|
||||
if oldData.ManualVideoConsumptionNumber < oldData.ManualVideoNumber { // 手动扩展类型充足
|
||||
oldData.ManualVideoConsumptionNumber++
|
||||
oldData.MonthlyManualVideoConsumptionNumber++ // 记录本月使用的手动扩展
|
||||
usedType = 2
|
||||
usedType = 3
|
||||
goto Over
|
||||
}
|
||||
return errors.New("可用视频数不足")
|
||||
}
|
||||
|
||||
if data.ImageNumber > 0 {
|
||||
// 当月可使用的会过期的限制类型充足
|
||||
// 当月可使用的会过期的限制类型充足
|
||||
if oldData.MonthlyBundleLimitExpiredImageConsumptionNumber < oldData.MonthlyBundleLimitExpiredImageNumber { // 套餐内会过期的限制类型图片充足
|
||||
oldData.MonthlyBundleLimitExpiredImageConsumptionNumber++
|
||||
@ -325,6 +326,7 @@ func AddBundleBalanceByUserId(data model.BundleBalanceUsePo) (usedType int, err
|
||||
}
|
||||
|
||||
if data.DataAnalysisNumber > 0 {
|
||||
// 当月可使用的会过期的限制类型充足
|
||||
// 当月可使用的会过期的限制类型充足
|
||||
if oldData.MonthlyBundleLimitExpiredDataAnalysisConsumptionNumber < oldData.MonthlyBundleLimitExpiredDataAnalysisNumber { // 套餐内会过期的限制类型数据分析充足
|
||||
oldData.MonthlyBundleLimitExpiredDataAnalysisConsumptionNumber++
|
||||
@ -373,52 +375,6 @@ func AddBundleBalanceByUserId(data model.BundleBalanceUsePo) (usedType int, err
|
||||
}
|
||||
return errors.New("可用数据分析数不足")
|
||||
}
|
||||
if data.CompetitiveNumber > 0 {
|
||||
// 当月可使用的会过期的限制类型充足
|
||||
if oldData.MonthlyBundleLimitExpiredCompetitiveConsumptionNumber < oldData.MonthlyBundleLimitExpiredCompetitiveNumber { // 套餐内会过期的限制类型竞品数充足
|
||||
oldData.MonthlyBundleLimitExpiredCompetitiveConsumptionNumber++
|
||||
oldData.BundleLimitCompetitiveExpiredConsumptionNumber++
|
||||
usedType = 1
|
||||
goto Over
|
||||
}
|
||||
if oldData.MonthlyIncreaseLimitExpiredCompetitiveConsumptionNumber < oldData.MonthlyIncreaseLimitExpiredCompetitiveNumber { // 增值服务会过期的限制类型竞品数充足
|
||||
oldData.MonthlyIncreaseLimitExpiredCompetitiveConsumptionNumber++
|
||||
oldData.IncreaseLimitCompetitiveExpiredConsumptionNumber++
|
||||
usedType = 2
|
||||
goto Over
|
||||
}
|
||||
if oldData.MonthlyBundleLimitCompetitiveConsumptionNumber < oldData.MonthlyBundleLimitCompetitiveNumber { // 套餐内限制类型竞品数充足
|
||||
oldData.MonthlyBundleLimitCompetitiveConsumptionNumber++
|
||||
oldData.BundleLimitCompetitiveConsumptionNumber++
|
||||
usedType = 1
|
||||
goto Over
|
||||
}
|
||||
if oldData.MonthlyIncreaseLimitCompetitiveConsumptionNumber < oldData.MonthlyIncreaseLimitCompetitiveNumber { // 增值服务限制类型竞品数充足
|
||||
oldData.MonthlyIncreaseLimitCompetitiveConsumptionNumber++
|
||||
oldData.IncreaseLimitCompetitiveConsumptionNumber++
|
||||
usedType = 2
|
||||
goto Over
|
||||
}
|
||||
if oldData.BundleLimitCompetitiveNumber < oldData.BundleCompetitiveNumber { //套餐内非限制类型的竞品数充足
|
||||
oldData.BundleLimitCompetitiveConsumptionNumber++
|
||||
oldData.MonthlyBundleCompetitiveConsumptionNumber++
|
||||
usedType = 1
|
||||
goto Over
|
||||
}
|
||||
if oldData.IncreaseCompetitiveConsumptionNumber < oldData.IncreaseCompetitiveNumber { //增值服务非限制类型的竞品数充足
|
||||
oldData.IncreaseCompetitiveConsumptionNumber++
|
||||
oldData.MonthlyIncreaseCompetitiveConsumptionNumber++
|
||||
usedType = 2
|
||||
goto Over
|
||||
}
|
||||
if oldData.ManualCompetitiveConsumptionNumber < oldData.ManualCompetitiveNumber { // 手动扩展类型充足
|
||||
oldData.ManualCompetitiveConsumptionNumber++
|
||||
oldData.MonthlyManualCompetitiveConsumptionNumber++ // 记录本月使用的手动扩展
|
||||
usedType = 2
|
||||
goto Over
|
||||
}
|
||||
return errors.New("可用竞品数不足")
|
||||
}
|
||||
Over:
|
||||
return tx.Model(&model.BundleBalance{}).Where("id = ?", oldData.ID).Save(&oldData).Error
|
||||
})
|
||||
@ -432,7 +388,7 @@ func CreateUsedRecord(tx *gorm.DB, data model.BundleUsedRecord) error {
|
||||
func ExtendBundleBalanceByUserId(data model.BundleBalanceExtendPo) error {
|
||||
err := app.ModuleClients.BundleDB.Transaction(func(tx *gorm.DB) error {
|
||||
oldData := model.BundleBalance{}
|
||||
if err := tx.Model(&model.BundleBalance{}).Where("user_id = ?", data.UserId).Where("deleted_at is null").Order("month desc,created_at desc").First(&oldData).Error; err != nil {
|
||||
if err := tx.Model(&model.BundleBalance{}).Where("user_id = ?", data.UserId).Where("deleted_at is null").Order("created_at desc").First(&oldData).Error; err != nil {
|
||||
return errors.New("用户还没有套餐信息")
|
||||
}
|
||||
oldData.ManualAccountNumber += data.AccountNumber
|
||||
@ -443,8 +399,6 @@ func ExtendBundleBalanceByUserId(data model.BundleBalanceExtendPo) error {
|
||||
oldData.MonthlyNewManualDataAnalysisNumber += data.DataAnalysisNumber
|
||||
oldData.ManualVideoNumber += data.VideoNumber
|
||||
oldData.MonthlyNewManualVideoNumber += data.VideoNumber
|
||||
oldData.ManualCompetitiveNumber += data.CompetitiveNumber
|
||||
oldData.MonthlyNewManualCompetitiveNumber += data.CompetitiveNumber
|
||||
oldData.MonthlyNewDurationNumber += data.DurationNumber // 记录本月新增手动扩展时长
|
||||
oldData.ExpiredAt = oldData.ExpiredAt.Add(time.Hour * 24 * time.Duration(data.DurationNumber))
|
||||
return tx.Model(&model.BundleBalance{}).Where("id = ?", oldData.ID).Save(&oldData).Error
|
||||
@ -453,6 +407,14 @@ func ExtendBundleBalanceByUserId(data model.BundleBalanceExtendPo) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// 套餐余额更新成功后,同步增量更新任务余额
|
||||
// 如果任务余额更新失败,只记录错误日志,不影响主流程
|
||||
if taskErr := ExtendTaskBalanceByUserId(data.UserId, data.ImageNumber, data.DataAnalysisNumber, data.VideoNumber, data.DurationNumber); taskErr != nil {
|
||||
// 记录错误日志但不返回错误,避免影响主流程
|
||||
logger.Errorf("任务余额同步失败,用户ID: %d, 错误: %v", data.UserId, taskErr)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -460,6 +422,13 @@ func CreateBundleBalance(data model.BundleBalance) error {
|
||||
if err := app.ModuleClients.BundleDB.Save(&data).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
// 同步任务余额(新建套餐余额时)
|
||||
// 如果任务余额同步失败,只记录错误日志,不影响主流程
|
||||
if taskErr := SyncTaskBalanceFromBundleBalance(data); taskErr != nil {
|
||||
// 记录错误日志但不返回错误,避免影响主流程
|
||||
logger.Errorf("新建套餐余额时任务余额同步失败,更新数据: %v, 错误 %v", data, taskErr)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -532,26 +501,23 @@ func ToBeComfirmedWorks(req *bundle.ToBeComfirmedWorksReq) (data []model.CastWor
|
||||
unConfirmSubQuery := app.ModuleClients.BundleDB.
|
||||
Table("cast_work_log").
|
||||
Select("work_uuid, MAX(update_time) AS max_update_time").
|
||||
Where("cast_work_log.deleted_at = 0").
|
||||
Group("work_uuid").Where("work_status = ?", 4)
|
||||
|
||||
err = app.ModuleClients.BundleDB.
|
||||
Table("cast_work_log AS cwl").
|
||||
Joins("INNER JOIN (?) AS t ON cwl.work_uuid = t.work_uuid AND cwl.update_time = t.max_update_time", unConfirmSubQuery).
|
||||
Where("artist_uuid = ?", req.ArtistUuid).Where("cwl.deleted_at = 0").Where("confirmed_at = ?", 0).Count(&unconfirmed).Error
|
||||
Where("artist_uuid = ?", req.ArtistUuid).Where("confirmed_at = ?", 0).Count(&unconfirmed).Error
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
subQuery := app.ModuleClients.BundleDB.
|
||||
Table("cast_work_log").
|
||||
Select("work_uuid, MAX(update_time) AS max_update_time").
|
||||
Where("cast_work_log.deleted_at = 0").
|
||||
Group("work_uuid").Where("work_status in ?", []int{4, 5, 6, 7, 9})
|
||||
Group("work_uuid").Where("work_status in ?", []int{4, 5, 6, 7})
|
||||
session := app.ModuleClients.BundleDB.
|
||||
Table("cast_work_log AS cwl").
|
||||
Joins("INNER JOIN (?) AS t ON cwl.work_uuid = t.work_uuid AND cwl.update_time = t.max_update_time", subQuery).
|
||||
Where("artist_uuid = ?", req.ArtistUuid).
|
||||
Where("cwl.deleted_at = 0")
|
||||
Where("artist_uuid = ?", req.ArtistUuid)
|
||||
err = session.Count(&total).Error
|
||||
if err != nil {
|
||||
return
|
||||
@ -567,27 +533,6 @@ func ConfirmWork(req *bundle.ConfirmWorkReq) error {
|
||||
return app.ModuleClients.BundleDB.Model(&model.CastWorkLog{}).Where(&model.CastWorkLog{WorkUuid: req.WorkUuid}).Update("confirmed_at", time.Now().Unix()).Error
|
||||
}
|
||||
|
||||
func GetWaitConfirmWorkList() (data []model.CastWork, err error) {
|
||||
randomHours := rand.Intn(22) + 2 // 2-22小时
|
||||
now := time.Now()
|
||||
startTime := now.Add(-time.Duration(randomHours+2) * time.Hour).Format("2006-01-02 15:04:05")
|
||||
endTime := now.Add(-time.Duration(randomHours) * time.Hour).Format("2006-01-02 15:04:05")
|
||||
fmt.Println("检查开始时间:", startTime, "检查结束时间:", endTime)
|
||||
err = app.ModuleClients.BundleDB.Model(&model.CastWork{}).
|
||||
Joins("left join cast_work_log cwl on cwl.work_uuid = cast_work.uuid and cwl.work_status = 4 and cwl.deleted_at = 0").
|
||||
Where("cast_work.deleted_at = 0").
|
||||
Where("cast_work.status = ?", 4).
|
||||
Where("cwl.update_time > ?", startTime).
|
||||
Where("cwl.update_time < ?", endTime).
|
||||
Order("cast_work.submit_time asc").
|
||||
Limit(5).
|
||||
Find(&data).Error
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func BundleActivate(ids []uint32) error {
|
||||
for _, v := range ids {
|
||||
app.ModuleClients.BundleDB.Transaction(func(tx *gorm.DB) error {
|
||||
@ -677,26 +622,6 @@ inner join (
|
||||
return min(limit, remaining)
|
||||
}
|
||||
|
||||
//计算每个季度发放的数目
|
||||
qua := func(total, limit int) int {
|
||||
var released int // 已释放的次数
|
||||
if v.StartAt.Month() == now.Month() && v.StartAt.Year() == now.Year() {
|
||||
} else {
|
||||
released += limit
|
||||
}
|
||||
interval := max((now.Year()*12+int(now.Month())-(v.StartAt.Year()*12+int(v.StartAt.Month())))/3, 1) // 释放了多少个季度
|
||||
released += max(interval-1, 0) * limit // 已经释放的数量
|
||||
remaining := max(total-released, 0) // 还剩余多少次没有发放
|
||||
if v.StartAt.Month() == now.Month() && v.StartAt.Year() == now.Year() { // 本月为第一个月后购买
|
||||
return min(limit, remaining)
|
||||
}
|
||||
monthDiff := now.Year()*12 + int(now.Month()) - (v.StartAt.Year()*12 + int(v.StartAt.Month()))
|
||||
if monthDiff%3 == 0 && v.ExpiredAt.Month() != now.Month() {
|
||||
return min(limit, remaining)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// 当月过期的视频数
|
||||
v.MonthlyInvalidBundleVideoNumber = v.MonthlyBundleLimitExpiredVideoNumber - v.MonthlyBundleLimitExpiredVideoConsumptionNumber
|
||||
// 历史失效的套餐权益视频总数
|
||||
@ -709,10 +634,6 @@ inner join (
|
||||
v.MonthlyInvalidBundleDataAnalysisNumber = v.MonthlyBundleLimitExpiredDataAnalysisNumber - v.MonthlyBundleLimitExpiredDataAnalysisConsumptionNumber // 当月过期的数据分析数
|
||||
// 历史失效的套餐权益数据分析总数
|
||||
v.InvalidBundleDataAnalysisNumber += v.MonthlyInvalidBundleDataAnalysisNumber
|
||||
// 当月过期的竞品数
|
||||
v.MonthlyInvalidBundleCompetitiveNumber = v.MonthlyBundleLimitExpiredCompetitiveNumber - v.MonthlyBundleLimitExpiredCompetitiveConsumptionNumber
|
||||
// 历史失效的套餐权益竞品数总数
|
||||
v.InvalidBundleCompetitiveNumber += v.MonthlyInvalidBundleCompetitiveNumber
|
||||
|
||||
// 当月失效的增值权益视频总数
|
||||
v.MonthlyInvalidIncreaseVideoNumber = v.MonthlyIncreaseLimitExpiredVideoNumber - v.MonthlyIncreaseLimitExpiredVideoConsumptionNumber
|
||||
@ -726,10 +647,6 @@ inner join (
|
||||
v.MonthlyInvalidIncreaseDataAnalysisNumber = v.MonthlyIncreaseLimitExpiredDataAnalysisNumber - v.MonthlyIncreaseLimitExpiredDataAnalysisConsumptionNumber
|
||||
// 历史失效的增值权益数据分析总数
|
||||
v.InvalidIncreaseDataAnalysisNumber += v.MonthlyInvalidIncreaseDataAnalysisNumber
|
||||
// 当月失效的增值权益竞品数总数
|
||||
v.MonthlyInvalidIncreaseCompetitiveNumber = v.MonthlyIncreaseLimitExpiredCompetitiveNumber - v.MonthlyIncreaseLimitExpiredCompetitiveConsumptionNumber
|
||||
// 历史失效的增值权益竞品数总数
|
||||
v.InvalidIncreaseCompetitiveNumber += v.MonthlyInvalidIncreaseCompetitiveNumber
|
||||
|
||||
// 当月套餐限制类会过期型视频可使用额度
|
||||
v.MonthlyBundleLimitExpiredVideoNumber = cal(v.BundleLimitVideoExpiredNumber, v.MonthlyLimitVideoQuotaNumber)
|
||||
@ -739,7 +656,6 @@ inner join (
|
||||
v.MonthlyBundleLimitVideoNumber = v.MonthlyBundleLimitVideoNumber - v.MonthlyBundleLimitVideoConsumptionNumber + cal(v.BundleLimitVideoNumber, v.MonthlyLimitVideoQuotaNumber)
|
||||
// 当月增值限制类型视频可使用额度
|
||||
v.MonthlyIncreaseLimitVideoNumber = v.MonthlyIncreaseLimitVideoNumber - v.MonthlyIncreaseLimitVideoConsumptionNumber + cal(v.IncreaseLimitVideoNumber, v.MonthlyLimitVideoQuotaNumber)
|
||||
|
||||
// 当月套餐限制类会过期型图片可使用额度
|
||||
v.MonthlyBundleLimitExpiredImageNumber = cal(v.BundleLimitImageExpiredNumber, v.MonthlyLimitImageQuotaNumber)
|
||||
// 当月增值限制类会过期型图片可使用额度
|
||||
@ -748,27 +664,16 @@ inner join (
|
||||
v.MonthlyBundleLimitImageNumber = v.MonthlyBundleLimitImageNumber - v.MonthlyBundleLimitImageConsumptionNumber + cal(v.BundleLimitImageNumber, v.MonthlyLimitImageQuotaNumber)
|
||||
// 当月增值限制类型图片可使用额度
|
||||
v.MonthlyIncreaseLimitImageNumber = v.MonthlyIncreaseLimitImageNumber - v.MonthlyIncreaseLimitImageConsumptionNumber + cal(v.IncreaseLimitImageNumber, v.MonthlyLimitImageQuotaNumber)
|
||||
|
||||
// 当月套餐限制类会过期型数据分析可使用额度
|
||||
v.MonthlyBundleLimitExpiredDataAnalysisNumber = cal(v.BundleLimitDataAnalysisExpiredNumber, v.MonthlyLimitDataAnalysisQuotaNumber)
|
||||
// 当月增值限制类会过期型数据分析可使用额度
|
||||
v.MonthlyIncreaseLimitExpiredDataAnalysisNumber = cal(v.IncreaseLimitDataAnalysisExpiredNumber, v.MonthlyLimitDataAnalysisQuotaNumber)
|
||||
// 当月套餐限制类型数据分析可使用额度
|
||||
v.MonthlyBundleLimitDataAnalysisNumber = v.MonthlyBundleLimitDataAnalysisNumber - v.MonthlyBundleLimitDataAnalysisConsumptionNumber + cal(v.BundleLimitDataAnalysisNumber, v.MonthlyLimitDataAnalysisQuotaNumber)
|
||||
v.MonthlyBundleLimitDataAnalysisNumber = v.MonthlyBundleLimitDataAnalysisNumber - v.MonthlyBundleLimitDataAnalysisConsumptionNumber + cal(v.BundleLimitImageNumber, v.MonthlyLimitImageQuotaNumber)
|
||||
// 当月增值限制类型数据分析可使用额度
|
||||
v.MonthlyIncreaseLimitDataAnalysisNumber = v.MonthlyIncreaseLimitDataAnalysisNumber - v.MonthlyIncreaseLimitDataAnalysisConsumptionNumber + cal(v.IncreaseLimitDataAnalysisNumber, v.MonthlyLimitDataAnalysisQuotaNumber)
|
||||
|
||||
// 当月套餐限制类会过期型竞品数可使用额度
|
||||
v.MonthlyBundleLimitExpiredCompetitiveNumber = qua(v.BundleLimitCompetitiveExpiredNumber, v.MonthlyLimitCompetitiveQuotaNumber)
|
||||
// 当月增值限制类会过期型竞品数可使用额度
|
||||
v.MonthlyIncreaseLimitExpiredCompetitiveNumber = qua(v.IncreaseLimitCompetitiveExpiredNumber, v.MonthlyLimitCompetitiveQuotaNumber)
|
||||
// 当月套餐限制类型竞品数可使用额度
|
||||
v.MonthlyBundleLimitCompetitiveNumber = v.MonthlyBundleLimitCompetitiveNumber - v.MonthlyBundleLimitCompetitiveConsumptionNumber + qua(v.BundleLimitCompetitiveNumber, v.MonthlyLimitCompetitiveQuotaNumber)
|
||||
// 当月增值限制类型竞品数可使用额度
|
||||
v.MonthlyIncreaseLimitCompetitiveNumber = v.MonthlyIncreaseLimitCompetitiveNumber - v.MonthlyIncreaseLimitCompetitiveConsumptionNumber + qua(v.IncreaseLimitCompetitiveNumber, v.MonthlyLimitCompetitiveQuotaNumber)
|
||||
v.MonthlyIncreaseLimitDataAnalysisNumber = v.MonthlyIncreaseLimitDataAnalysisNumber - v.MonthlyIncreaseLimitDataAnalysisConsumptionNumber + cal(v.IncreaseLimitImageNumber, v.MonthlyLimitImageQuotaNumber)
|
||||
|
||||
// 重置单月消耗数量
|
||||
//视频
|
||||
v.MonthlyBundleVideoConsumptionNumber = 0
|
||||
v.MonthlyIncreaseVideoConsumptionNumber = 0
|
||||
v.MonthlyBundleLimitVideoConsumptionNumber = 0
|
||||
@ -777,7 +682,6 @@ inner join (
|
||||
v.MonthlyIncreaseLimitExpiredVideoConsumptionNumber = 0
|
||||
v.MonthlyNewManualVideoNumber = 0
|
||||
v.MonthlyManualVideoConsumptionNumber = 0
|
||||
//图文
|
||||
v.MonthlyBundleImageConsumptionNumber = 0
|
||||
v.MonthlyIncreaseImageConsumptionNumber = 0
|
||||
v.MonthlyBundleLimitImageConsumptionNumber = 0
|
||||
@ -786,7 +690,6 @@ inner join (
|
||||
v.MonthlyIncreaseLimitExpiredImageConsumptionNumber = 0
|
||||
v.MonthlyNewManualImageNumber = 0
|
||||
v.MonthlyManualImageConsumptionNumber = 0
|
||||
//数据分析
|
||||
v.MonthlyBundleDataAnalysisConsumptionNumber = 0
|
||||
v.MonthlyIncreaseDataAnalysisConsumptionNumber = 0
|
||||
v.MonthlyBundleLimitDataAnalysisConsumptionNumber = 0
|
||||
@ -795,20 +698,9 @@ inner join (
|
||||
v.MonthlyIncreaseLimitExpiredDataAnalysisConsumptionNumber = 0
|
||||
v.MonthlyNewManualDataAnalysisNumber = 0
|
||||
v.MonthlyManualDataAnalysisConsumptionNumber = 0
|
||||
//竞品数
|
||||
v.MonthlyBundleCompetitiveConsumptionNumber = 0
|
||||
v.MonthlyIncreaseCompetitiveConsumptionNumber = 0
|
||||
v.MonthlyBundleLimitCompetitiveConsumptionNumber = 0
|
||||
v.MonthlyIncreaseLimitCompetitiveConsumptionNumber = 0
|
||||
v.MonthlyBundleLimitExpiredCompetitiveConsumptionNumber = 0
|
||||
v.MonthlyIncreaseLimitExpiredCompetitiveConsumptionNumber = 0
|
||||
v.MonthlyNewManualCompetitiveNumber = 0
|
||||
v.MonthlyManualCompetitiveConsumptionNumber = 0
|
||||
|
||||
v.Month = month
|
||||
v.ID = 0
|
||||
v.CreatedAt = time.Time{}
|
||||
v.UpdatedAt = time.Time{}
|
||||
app.ModuleClients.BundleDB.Create(&v)
|
||||
}
|
||||
return nil
|
||||
@ -843,7 +735,7 @@ left join (
|
||||
where r.deleted_at is null
|
||||
group by
|
||||
r.bundle_order_on
|
||||
) r on r.bundle_order_on COLLATE utf8mb4_general_ci = bor.order_no COLLATE utf8mb4_general_ci
|
||||
) r on r.bundle_order_on = bor.order_no
|
||||
`).Scan(&data).Error
|
||||
return
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -4,7 +4,6 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/shopspring/decimal"
|
||||
"micro-bundle/internal/model"
|
||||
"micro-bundle/pb/bundle"
|
||||
"micro-bundle/pkg/app"
|
||||
@ -128,26 +127,6 @@ func UpdateOrderRecordByOrderNO(orderRecord *model.BundleOrderRecords) (res *bun
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tempRecord := new(model.BundleOrderRecords)
|
||||
if err := app.ModuleClients.BundleDB.Where("deleted_at is null and order_no = ?", orderRecord.OrderNo).First(&tempRecord).Error; err != nil {
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return nil, errors.New("订单记录不存在")
|
||||
}
|
||||
return nil, fmt.Errorf("查询订单失败: %v", err)
|
||||
}
|
||||
if orderRecord.Status == 2 && tempRecord.AmountType == 2 && tempRecord.TotalAmount > 0 {
|
||||
// 当回调支付成功,币种是美元,且订单金额大于0,计算美元手续费:订单金额*0.019(四舍五入保留两位小数字)+0.1
|
||||
amount := decimal.NewFromFloat32(tempRecord.TotalAmount)
|
||||
rate, _ := decimal.NewFromString("0.019")
|
||||
fee := amount.Mul(rate)
|
||||
// 4. 四舍五入保留两位小数
|
||||
feeRounded := fee.Round(2)
|
||||
addition, _ := decimal.NewFromString("0.1")
|
||||
result := feeRounded.Add(addition)
|
||||
valueAdd.HandlingFee = result.String()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
err = app.ModuleClients.BundleDB.Model(&model.BundleOrderValueAdd{}).
|
||||
@ -380,7 +359,6 @@ func OrderRecordDetail(req *bundle.OrderRecordsDetailRequest) (res *bundle.Order
|
||||
ValueAddBundleAmount: orderRecord.ValueAddBundleAmount,
|
||||
TotalAmount: orderRecord.TotalAmount,
|
||||
ExpirationTime: orderRecord.ExpirationTime,
|
||||
ReSignature: int32(orderRecord.ReSignature),
|
||||
}
|
||||
res.AddInfos = make([]*bundle.AddInfo, 0)
|
||||
res.AddInfos = addInfos
|
||||
@ -539,7 +517,6 @@ func OrderRecordsListV2(req *bundle.OrderRecordsRequestV2) (res *bundle.OrderRec
|
||||
Amount: record.Amount,
|
||||
CustomerId: customerID,
|
||||
PayTime: record.PayTime,
|
||||
InviterId: record.InviterID,
|
||||
}
|
||||
|
||||
// 聚合子订单
|
||||
@ -829,19 +806,6 @@ func UpdateReconciliationStatusBySerialNumber(req *bundle.UpdateStatusAndPayTime
|
||||
PayStatus: int(req.PaymentStatus),
|
||||
SerialNumber: req.SerialNumber,
|
||||
}
|
||||
|
||||
if req.PaymentStatus == 2 && existing.CurrencyType == 2 && existing.PayAmount > 0 {
|
||||
// 当回调支付成功,币种是美元,且订单金额大于0,计算美元手续费:订单金额*0.019(四舍五入保留两位小数字)+0.1
|
||||
amount := decimal.NewFromFloat32(existing.PayAmount)
|
||||
rate, _ := decimal.NewFromString("0.019")
|
||||
fee := amount.Mul(rate)
|
||||
// 4. 四舍五入保留两位小数
|
||||
feeRounded := fee.Round(2)
|
||||
addition, _ := decimal.NewFromString("0.1")
|
||||
result := feeRounded.Add(addition)
|
||||
updates.HandlingFee = result.String()
|
||||
}
|
||||
|
||||
if err := app.ModuleClients.BundleDB.Model(&existing).Updates(updates).Error; err != nil {
|
||||
return nil, fmt.Errorf("更新对账单失败: %v", err)
|
||||
}
|
||||
@ -885,7 +849,6 @@ func ListUnfinishedInfos(req *bundle.AutoCreateUserAndOrderRequest) (res *bundle
|
||||
unfinishedInfo.OrderPayCurrency = info.OrderPayCurrency
|
||||
unfinishedInfo.OrderAccountCurrency = info.OrderAccountCurrency
|
||||
unfinishedInfo.PayTime = info.PayTime.Format("2006-01-02 15:04:05")
|
||||
unfinishedInfo.CardNum = info.CardNum
|
||||
res.UnfinishedInfos = append(res.UnfinishedInfos, unfinishedInfo)
|
||||
}
|
||||
|
||||
@ -911,71 +874,3 @@ func SoftDeleteUnfinishedInfo(req *bundle.SoftDeleteUnfinishedInfoRequest) (res
|
||||
|
||||
return res, nil
|
||||
}
|
||||
func ReSignTheContract(req *bundle.ReSignTheContractRequest) (*bundle.CommonResponse, error) {
|
||||
res := new(bundle.CommonResponse)
|
||||
|
||||
// 验证请求参数
|
||||
if req.OrderNo == "" {
|
||||
return res, errors.New("订单号不能为空")
|
||||
}
|
||||
|
||||
now := time.Now().Format("2006-01-02 15:04:05")
|
||||
|
||||
// 开启事务确保两个表的更新一致性
|
||||
tx := app.ModuleClients.BundleDB.Begin()
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
tx.Rollback()
|
||||
//err = fmt.Errorf("事务执行失败: %v", r)
|
||||
}
|
||||
}()
|
||||
|
||||
// 1. 更新 BundleOrderRecords 表
|
||||
recordsUpdate := map[string]interface{}{
|
||||
"sign_contract": req.SignContract,
|
||||
"signed_time": now,
|
||||
"contract_no": req.ContractNo,
|
||||
"re_signature": 2,
|
||||
}
|
||||
|
||||
if err := tx.Model(&model.BundleOrderRecords{}).
|
||||
Where("order_no = ?", req.OrderNo).
|
||||
Updates(recordsUpdate).Error; err != nil {
|
||||
tx.Rollback()
|
||||
return res, fmt.Errorf("更新订单记录失败: %v", err)
|
||||
}
|
||||
|
||||
// 2. 更新 BundleOrderValueAdd 表
|
||||
valueAddUpdate := map[string]interface{}{
|
||||
"sign_contract": req.SignContract,
|
||||
"signed_time": now,
|
||||
}
|
||||
|
||||
if err := tx.Model(&model.BundleOrderValueAdd{}).
|
||||
Where("order_no = ?", req.OrderNo).
|
||||
Updates(valueAddUpdate).Error; err != nil {
|
||||
tx.Rollback()
|
||||
return res, fmt.Errorf("更新订单增值信息失败: %v", err)
|
||||
}
|
||||
|
||||
// 3. 检查是否实际更新了记录
|
||||
var affectedRecords, affectedValueAdd int64
|
||||
tx.Model(&model.BundleOrderRecords{}).Where("order_no = ?", req.OrderNo).Count(&affectedRecords)
|
||||
tx.Model(&model.BundleOrderValueAdd{}).Where("order_no = ?", req.OrderNo).Count(&affectedValueAdd)
|
||||
|
||||
if affectedRecords == 0 {
|
||||
tx.Rollback()
|
||||
return res, errors.New("未找到对应的订单记录")
|
||||
}
|
||||
|
||||
// 提交事务
|
||||
if err := tx.Commit().Error; err != nil {
|
||||
return res, fmt.Errorf("事务提交失败: %v", err)
|
||||
}
|
||||
|
||||
// 设置响应信息(如果有需要)
|
||||
res.Msg = "重新签约成功"
|
||||
res.OrderNo = req.OrderNo
|
||||
|
||||
return res, nil
|
||||
}
|
||||
|
||||
570
internal/dao/taskBalanceSync.go
Normal file
570
internal/dao/taskBalanceSync.go
Normal file
@ -0,0 +1,570 @@
|
||||
package dao
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"micro-bundle/internal/model"
|
||||
"micro-bundle/pkg/app"
|
||||
)
|
||||
|
||||
// RunInitialTaskBalanceSync 一次性将 BundleBalance 同步到 TaskBalance
|
||||
// 仅在未执行过且任务余额表为空时运行;执行成功后写入标记,避免再次执行
|
||||
func RunInitialTaskBalanceSync() error {
|
||||
// 确保标记表存在
|
||||
_ = app.ModuleClients.TaskBenchDB.AutoMigrate(&model.TaskSyncStatus{})
|
||||
|
||||
// 已执行标记检查
|
||||
var markerCount int64
|
||||
if err := app.ModuleClients.TaskBenchDB.Model(&model.TaskSyncStatus{}).
|
||||
Where("sync_key = ?", model.InitialSyncKey).Count(&markerCount).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
if markerCount > 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
// 安全检查:如果任务余额表已存在数据,则不再执行,同样写入标记
|
||||
var existing int64
|
||||
if err := app.ModuleClients.TaskBenchDB.Model(&model.TaskBalance{}).Count(&existing).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
if existing > 0 {
|
||||
_ = app.ModuleClients.TaskBenchDB.Create(&model.TaskSyncStatus{
|
||||
SyncKey: model.InitialSyncKey,
|
||||
ExecutedAt: time.Now(),
|
||||
Remark: "skipped: task_balance already has data",
|
||||
}).Error
|
||||
return nil
|
||||
}
|
||||
|
||||
// 获取当前有效(未过期且已支付)的艺人及其最新订单
|
||||
validArtists, err := GetValidArtistList()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Println(validArtists)
|
||||
if len(validArtists) == 0 {
|
||||
// 不写入已执行标记,留待后续有数据时再次执行
|
||||
fmt.Println("无数据更新")
|
||||
return nil
|
||||
}
|
||||
|
||||
// 构造待插入的 TaskBalance 列表
|
||||
tasks := make([]model.TaskBalance, 0, len(validArtists))
|
||||
for _, a := range validArtists {
|
||||
// 根据 user_id + order_uuid 获取 BundleBalance 明细
|
||||
var bb model.BundleBalance
|
||||
if err := app.ModuleClients.BundleDB.Where("user_id = ? AND order_uuid = ?", a.UserID, a.OrderUUID).First(&bb).Error; err != nil {
|
||||
// 若未查到则跳过该条
|
||||
if err == gorm.ErrRecordNotFound {
|
||||
continue
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
subNum, telNum, err := fetchIdentityForBundle(&bb)
|
||||
if err != nil {
|
||||
// 无法获取身份信息则跳过该条
|
||||
continue
|
||||
}
|
||||
|
||||
tb := model.TaskBalance{
|
||||
SubNum: subNum,
|
||||
TelNum: telNum,
|
||||
Month: bb.Month,
|
||||
StartAt: bb.StartAt,
|
||||
ExpiredAt: bb.ExpiredAt,
|
||||
CreatedAt: time.Now(),
|
||||
UpdatedAt: time.Now(),
|
||||
}
|
||||
copyBundleToTaskBalance(&tb, &bb)
|
||||
tasks = append(tasks, tb)
|
||||
}
|
||||
|
||||
// 原子写入:插入 TaskBalance + 插入标记(确保有插入才写标记)
|
||||
tx := app.ModuleClients.TaskBenchDB.Begin()
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
tx.Rollback()
|
||||
}
|
||||
}()
|
||||
|
||||
if len(tasks) == 0 {
|
||||
// 没有可插入的数据,不写标记,直接返回
|
||||
tx.Rollback()
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := tx.Create(&tasks).Error; err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
}
|
||||
if err := tx.Create(&model.TaskSyncStatus{
|
||||
SyncKey: model.InitialSyncKey,
|
||||
ExecutedAt: time.Now(),
|
||||
Remark: "initial sync executed",
|
||||
}).Error; err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
}
|
||||
if err := tx.Commit().Error; err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// RunIncrementalTaskBalanceSync 增量同步:每次服务重启时执行
|
||||
// 将套餐余额表中的新数据同步到任务余额表,跳过已存在的记录
|
||||
func RunIncrementalTaskBalanceSync() error {
|
||||
// 获取当前有效(未过期且已支付)的艺人及其最新订单
|
||||
validArtists, err := GetValidArtistList()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(validArtists) == 0 {
|
||||
fmt.Println("增量同步:无有效艺人数据")
|
||||
return nil
|
||||
}
|
||||
|
||||
// 构造待插入的 TaskBalance 列表(仅包含不存在的记录)
|
||||
tasks := make([]model.TaskBalance, 0)
|
||||
skippedCount := 0
|
||||
|
||||
for _, a := range validArtists {
|
||||
// 根据 user_id + order_uuid 获取 BundleBalance 明细
|
||||
var bb model.BundleBalance
|
||||
if err := app.ModuleClients.BundleDB.Where("user_id = ? AND order_uuid = ?", a.UserID, a.OrderUUID).First(&bb).Error; err != nil {
|
||||
// 若未查到则跳过该条
|
||||
if err == gorm.ErrRecordNotFound {
|
||||
continue
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
subNum, telNum, err := fetchIdentityForBundle(&bb)
|
||||
if err != nil {
|
||||
// 无法获取身份信息则跳过该条
|
||||
continue
|
||||
}
|
||||
|
||||
// 检查任务余额表中是否已存在该记录(按 sub_num + tel_num + month 唯一)
|
||||
var existingCount int64
|
||||
if err := app.ModuleClients.TaskBenchDB.Model(&model.TaskBalance{}).
|
||||
Where("sub_num = ? AND tel_num = ? AND month = ?", subNum, telNum, bb.Month).
|
||||
Count(&existingCount).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if existingCount > 0 {
|
||||
// 记录已存在,跳过
|
||||
skippedCount++
|
||||
continue
|
||||
}
|
||||
|
||||
// 构造新的 TaskBalance 记录
|
||||
tb := model.TaskBalance{
|
||||
SubNum: subNum,
|
||||
TelNum: telNum,
|
||||
Month: bb.Month,
|
||||
StartAt: bb.StartAt,
|
||||
ExpiredAt: bb.ExpiredAt,
|
||||
CreatedAt: time.Now(),
|
||||
UpdatedAt: time.Now(),
|
||||
}
|
||||
copyBundleToTaskBalance(&tb, &bb)
|
||||
tasks = append(tasks, tb)
|
||||
}
|
||||
|
||||
fmt.Printf("增量同步:跳过已存在记录 %d 条,准备插入新记录 %d 条\n", skippedCount, len(tasks))
|
||||
|
||||
// 如果没有新记录需要插入,直接返回
|
||||
if len(tasks) == 0 {
|
||||
fmt.Println("增量同步:无新记录需要同步")
|
||||
return nil
|
||||
}
|
||||
|
||||
// 批量插入新记录
|
||||
if err := app.ModuleClients.TaskBenchDB.Create(&tasks).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fmt.Printf("增量同步:成功插入 %d 条新记录\n", len(tasks))
|
||||
return nil
|
||||
}
|
||||
|
||||
// 用户新买套餐时使用
|
||||
// SyncTaskBalanceFromBundleBalance 增量/每月:根据单条 BundleBalance 同步或更新 TaskBalance(按 sub_num + tel_num + month 唯一)
|
||||
func SyncTaskBalanceFromBundleBalance(bb model.BundleBalance) error {
|
||||
// 获取身份信息(sub_num, tel_num)
|
||||
subNum, telNum, err := fetchIdentityForBundle(&bb)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// 组装 TaskBalance
|
||||
tb := model.TaskBalance{
|
||||
SubNum: subNum,
|
||||
TelNum: telNum,
|
||||
Month: bb.Month,
|
||||
ExpiredAt: bb.ExpiredAt,
|
||||
StartAt: bb.StartAt,
|
||||
UpdatedAt: time.Now(),
|
||||
CreatedAt: time.Now(),
|
||||
}
|
||||
copyBundleToTaskBalance(&tb, &bb)
|
||||
|
||||
// 查询是否已存在(唯一:sub_num + tel_num + month)
|
||||
var existing model.TaskBalance
|
||||
err = app.ModuleClients.TaskBenchDB.
|
||||
Where("sub_num = ? AND tel_num = ? AND month = ?", subNum, telNum, bb.Month).
|
||||
First(&existing).Error
|
||||
if err != nil {
|
||||
if err == gorm.ErrRecordNotFound {
|
||||
// 不存在则创建
|
||||
return app.ModuleClients.TaskBenchDB.Create(&tb).Error
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// 已存在则更新所有映射字段与时间
|
||||
tb.ID = existing.ID
|
||||
return app.ModuleClients.TaskBenchDB.Save(&tb).Error
|
||||
}
|
||||
|
||||
// fetchIdentityForBundle 根据 BundleBalance 拿到 sub_num 与 tel_num
|
||||
func fetchIdentityForBundle(bb *model.BundleBalance) (string, string, error) {
|
||||
// tel_num 来自 micro-account.user
|
||||
type userRow struct {
|
||||
Tel string
|
||||
}
|
||||
var ur userRow
|
||||
if err := app.ModuleClients.BundleDB.Table("`micro-account`.`user`").Unscoped().
|
||||
Select("tel_num AS tel").Where("id = ?", bb.UserId).Limit(1).Scan(&ur).Error; err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
// customer_num 来自 bundle_order_records(按 order_uuid)
|
||||
type orderRow struct {
|
||||
Customer string
|
||||
}
|
||||
var or orderRow
|
||||
if bb.OrderUUID == "" {
|
||||
return "", "", errors.New("bundle order_uuid missing")
|
||||
}
|
||||
if err := app.ModuleClients.BundleDB.Table("bundle_order_records").
|
||||
Select("customer_num AS customer").Where("uuid = ?", bb.OrderUUID).Limit(1).Scan(&or).Error; err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
return or.Customer, ur.Tel, nil
|
||||
}
|
||||
|
||||
// UpdateTaskBalance 每月批量更新任务余额
|
||||
// 类似于 UpdateBundleBalance 的逻辑,但针对任务余额表
|
||||
func UpdateTaskBalanceEveryMon() error {
|
||||
// 查询需要更新的任务余额记录(最新月份且未过期的记录)
|
||||
tl := []model.TaskBalance{}
|
||||
if err := app.ModuleClients.TaskBenchDB.Raw(`select
|
||||
*
|
||||
from
|
||||
task_balance tb
|
||||
inner join (
|
||||
select
|
||||
max(tb.month) as month ,
|
||||
sub_num,
|
||||
tel_num
|
||||
from
|
||||
task_balance tb
|
||||
group by
|
||||
tb.sub_num, tb.tel_num
|
||||
) newest on
|
||||
newest.month = tb.month
|
||||
and (tb.sub_num = newest.sub_num OR tb.tel_num = newest.tel_num)
|
||||
and tb.expired_at > now()`).Find(&tl).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
now := time.Now()
|
||||
month := time.Now().Format("2006-01")
|
||||
|
||||
for _, v := range tl {
|
||||
if v.Month == month {
|
||||
continue
|
||||
}
|
||||
|
||||
cal := func(total, limit int) int { // 计算本月发放的限制类型数量
|
||||
var released int // 已释放的次数
|
||||
if v.StartAt.Month() == now.Month() && v.StartAt.Year() == now.Year() {
|
||||
} else if v.StartAt.Day() >= 16 { //第一个月释放的
|
||||
released += (limit + 1) / 2
|
||||
} else {
|
||||
released += limit
|
||||
}
|
||||
interval := now.Year()*12 + int(now.Month()) - (v.StartAt.Year()*12 + int(v.StartAt.Month())) // 释放了多少个月
|
||||
released += max(interval-1, 0) * limit // 后续月份释放的
|
||||
remaining := max(total-released, 0) // 还剩余多少次没有发放
|
||||
|
||||
if v.StartAt.Month() == now.Month() && v.StartAt.Year() == now.Year() && v.StartAt.Day() >= 16 { // 本月为第一个月并且16号后购买只给一半(向上取整)
|
||||
return min((limit+1)/2, remaining)
|
||||
}
|
||||
if v.ExpiredAt.Month() == now.Month() && v.ExpiredAt.Year() == now.Year() && v.ExpiredAt.Day() < 16 { // 本月为最后一个月并且16号前到期只给一半(向下取整)
|
||||
return min(limit/2, remaining)
|
||||
}
|
||||
return min(limit, remaining)
|
||||
}
|
||||
|
||||
v.MonthlyInvalidBundleVideoNumber = v.MonthlyBundleLimitExpiredVideoNumber - v.MonthlyBundleLimitExpiredVideoConsumptionNumber // 当月过期的视频数
|
||||
v.InvalidBundleVideoNumber += v.MonthlyInvalidBundleVideoNumber
|
||||
v.MonthlyInvalidBundleImageNumber = v.MonthlyBundleLimitExpiredImageNumber - v.MonthlyBundleLimitExpiredImageConsumptionNumber // 当月过期的图片数
|
||||
v.InvalidBundleImageNumber += v.MonthlyInvalidBundleImageNumber
|
||||
v.MonthlyInvalidBundleDataAnalysisNumber = v.MonthlyBundleLimitExpiredDataAnalysisNumber - v.MonthlyBundleLimitExpiredDataAnalysisConsumptionNumber // 当月过期的数据分析数
|
||||
v.InvalidBundleDataAnalysisNumber += v.MonthlyInvalidBundleDataAnalysisNumber
|
||||
|
||||
// 当月可用的限制类型数等于本月方法的套餐和增值两种类型的总和
|
||||
v.MonthlyBundleLimitExpiredVideoNumber = cal(v.BundleLimitVideoExpiredNumber, v.MonthlyLimitVideoQuotaNumber)
|
||||
v.MonthlyIncreaseLimitExpiredVideoNumber = cal(v.IncreaseLimitVideoExpiredNumber, v.MonthlyLimitVideoQuotaNumber)
|
||||
v.MonthlyBundleLimitVideoNumber = v.MonthlyBundleLimitVideoNumber - v.MonthlyBundleLimitVideoConsumptionNumber + cal(v.BundleLimitVideoNumber, v.MonthlyLimitVideoQuotaNumber)
|
||||
v.MonthlyIncreaseLimitVideoNumber = v.MonthlyIncreaseLimitVideoNumber - v.MonthlyIncreaseLimitVideoConsumptionNumber + cal(v.IncreaseLimitVideoNumber, v.MonthlyLimitVideoQuotaNumber)
|
||||
v.MonthlyBundleLimitExpiredImageNumber = cal(v.BundleLimitImageExpiredNumber, v.MonthlyLimitImageQuotaNumber)
|
||||
v.MonthlyIncreaseLimitExpiredImageNumber = cal(v.IncreaseLimitImageExpiredNumber, v.MonthlyLimitImageQuotaNumber)
|
||||
v.MonthlyBundleLimitImageNumber = v.MonthlyBundleLimitImageNumber - v.MonthlyBundleLimitImageConsumptionNumber + cal(v.BundleLimitImageNumber, v.MonthlyLimitImageQuotaNumber)
|
||||
v.MonthlyIncreaseLimitImageNumber = v.MonthlyIncreaseLimitImageNumber - v.MonthlyIncreaseLimitImageConsumptionNumber + cal(v.IncreaseLimitImageNumber, v.MonthlyLimitImageQuotaNumber)
|
||||
v.MonthlyBundleLimitExpiredDataAnalysisNumber = cal(v.BundleLimitDataAnalysisExpiredNumber, v.MonthlyLimitDataAnalysisQuotaNumber)
|
||||
v.MonthlyIncreaseLimitExpiredDataAnalysisNumber = cal(v.IncreaseLimitDataAnalysisExpiredNumber, v.MonthlyLimitDataAnalysisQuotaNumber)
|
||||
v.MonthlyBundleLimitDataAnalysisNumber = v.MonthlyBundleLimitDataAnalysisNumber - v.MonthlyBundleLimitDataAnalysisConsumptionNumber + cal(v.BundleLimitImageNumber, v.MonthlyLimitImageQuotaNumber)
|
||||
v.MonthlyIncreaseLimitDataAnalysisNumber = v.MonthlyIncreaseLimitDataAnalysisNumber - v.MonthlyIncreaseLimitDataAnalysisConsumptionNumber + cal(v.IncreaseLimitImageNumber, v.MonthlyLimitImageQuotaNumber)
|
||||
// 重置单月消耗数量
|
||||
v.MonthlyBundleVideoConsumptionNumber = 0
|
||||
v.MonthlyIncreaseVideoConsumptionNumber = 0
|
||||
v.MonthlyBundleLimitVideoConsumptionNumber = 0
|
||||
v.MonthlyIncreaseLimitVideoConsumptionNumber = 0
|
||||
v.MonthlyBundleLimitExpiredVideoConsumptionNumber = 0
|
||||
v.MonthlyIncreaseLimitExpiredVideoConsumptionNumber = 0
|
||||
v.MonthlyNewManualVideoNumber = 0
|
||||
v.MonthlyManualVideoConsumptionNumber = 0
|
||||
v.MonthlyBundleImageConsumptionNumber = 0
|
||||
v.MonthlyIncreaseImageConsumptionNumber = 0
|
||||
v.MonthlyBundleLimitImageConsumptionNumber = 0
|
||||
v.MonthlyIncreaseLimitImageConsumptionNumber = 0
|
||||
v.MonthlyBundleLimitExpiredImageConsumptionNumber = 0
|
||||
v.MonthlyIncreaseLimitExpiredImageConsumptionNumber = 0
|
||||
v.MonthlyNewManualImageNumber = 0
|
||||
v.MonthlyManualImageConsumptionNumber = 0
|
||||
v.MonthlyBundleDataAnalysisConsumptionNumber = 0
|
||||
v.MonthlyIncreaseDataAnalysisConsumptionNumber = 0
|
||||
v.MonthlyBundleLimitDataAnalysisConsumptionNumber = 0
|
||||
v.MonthlyIncreaseLimitDataAnalysisConsumptionNumber = 0
|
||||
v.MonthlyBundleLimitExpiredDataAnalysisConsumptionNumber = 0
|
||||
v.MonthlyIncreaseLimitExpiredDataAnalysisConsumptionNumber = 0
|
||||
v.MonthlyNewManualDataAnalysisNumber = 0
|
||||
v.MonthlyManualDataAnalysisConsumptionNumber = 0
|
||||
|
||||
// 设置新月份和重置ID
|
||||
v.Month = month
|
||||
v.ID = 0
|
||||
|
||||
// 创建新的任务余额记录
|
||||
if err := app.ModuleClients.TaskBenchDB.Create(&v).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// updateTaskBalanceExpiredAt 更新任务余额表的ExpiredAt字段
|
||||
func updateTaskBalanceExpiredAt(subNum, telNum string, durationNumber int) error {
|
||||
return app.ModuleClients.TaskBenchDB.Transaction(func(tx *gorm.DB) error {
|
||||
var taskBalance model.TaskBalance
|
||||
query := tx.Model(&model.TaskBalance{})
|
||||
|
||||
// 构建查询条件,优先使用 subNum
|
||||
if subNum != "" {
|
||||
query = query.Where("sub_num = ?", subNum)
|
||||
} else {
|
||||
query = query.Where("tel_num = ?", telNum)
|
||||
}
|
||||
|
||||
// 查询当前有效的任务余额记录,按最新的开始时间排序
|
||||
now := time.Now()
|
||||
err := query.Where("start_at <= ? AND expired_at >= ?", now, now).Order("start_at DESC").First(&taskBalance).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// 增加过期时间
|
||||
taskBalance.ExpiredAt = taskBalance.ExpiredAt.Add(time.Hour * 24 * time.Duration(durationNumber))
|
||||
|
||||
return tx.Save(&taskBalance).Error
|
||||
})
|
||||
}
|
||||
|
||||
// copyBundleToTaskBalance 将 BundleBalance 的图片、视频、数据分析相关字段映射到 TaskBalance
|
||||
func copyBundleToTaskBalance(tb *model.TaskBalance, bb *model.BundleBalance) {
|
||||
// ===== 视频类 =====
|
||||
tb.BundleVideoNumber = bb.BundleVideoNumber
|
||||
tb.IncreaseVideoNumber = bb.IncreaseVideoNumber
|
||||
tb.BundleLimitVideoNumber = bb.BundleLimitVideoNumber
|
||||
tb.IncreaseLimitVideoNumber = bb.IncreaseLimitVideoNumber
|
||||
tb.BundleLimitVideoExpiredNumber = bb.BundleLimitVideoExpiredNumber
|
||||
tb.IncreaseLimitVideoExpiredNumber = bb.IncreaseLimitVideoExpiredNumber
|
||||
tb.MonthlyInvalidBundleVideoNumber = bb.MonthlyInvalidBundleVideoNumber
|
||||
tb.InvalidBundleVideoNumber = bb.InvalidBundleVideoNumber
|
||||
tb.MonthlyInvalidIncreaseVideoNumber = bb.MonthlyInvalidIncreaseVideoNumber
|
||||
tb.InvalidIncreaseVideoNumber = bb.InvalidIncreaseVideoNumber
|
||||
tb.BundleVideoConsumptionNumber = bb.BundleVideoConsumptionNumber
|
||||
tb.IncreaseVideoConsumptionNumber = bb.IncreaseVideoConsumptionNumber
|
||||
tb.BundleLimitVideoConsumptionNumber = bb.BundleLimitVideoConsumptionNumber
|
||||
tb.IncreaseLimitVideoConsumptionNumber = bb.IncreaseLimitVideoConsumptionNumber
|
||||
tb.BundleLimitVideoExpiredConsumptionNumber = bb.BundleLimitVideoExpiredConsumptionNumber
|
||||
tb.IncreaseLimitVideoExpiredConsumptionNumber = bb.IncreaseLimitVideoExpiredConsumptionNumber
|
||||
tb.MonthlyBundleVideoConsumptionNumber = bb.MonthlyBundleVideoConsumptionNumber
|
||||
tb.MonthlyIncreaseVideoConsumptionNumber = bb.MonthlyIncreaseVideoConsumptionNumber
|
||||
tb.MonthlyBundleLimitVideoNumber = bb.MonthlyBundleLimitVideoNumber
|
||||
tb.MonthlyIncreaseLimitVideoNumber = bb.MonthlyIncreaseLimitVideoNumber
|
||||
tb.MonthlyBundleLimitVideoConsumptionNumber = bb.MonthlyBundleLimitVideoConsumptionNumber
|
||||
tb.MonthlyIncreaseLimitVideoConsumptionNumber = bb.MonthlyIncreaseLimitVideoConsumptionNumber
|
||||
tb.MonthlyBundleLimitExpiredVideoNumber = bb.MonthlyBundleLimitExpiredVideoNumber
|
||||
tb.MonthlyIncreaseLimitExpiredVideoNumber = bb.MonthlyIncreaseLimitExpiredVideoNumber
|
||||
tb.MonthlyBundleLimitExpiredVideoConsumptionNumber = bb.MonthlyBundleLimitExpiredVideoConsumptionNumber
|
||||
tb.MonthlyIncreaseLimitExpiredVideoConsumptionNumber = bb.MonthlyIncreaseLimitExpiredVideoConsumptionNumber
|
||||
tb.MonthlyLimitVideoQuotaNumber = bb.MonthlyLimitVideoQuotaNumber
|
||||
// 手动扩展(视频)
|
||||
tb.ManualVideoNumber = bb.ManualVideoNumber
|
||||
tb.ManualVideoConsumptionNumber = bb.ManualVideoConsumptionNumber
|
||||
tb.MonthlyNewManualVideoNumber = bb.MonthlyNewManualVideoNumber
|
||||
tb.MonthlyManualVideoConsumptionNumber = bb.MonthlyManualVideoConsumptionNumber
|
||||
|
||||
// ===== 图片类 =====
|
||||
tb.BundleImageNumber = bb.BundleImageNumber
|
||||
tb.IncreaseImageNumber = bb.IncreaseImageNumber
|
||||
tb.BundleLimitImageNumber = bb.BundleLimitImageNumber
|
||||
tb.IncreaseLimitImageNumber = bb.IncreaseLimitImageNumber
|
||||
tb.BundleLimitImageExpiredNumber = bb.BundleLimitImageExpiredNumber
|
||||
tb.IncreaseLimitImageExpiredNumber = bb.IncreaseLimitImageExpiredNumber
|
||||
tb.MonthlyInvalidBundleImageNumber = bb.MonthlyInvalidBundleImageNumber
|
||||
tb.InvalidBundleImageNumber = bb.InvalidBundleImageNumber
|
||||
tb.MonthlyInvalidIncreaseImageNumber = bb.MonthlyInvalidIncreaseImageNumber
|
||||
tb.InvalidIncreaseImageNumber = bb.InvalidIncreaseImageNumber
|
||||
tb.BundleImageConsumptionNumber = bb.BundleImageConsumptionNumber
|
||||
tb.IncreaseImageConsumptionNumber = bb.IncreaseImageConsumptionNumber
|
||||
tb.BundleLimitImageConsumptionNumber = bb.BundleLimitImageConsumptionNumber
|
||||
tb.IncreaseLimitImageConsumptionNumber = bb.IncreaseLimitImageConsumptionNumber
|
||||
tb.BundleLimitImageExpiredConsumptionNumber = bb.BundleLimitImageExpiredConsumptionNumber
|
||||
tb.IncreaseLimitImageExpiredConsumptionNumber = bb.IncreaseLimitImageExpiredConsumptionNumber
|
||||
tb.MonthlyBundleImageConsumptionNumber = bb.MonthlyBundleImageConsumptionNumber
|
||||
tb.MonthlyIncreaseImageConsumptionNumber = bb.MonthlyIncreaseImageConsumptionNumber
|
||||
tb.MonthlyBundleLimitImageNumber = bb.MonthlyBundleLimitImageNumber
|
||||
tb.MonthlyIncreaseLimitImageNumber = bb.MonthlyIncreaseLimitImageNumber
|
||||
tb.MonthlyBundleLimitImageConsumptionNumber = bb.MonthlyBundleLimitImageConsumptionNumber
|
||||
tb.MonthlyIncreaseLimitImageConsumptionNumber = bb.MonthlyIncreaseLimitImageConsumptionNumber
|
||||
tb.MonthlyBundleLimitExpiredImageNumber = bb.MonthlyBundleLimitExpiredImageNumber
|
||||
tb.MonthlyIncreaseLimitExpiredImageNumber = bb.MonthlyIncreaseLimitExpiredImageNumber
|
||||
tb.MonthlyBundleLimitExpiredImageConsumptionNumber = bb.MonthlyBundleLimitExpiredImageConsumptionNumber
|
||||
tb.MonthlyIncreaseLimitExpiredImageConsumptionNumber = bb.MonthlyIncreaseLimitExpiredImageConsumptionNumber
|
||||
tb.MonthlyLimitImageQuotaNumber = bb.MonthlyLimitImageQuotaNumber
|
||||
// 手动扩展(图片)
|
||||
tb.ManualImageNumber = bb.ManualImageNumber
|
||||
tb.ManualImageConsumptionNumber = bb.ManualImageConsumptionNumber
|
||||
tb.MonthlyNewManualImageNumber = bb.MonthlyNewManualImageNumber
|
||||
tb.MonthlyManualImageConsumptionNumber = bb.MonthlyManualImageConsumptionNumber
|
||||
|
||||
// ===== 数据分析类 =====
|
||||
tb.BundleDataAnalysisNumber = bb.BundleDataAnalysisNumber
|
||||
tb.IncreaseDataAnalysisNumber = bb.IncreaseDataAnalysisNumber
|
||||
tb.BundleLimitDataAnalysisNumber = bb.BundleLimitDataAnalysisNumber
|
||||
tb.IncreaseLimitDataAnalysisNumber = bb.IncreaseLimitDataAnalysisNumber
|
||||
tb.BundleLimitDataAnalysisExpiredNumber = bb.BundleLimitDataAnalysisExpiredNumber
|
||||
tb.IncreaseLimitDataAnalysisExpiredNumber = bb.IncreaseLimitDataAnalysisExpiredNumber
|
||||
tb.MonthlyInvalidBundleDataAnalysisNumber = bb.MonthlyInvalidBundleDataAnalysisNumber
|
||||
tb.InvalidBundleDataAnalysisNumber = bb.InvalidBundleDataAnalysisNumber
|
||||
tb.MonthlyInvalidIncreaseDataAnalysisNumber = bb.MonthlyInvalidIncreaseDataAnalysisNumber
|
||||
tb.InvalidIncreaseDataAnalysisNumber = bb.InvalidIncreaseDataAnalysisNumber
|
||||
tb.BundleDataAnalysisConsumptionNumber = bb.BundleDataAnalysisConsumptionNumber
|
||||
tb.IncreaseDataAnalysisConsumptionNumber = bb.IncreaseDataAnalysisConsumptionNumber
|
||||
tb.BundleLimitDataAnalysisConsumptionNumber = bb.BundleLimitDataAnalysisConsumptionNumber
|
||||
tb.IncreaseLimitDataAnalysisConsumptionNumber = bb.IncreaseLimitDataAnalysisConsumptionNumber
|
||||
tb.BundleLimitDataAnalysisExpiredConsumptionNumber = bb.BundleLimitDataAnalysisExpiredConsumptionNumber
|
||||
tb.IncreaseLimitDataAnalysisExpiredConsumptionNumber = bb.IncreaseLimitDataAnalysisExpiredConsumptionNumber
|
||||
tb.MonthlyBundleDataAnalysisConsumptionNumber = bb.MonthlyBundleDataAnalysisConsumptionNumber
|
||||
tb.MonthlyIncreaseDataAnalysisConsumptionNumber = bb.MonthlyIncreaseDataAnalysisConsumptionNumber
|
||||
tb.MonthlyBundleLimitDataAnalysisNumber = bb.MonthlyBundleLimitDataAnalysisNumber
|
||||
tb.MonthlyIncreaseLimitDataAnalysisNumber = bb.MonthlyIncreaseLimitDataAnalysisNumber
|
||||
tb.MonthlyBundleLimitDataAnalysisConsumptionNumber = bb.MonthlyBundleLimitDataAnalysisConsumptionNumber
|
||||
tb.MonthlyIncreaseLimitDataAnalysisConsumptionNumber = bb.MonthlyIncreaseLimitDataAnalysisConsumptionNumber
|
||||
tb.MonthlyBundleLimitExpiredDataAnalysisNumber = bb.MonthlyBundleLimitExpiredDataAnalysisNumber
|
||||
tb.MonthlyIncreaseLimitExpiredDataAnalysisNumber = bb.MonthlyIncreaseLimitExpiredDataAnalysisNumber
|
||||
tb.MonthlyBundleLimitExpiredDataAnalysisConsumptionNumber = bb.MonthlyBundleLimitExpiredDataAnalysisConsumptionNumber
|
||||
tb.MonthlyIncreaseLimitExpiredDataAnalysisConsumptionNumber = bb.MonthlyIncreaseLimitExpiredDataAnalysisConsumptionNumber
|
||||
tb.MonthlyLimitDataAnalysisQuotaNumber = bb.MonthlyLimitDataAnalysisQuotaNumber
|
||||
// 手动扩展(数据分析)
|
||||
tb.ManualDataAnalysisNumber = bb.ManualDataAnalysisNumber
|
||||
tb.ManualDataAnalysisConsumptionNumber = bb.ManualDataAnalysisConsumptionNumber
|
||||
tb.MonthlyNewManualDataAnalysisNumber = bb.MonthlyNewManualDataAnalysisNumber
|
||||
tb.MonthlyManualDataAnalysisConsumptionNumber = bb.MonthlyManualDataAnalysisConsumptionNumber
|
||||
|
||||
// 其他字段
|
||||
tb.MonthlyNewDurationNumber = bb.MonthlyNewDurationNumber
|
||||
tb.ExpansionPacksNumber = bb.ExpansionPacksNumber
|
||||
}
|
||||
|
||||
func ExtendTaskBalanceByUserId(userId int, imageNumber int, dataAnalysisNumber int, videoNumber int, durationNumber int) error {
|
||||
// 根据用户ID获取其最新套餐记录,进而获取 sub_num、tel_num
|
||||
oldBundle := model.BundleBalance{}
|
||||
if err := app.ModuleClients.BundleDB.Model(&model.BundleBalance{}).
|
||||
Where("user_id = ?", userId).
|
||||
Order("created_at desc").
|
||||
First(&oldBundle).Error; err != nil {
|
||||
return errors.New("用户还没有套餐信息")
|
||||
}
|
||||
|
||||
subNum, telNum, err := fetchIdentityForBundle(&oldBundle)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// 事务更新当前有效的任务余额记录(按 start_at 最近的一条)
|
||||
err = app.ModuleClients.TaskBenchDB.Transaction(func(tx *gorm.DB) error {
|
||||
var tb model.TaskBalance
|
||||
now := time.Now()
|
||||
query := tx.Model(&model.TaskBalance{}).
|
||||
Where("sub_num = ? AND tel_num = ? AND start_at <= ? AND expired_at >= ?", subNum, telNum, now, now).
|
||||
Order("start_at DESC")
|
||||
|
||||
if err := query.First(&tb).Error; err != nil {
|
||||
if err == gorm.ErrRecordNotFound {
|
||||
return errors.New("用户还没有任务余额信息")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// 手动扩展额度与当月新增记录
|
||||
tb.ManualImageNumber += imageNumber
|
||||
tb.MonthlyNewManualImageNumber += imageNumber
|
||||
|
||||
tb.ManualDataAnalysisNumber += dataAnalysisNumber
|
||||
tb.MonthlyNewManualDataAnalysisNumber += dataAnalysisNumber
|
||||
|
||||
tb.ManualVideoNumber += videoNumber
|
||||
tb.MonthlyNewManualVideoNumber += videoNumber
|
||||
|
||||
tb.MonthlyNewDurationNumber += durationNumber
|
||||
|
||||
return tx.Model(&model.TaskBalance{}).Where("id = ?", tb.ID).Save(&tb).Error
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// 增加过期时间(按天)
|
||||
if durationNumber > 0 {
|
||||
if err := updateTaskBalanceExpiredAt(subNum, telNum, durationNumber); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,231 +0,0 @@
|
||||
package dto
|
||||
|
||||
import "time"
|
||||
|
||||
// TaskQueryRequest 查询待指派任务记录请求参数
|
||||
type TaskQueryRequest struct {
|
||||
Keyword string `json:"keyword"` // 艺人姓名、编号、手机号搜索关键词
|
||||
LastTaskAssignee string `json:"lastTaskAssignee"` // 最近一次指派人筛选(模糊匹配)
|
||||
Page int `json:"page"` // 页码
|
||||
PageSize int `json:"pageSize"` // 每页数量
|
||||
SortBy string `json:"sortBy"` // 排序字段(支持白名单字段)
|
||||
SortType string `json:"sortType"` // 排序类型 asc/desc
|
||||
SubNums []string `json:"subNums"` // 选中导出的艺人编号集合(可选)
|
||||
}
|
||||
|
||||
// TaskAssignRequest 指派任务请求参数
|
||||
type TaskAssignRequest struct {
|
||||
SubNum string `json:"subNum"` // 艺人编号
|
||||
TelNum string `json:"telNum"` // 艺人手机号
|
||||
ArtistName string `json:"artistName"` // 艺人姓名
|
||||
TaskAssignee string `json:"taskAssignee"` // 任务指派人
|
||||
TaskAssigneeNum string `json:"taskAssigneeNum"` // 任务指派人账号
|
||||
Operator string `json:"operator"` // 操作人
|
||||
OperatorNum string `json:"operatorNum"` // 操作人账号
|
||||
AssignVideoCount int `json:"assignVideoCount"` // 指派视频数
|
||||
AssignPostCount int `json:"assignPostCount"` // 指派图文数
|
||||
AssignDataCount int `json:"assignDataCount"` // 指派数据数
|
||||
AssignVideoScriptCount int `json:"assignVideoScriptCount"` // 指派视频脚本数
|
||||
TaskBatch string `json:"taskBatch"` // 任务批次
|
||||
}
|
||||
|
||||
// BatchAssignItem 批量指派项(仅写入指派记录,不更新任务管理表)
|
||||
type BatchAssignItem struct {
|
||||
SubNum string `json:"subNum"` // 艺人编号
|
||||
TelNum string `json:"telNum"` // 艺人手机号
|
||||
ArtistName string `json:"artistName"` // 艺人姓名
|
||||
TaskAssignee string `json:"taskAssignee"` // 任务指派人
|
||||
TaskAssigneeNum string `json:"taskAssigneeNum"` // 任务指派人账号
|
||||
Operator string `json:"operator"` // 操作人
|
||||
OperatorNum string `json:"operatorNum"` // 操作人账号
|
||||
AssignVideoCount int `json:"assignVideoCount"` // 指派视频数
|
||||
AssignPostCount int `json:"assignPostCount"` // 指派图文数
|
||||
AssignDataCount int `json:"assignDataCount"` // 指派数据数
|
||||
AssignVideoScriptCount int `json:"assignVideoScriptCount"` // 指派视频脚本数
|
||||
TaskBatch string `json:"taskBatch"` // 任务批次
|
||||
}
|
||||
|
||||
// EmployeeTaskQueryRequest 员工任务查询请求参数
|
||||
type EmployeeTaskQueryRequest struct {
|
||||
TaskAssigneeNum string `json:"taskAssigneeNum"` // 被指派人账号
|
||||
Keyword string `json:"keyword"` // 艺人姓名、编号、手机号搜索关键词
|
||||
Operator string `json:"operator"` // 操作人
|
||||
SortBy string `json:"sortBy"` // 排序字段
|
||||
StartTime string `json:"startTime"` // 指派开始时间
|
||||
EndTime string `json:"endTime"` // 指派结束时间
|
||||
StartCompleteTime string `json:"startCompleteTime"` // 开始完成时间
|
||||
EndCompleteTime string `json:"endCompleteTime"` // 结束完成时间
|
||||
Status int `json:"status"` // 反馈完成状态
|
||||
TaskBatch string `json:"taskBatch"` // 任务批次
|
||||
|
||||
Page int `json:"page"` // 页码
|
||||
PageSize int `json:"pageSize"` // 每页数量
|
||||
}
|
||||
|
||||
// CompleteTaskRequest 完成任务请求参数
|
||||
type CompleteTaskRequest struct {
|
||||
AssignRecordsUUID string `json:"assignRecordsUUID,omitempty"` // 指派记录UUID(可选)
|
||||
EmployeeName string `json:"employeeName"` // 员工姓名(必要)
|
||||
EmployeeNum string `json:"employeeNum"` // 员工工号(必要)
|
||||
TaskType string `json:"taskType"` // 任务类型: video/post/data/script
|
||||
UUID string `json:"uuid"` // 任务UUID
|
||||
CompleteCount int `json:"completeCount"` // 完成数量
|
||||
}
|
||||
|
||||
// TaskAssignRecordsQueryRequest 多条件查询操作记录表请求参数
|
||||
type TaskAssignRecordsQueryRequest struct {
|
||||
Keyword string `json:"keyword"` // 艺人姓名、编号、手机号搜索关键词
|
||||
TaskAssignee string `json:"taskAssignee"` // 指派人姓名
|
||||
Operator string `json:"operator"` // 操作人姓名
|
||||
OperatorNum string `json:"operatorNum"` // 操作人手机号
|
||||
StartTime string `json:"startTime"` // 操作开始时间
|
||||
EndTime string `json:"endTime"` // 操作结束时间
|
||||
Status int `json:"status"` // 反馈完成状态 0:全部 1:未完成 2:完成
|
||||
ActualStatus int `json:"actualStatus"` // 实际完成状态 0:全部 1:未完成 2:完成
|
||||
TaskBatch string `json:"taskBatch"` // 任务批次
|
||||
Page int `json:"page"` // 页码
|
||||
PageSize int `json:"pageSize"` // 每页数量
|
||||
SortBy string `json:"sortBy"` // 排序字段(白名单)
|
||||
SortType string `json:"sortType"` // 排序方式
|
||||
}
|
||||
|
||||
// 任务记录表返回结构体
|
||||
type TaskAssignRecordsResponse struct {
|
||||
AssignRecordsUUID string `gorm:"column:assign_records_uuid;comment:指派记录UUID" json:"assignRecordsUUID"`
|
||||
SubNum string `gorm:"column:sub_num;comment:艺人编号" json:"subNum"`
|
||||
TelNum string `gorm:"column:tel_num;comment:艺人手机号" json:"telNum"`
|
||||
ArtistName string `gorm:"column:artist_name;comment:艺人名称" json:"artistName"`
|
||||
Status int `gorm:"column:status;comment:反馈完成状态 1:未完成 2:完成" json:"status"`
|
||||
ActualStatus int `gorm:"column:actual_status;comment:实际完成状态 1:未完成 2:完成" json:"actualStatus"`
|
||||
CompleteTime *time.Time `gorm:"column:complete_time;comment:反馈完成时间" json:"completeTime"`
|
||||
OperatorType int `gorm:"column:operator_type;comment:操作类型 1:修改待发数量 2:指派" json:"operatorType"`
|
||||
Operator string `gorm:"column:operator;comment:操作人" json:"operator"`
|
||||
OperatorNum string `gorm:"column:operator_num;comment:操作人账号" json:"operatorNum"`
|
||||
OperatorTime time.Time `gorm:"column:operator_time;comment:操作时间" json:"operatorTime"`
|
||||
TaskAssignee string `gorm:"column:task_assignee;comment:任务指派人" json:"taskAssignee"`
|
||||
TaskAssigneeNum string `gorm:"column:task_assignee_num;comment:任务指派人账号" json:"taskAssigneeNum"`
|
||||
TaskBatch string `gorm:"column:task_batch;comment:任务批次" json:"taskBatch"`
|
||||
PendingVideoCount int `gorm:"column:pending_video_count;comment:待发视频数量" json:"pendingVideoCount"`
|
||||
PendingPostCount int `gorm:"column:pending_post_count;comment:待发图文数量" json:"pendingPostCount"`
|
||||
PendingDataCount int `gorm:"column:pending_data_count;comment:待发数据数量" json:"pendingDataCount"`
|
||||
PendingVideoScriptCount int `gorm:"column:pending_video_script_count;comment:待发视频脚本数量" json:"pendingVideoScriptCount"`
|
||||
// 已完成统计
|
||||
CompleteVideoScriptCount int `gorm:"column:complete_video_script_count;comment:已完成视频脚本数" json:"completeVideoScriptCount"`
|
||||
CompleteVideoCount int `gorm:"column:complete_video_count;comment:已完成视频数" json:"completeVideoCount"`
|
||||
CompletePostCount int `gorm:"column:complete_post_count;comment:已完成图文数" json:"completePostCount"`
|
||||
CompleteDataCount int `gorm:"column:complete_data_count;comment:已完成数据数" json:"completeDataCount"`
|
||||
UpdatedAt time.Time `gorm:"column:updated_at;comment:更新时间" json:"updatedAt"`
|
||||
}
|
||||
|
||||
// 多条件查询后分页前的艺人数量汇总
|
||||
type TaskAssignRecordsSummary struct {
|
||||
TotalPendingVideoScriptCount int `json:"totalPendingVideoScriptCount"`
|
||||
TotalPendingVideoCount int `json:"totalPendingVideoCount"`
|
||||
TotalPendingPostCount int `json:"totalPendingPostCount"`
|
||||
TotalPendingDataCount int `json:"totalPendingDataCount"`
|
||||
TotalCompleteVideoScriptCount int `json:"totalCompleteVideoScriptCount"`
|
||||
TotalCompleteVideoCount int `json:"totalCompleteVideoCount"`
|
||||
TotalCompletePostCount int `json:"totalCompletePostCount"`
|
||||
TotalCompleteDataCount int `json:"totalCompleteDataCount"`
|
||||
}
|
||||
|
||||
// ValidArtistInfo 有效艺人信息结构体
|
||||
type ValidArtistInfo struct {
|
||||
UserID int `json:"userId"` // 用户ID
|
||||
CustomerNum string `json:"customerNum"` // 艺人编号
|
||||
UserName string `json:"userName"` // 艺人姓名
|
||||
UserPhoneNumber string `json:"userPhoneNumber"` // 艺人手机号
|
||||
BundleName string `json:"bundleName"` // 套餐名称
|
||||
ExpirationTime string `json:"expirationTime"` // 过期时间
|
||||
Status int `json:"status"` // 套餐状态
|
||||
OrderUUID string `json:"orderUUID"` // 订单UUID
|
||||
AccountNumber int `json:"accountNumber"` // 账号数量
|
||||
AccountConsumptionNumber int `json:"accountConsumptionNumber"` // 账号消耗数量
|
||||
VideoNumber int `json:"videoNumber"` // 视频数量
|
||||
VideoConsumptionNumber int `json:"videoConsumptionNumber"` // 视频消耗数量
|
||||
ImageNumber int `json:"imageNumber"` // 图片数量
|
||||
ImageConsumptionNumber int `json:"imageConsumptionNumber"` // 图片消耗数量
|
||||
DataAnalysisNumber int `json:"dataAnalysisNumber"` // 数据分析数量
|
||||
DataAnalysisConsumptionNumber int `json:"dataAnalysisConsumptionNumber"` // 数据分析消耗数量
|
||||
ExpansionPacksNumber int `json:"expansionPacksNumber"` // 扩展套餐数量
|
||||
}
|
||||
|
||||
// ArtistUploadStatsItem 艺人上传与额度统计(视频/图文/数据分析)
|
||||
type ArtistUploadStatsItem struct {
|
||||
// 身份信息
|
||||
SubNum string `json:"subNum" gorm:"column:customer_num"`
|
||||
UserName string `json:"userName" gorm:"column:user_name"`
|
||||
UserPhoneNumber string `json:"userPhoneNumber" gorm:"column:user_phone_number"`
|
||||
StartAt string `json:"startAt" gorm:"column:start_at"`
|
||||
ExpiredAt string `json:"expiredAt" gorm:"column:expired_at"`
|
||||
|
||||
// 视频
|
||||
UploadedVideoCount int `json:"uploadedVideoCount" gorm:"column:uploaded_video_count"`
|
||||
BundleVideoTotal int `json:"bundleVideoTotal" gorm:"column:bundle_video_total"`
|
||||
IncreaseVideoTotal int `json:"increaseVideoTotal" gorm:"column:increase_video_total"`
|
||||
ReleasedVideoTotal int `json:"releasedVideoTotal" gorm:"column:released_video_total"`
|
||||
PendingVideoCount int `json:"pendingVideoCount" gorm:"column:pending_video_count"`
|
||||
|
||||
// 图文
|
||||
UploadedPostCount int `json:"uploadedPostCount" gorm:"column:uploaded_post_count"`
|
||||
BundlePostTotal int `json:"bundlePostTotal" gorm:"column:bundle_post_total"`
|
||||
IncreasePostTotal int `json:"increasePostTotal" gorm:"column:increase_post_total"`
|
||||
ReleasedPostTotal int `json:"releasedPostTotal" gorm:"column:released_post_total"`
|
||||
PendingPostCount int `json:"pendingPostCount" gorm:"column:pending_post_count"`
|
||||
|
||||
// 数据分析
|
||||
UploadedDataAnalysisCount int `json:"uploadedDataAnalysisCount" gorm:"column:uploaded_data_count"`
|
||||
BundleDataAnalysisTotal int `json:"bundleDataAnalysisTotal" gorm:"column:bundle_data_total"`
|
||||
IncreaseDataAnalysisTotal int `json:"increaseDataAnalysisTotal" gorm:"column:increase_data_total"`
|
||||
ReleasedDataAnalysisTotal int `json:"releasedDataAnalysisTotal" gorm:"column:released_data_total"`
|
||||
PendingDataAnalysisCount int `json:"pendingDataAnalysisCount" gorm:"column:pending_data_count"`
|
||||
|
||||
// 任务管理
|
||||
LastTaskAssignee string `json:"lastTaskAssignee" gorm:"column:last_task_assignee"`
|
||||
TaskAssigneeNum string `json:"taskAssigneeNum" gorm:"column:task_assignee_num"`
|
||||
ProgressTaskCount int `json:"progressTaskCount" gorm:"column:progress_task_count"`
|
||||
CompleteTaskCount int `json:"completeTaskCount" gorm:"column:complete_task_count"`
|
||||
|
||||
// 脚本
|
||||
UploadedVideoScriptCount int `json:"uploadedVideoScriptCount" gorm:"column:uploaded_video_script_count"`
|
||||
PendingVideoScriptCount int `json:"pendingVideoScriptCount" gorm:"column:pending_video_script_count"`
|
||||
|
||||
// 可指派数(可上传数 - 已指派且未完成的数量)
|
||||
AllowVideoScriptCount int `json:"allowVideoScriptCount" gorm:"column:allow_video_script_count"`
|
||||
AllowVideoCount int `json:"allowVideoCount" gorm:"column:allow_video_count"`
|
||||
AllowPostCount int `json:"allowPostCount" gorm:"column:allow_post_count"`
|
||||
AllowDataCount int `json:"allowDataCount" gorm:"column:allow_data_count"`
|
||||
}
|
||||
|
||||
// ArtistPendingAssignItem 艺人可指派数量(可上传数 - 已指派且未完成的数量)
|
||||
type ArtistPendingAssignItem struct {
|
||||
SubNum string `json:"subNum" gorm:"column:customer_num"`
|
||||
TelNum string `json:"telNum" gorm:"column:tel_num"`
|
||||
UserName string `json:"userName" gorm:"column:user_name"`
|
||||
AllowVideoScriptCount int `json:"allowVideoScriptCount" gorm:"column:allow_video_script_count"`
|
||||
AllowVideoCount int `json:"allowVideoCount" gorm:"column:allow_video_count"`
|
||||
AllowPostCount int `json:"allowPostCount" gorm:"column:allow_post_count"`
|
||||
AllowDataCount int `json:"allowDataCount" gorm:"column:allow_data_count"`
|
||||
}
|
||||
|
||||
// CreateTaskWorkLogRequest 创建任务日志请求参数
|
||||
type CreateTaskWorkLogRequest struct {
|
||||
AssignRecordsUUID string `json:"assignRecordsUUID"` // 任务指派记录UUID(必填)
|
||||
WorkUUID string `json:"workUUID"` // 任务作品UUID(必填)
|
||||
Title string `json:"title"` // 任务作品标题
|
||||
|
||||
ArtistUUID string `json:"artistUUID"` // 任务艺人UUID
|
||||
SubNum string `json:"subNum"` // 任务用户编号(必填)
|
||||
TelNum string `json:"telNum"` // 任务用户手机号(必填)
|
||||
ArtistName string `json:"artistName"` // 任务艺人名称
|
||||
|
||||
// 操作信息
|
||||
OperationType int `json:"operationType"` // 任务操作类型 1:加任务 2:消耗任务 3:完成任务 4:任务过期(必填)
|
||||
TaskType int `json:"taskType"` // 任务类型 1:视频 2:图片 3:数据分析(必填)
|
||||
TaskCount int `json:"taskCount"` // 任务数量(必填)
|
||||
Remark string `json:"remark"` // 任务备注
|
||||
|
||||
// 操作人信息
|
||||
OperatorName string `json:"operatorName"` // 任务操作人姓名
|
||||
OperatorNum string `json:"operatorNum"` // 任务操作人账号
|
||||
}
|
||||
@ -11,12 +11,9 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"micro-bundle/pkg/msg"
|
||||
|
||||
"dubbo.apache.org/dubbo-go/v3/common/logger"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/samber/lo"
|
||||
"github.com/shopspring/decimal"
|
||||
)
|
||||
|
||||
func BundleExtend(req *bundle.BundleExtendRequest) (*bundle.BundleExtendResponse, error) {
|
||||
@ -42,7 +39,6 @@ func BundleExtend(req *bundle.BundleExtendRequest) (*bundle.BundleExtendResponse
|
||||
ImageNumber: int(req.ImagesAdditional),
|
||||
DataAnalysisNumber: int(req.DataAdditional),
|
||||
AccountNumber: int(req.AccountAdditional),
|
||||
CompetitiveNumber: int(req.CompetitiveAdditional),
|
||||
DurationNumber: durationNumber,
|
||||
}); err != nil {
|
||||
return nil, errors.New("用户没有余量信息")
|
||||
@ -148,21 +144,6 @@ func GetBundleBalanceList(req *bundle.GetBundleBalanceListReq) (*bundle.GetBundl
|
||||
MonthlyIncreaseDataAnalysisNumber: int32(m.IncreaseDataAnalysisNumber) - int32(m.IncreaseDataAnalysisConsumptionNumber) + int32(m.MonthlyIncreaseLimitDataAnalysisNumber) + int32(m.MonthlyIncreaseLimitExpiredDataAnalysisNumber),
|
||||
MonthlyInvalidBundleDataAnalysisNumber: int32(m.MonthlyInvalidBundleDataAnalysisNumber),
|
||||
MonthlyInvalidIncreaseDataAnalysisNumber: int32(m.MonthlyInvalidIncreaseDataAnalysisNumber),
|
||||
//竞品数
|
||||
BundleCompetitiveNumber: int32(m.BundleCompetitiveNumber) + int32(m.BundleLimitCompetitiveNumber) + int32(m.BundleLimitCompetitiveExpiredNumber),
|
||||
IncreaseCompetitiveNumber: int32(m.IncreaseCompetitiveNumber) + int32(m.IncreaseLimitCompetitiveNumber) + int32(m.IncreaseLimitCompetitiveExpiredNumber),
|
||||
BundleCompetitiveConsumptionNumber: int32(m.BundleCompetitiveConsumptionNumber) + int32(m.BundleLimitCompetitiveConsumptionNumber) + int32(m.BundleLimitCompetitiveExpiredConsumptionNumber),
|
||||
IncreaseCompetitiveConsumptionNumber: int32(m.IncreaseCompetitiveConsumptionNumber) + int32(m.IncreaseLimitCompetitiveConsumptionNumber) + int32(m.IncreaseLimitCompetitiveExpiredConsumptionNumber),
|
||||
InvalidBundleCompetitiveNumber: int32(m.InvalidBundleCompetitiveNumber),
|
||||
InvalidIncreaseCompetitiveNumber: int32(m.InvalidIncreaseCompetitiveNumber),
|
||||
MonthlyNewBundleCompetitiveNumber: int32(cal(m.BundleBalance, m.BundleLimitCompetitiveNumber, m.MonthlyLimitCompetitiveQuotaNumber, date) + cal(m.BundleBalance, m.BundleLimitCompetitiveExpiredNumber, m.MonthlyLimitCompetitiveQuotaNumber, date)),
|
||||
MonthlyNewIncreaseCompetitiveNumber: int32(cal(m.BundleBalance, m.IncreaseLimitCompetitiveNumber, m.MonthlyLimitCompetitiveQuotaNumber, date) + cal(m.BundleBalance, m.IncreaseLimitCompetitiveExpiredNumber, m.MonthlyLimitCompetitiveQuotaNumber, date)),
|
||||
MonthBundleCompetitiveConsumptionNumber: int32(m.MonthlyBundleCompetitiveConsumptionNumber) + int32(m.MonthlyBundleLimitCompetitiveConsumptionNumber) + int32(m.MonthlyBundleLimitExpiredCompetitiveConsumptionNumber),
|
||||
MonthIncreaseCompetitiveConsumptionNumber: int32(m.MonthlyIncreaseCompetitiveConsumptionNumber) + int32(m.MonthlyIncreaseLimitCompetitiveConsumptionNumber) + int32(m.MonthlyIncreaseLimitExpiredCompetitiveConsumptionNumber),
|
||||
MonthlyBundleCompetitiveNumber: int32(m.BundleCompetitiveNumber) - int32(m.BundleCompetitiveConsumptionNumber) + int32(m.MonthlyBundleLimitCompetitiveNumber) + int32(m.MonthlyBundleLimitExpiredCompetitiveNumber) - int32(m.MonthlyBundleLimitCompetitiveConsumptionNumber),
|
||||
MonthlyIncreaseCompetitiveNumber: int32(m.IncreaseCompetitiveNumber) - int32(m.IncreaseCompetitiveConsumptionNumber) + int32(m.MonthlyIncreaseLimitCompetitiveNumber) + int32(m.MonthlyIncreaseLimitExpiredCompetitiveNumber),
|
||||
MonthlyInvalidBundleCompetitiveNumber: int32(m.MonthlyInvalidBundleCompetitiveNumber),
|
||||
MonthlyInvalidIncreaseCompetitiveNumber: int32(m.MonthlyInvalidIncreaseCompetitiveNumber),
|
||||
// 手动扩展类
|
||||
MonthlyNewManualAccountNumber: int32(m.MonthlyNewAccountNumber),
|
||||
MonthlyNewManualVideoNumber: int32(m.MonthlyNewManualVideoNumber),
|
||||
@ -190,8 +171,6 @@ func GetBundleBalanceList(req *bundle.GetBundleBalanceListReq) (*bundle.GetBundl
|
||||
result.MonthlyNewIncreaseImageNumber += int32(m.IncreaseImageNumber)
|
||||
result.MonthlyNewBundleDataAnalysisNumber += int32(m.BundleDataAnalysisNumber)
|
||||
result.MonthlyNewIncreaseDataAnalysisNumber += int32(m.IncreaseDataAnalysisNumber)
|
||||
result.MonthlyNewBundleCompetitiveNumber += int32(m.BundleCompetitiveNumber)
|
||||
result.MonthlyNewIncreaseCompetitiveNumber += int32(m.IncreaseCompetitiveNumber)
|
||||
}
|
||||
if result.Activate != 2 { // 除了等于0的情况
|
||||
result.Activate = 1
|
||||
@ -215,44 +194,25 @@ func GetBundleBalanceByUserId(req *bundle.GetBundleBalanceByUserIdReq) (*bundle.
|
||||
if data.Activate != 2 {
|
||||
return nil, errors.New("套餐未激活")
|
||||
}
|
||||
var IsExpired int32
|
||||
if data.ExpiredAt.Before(time.Now()) {
|
||||
IsExpired = msg.IsExpired //已过期
|
||||
} else {
|
||||
IsExpired = msg.NotExpired //未过期
|
||||
}
|
||||
result := &bundle.GetBundleBalanceByUserIdResp{
|
||||
OrderUUID: data.OrderUUID,
|
||||
BundleName: data.BundleName,
|
||||
BundleStatus: IsExpired,
|
||||
PayTime: data.StartAt.UnixMilli(),
|
||||
ExpiredTime: data.ExpiredAt.UnixMilli(),
|
||||
PaymentAmount: data.PaymentAmount,
|
||||
PaymentType: data.PaymentType,
|
||||
AccountNumber: int32(data.BundleAccountNumber) + int32(data.IncreaseAccountNumber) + int32(data.ManualAccountNumber),
|
||||
AccountExtendNumber: int32(data.BundleAccountNumber) + int32(data.IncreaseAccountNumber) + int32(data.ManualAccountNumber),
|
||||
AccountAdditional: int32(data.ManualAccountNumber),
|
||||
AccountConsumptionNumber: int32(data.BundleAccountConsumptionNumber) + int32(data.IncreaseAccountConsumptionNumber) + int32(data.ManualAccountConsumptionNumber),
|
||||
VideoNumber: int32(data.BundleVideoNumber) + int32(data.BundleLimitVideoNumber) + int32(data.BundleLimitVideoExpiredNumber) + int32(data.IncreaseVideoNumber) + int32(data.IncreaseLimitVideoNumber) + int32(data.IncreaseLimitVideoExpiredNumber) + int32(data.ManualVideoNumber),
|
||||
VideoExtendNumber: int32(data.MonthlyBundleLimitVideoNumber) + int32(data.MonthlyIncreaseLimitVideoNumber) + int32(data.MonthlyBundleLimitExpiredVideoNumber) + int32(data.MonthlyIncreaseLimitExpiredVideoNumber) + int32(data.ManualVideoNumber) + int32(data.IncreaseVideoNumber) + int32(data.BundleVideoNumber),
|
||||
VideoExtendConsumptionNumber: int32(data.MonthlyBundleLimitVideoConsumptionNumber) + int32(data.MonthlyIncreaseLimitVideoConsumptionNumber) + int32(data.MonthlyBundleLimitExpiredVideoConsumptionNumber) + int32(data.MonthlyIncreaseLimitExpiredVideoConsumptionNumber) + int32(data.ManualVideoConsumptionNumber) + int32(data.IncreaseVideoConsumptionNumber) + int32(data.BundleVideoConsumptionNumber),
|
||||
VideoAdditional: int32(data.ManualVideoNumber),
|
||||
VideoConsumptionNumber: int32(data.BundleVideoConsumptionNumber) + int32(data.BundleLimitVideoConsumptionNumber) + int32(data.BundleLimitVideoExpiredConsumptionNumber) + int32(data.IncreaseVideoConsumptionNumber) + int32(data.IncreaseLimitVideoConsumptionNumber) + int32(data.IncreaseLimitVideoExpiredConsumptionNumber) + int32(data.ManualVideoConsumptionNumber),
|
||||
ImageNumber: int32(data.BundleImageNumber) + int32(data.BundleLimitImageNumber) + int32(data.BundleLimitImageExpiredNumber) + int32(data.IncreaseImageNumber) + int32(data.IncreaseLimitImageNumber) + int32(data.IncreaseLimitImageExpiredNumber) + int32(data.ManualImageNumber),
|
||||
ImageExtendNumber: int32(data.MonthlyBundleLimitImageNumber) + int32(data.MonthlyIncreaseLimitImageNumber) + int32(data.MonthlyBundleLimitExpiredImageNumber) + int32(data.MonthlyIncreaseLimitExpiredImageNumber) + int32(data.ManualImageNumber) + int32(data.IncreaseImageNumber) + int32(data.BundleImageNumber),
|
||||
ImageExtendConsumptionNumber: int32(data.MonthlyBundleLimitImageConsumptionNumber) + int32(data.MonthlyIncreaseLimitImageConsumptionNumber) + int32(data.MonthlyBundleLimitExpiredImageConsumptionNumber) + int32(data.MonthlyIncreaseLimitExpiredImageConsumptionNumber) + int32(data.ManualImageConsumptionNumber) + int32(data.IncreaseImageConsumptionNumber) + int32(data.BundleImageConsumptionNumber),
|
||||
ImageAdditional: int32(data.ManualImageNumber),
|
||||
ImageConsumptionNumber: int32(data.BundleImageConsumptionNumber) + int32(data.BundleLimitImageConsumptionNumber) + int32(data.BundleLimitImageExpiredConsumptionNumber) + int32(data.IncreaseImageConsumptionNumber) + int32(data.IncreaseLimitImageConsumptionNumber) + int32(data.IncreaseLimitImageExpiredConsumptionNumber) + int32(data.ManualImageConsumptionNumber),
|
||||
DataAnalysisNumber: int32(data.BundleDataAnalysisNumber) + int32(data.BundleLimitDataAnalysisNumber) + int32(data.BundleLimitDataAnalysisExpiredNumber) + int32(data.IncreaseDataAnalysisNumber) + int32(data.IncreaseLimitDataAnalysisNumber) + int32(data.IncreaseLimitDataAnalysisExpiredNumber) + int32(data.ManualDataAnalysisNumber),
|
||||
DataAnalysisExtendNumber: int32(data.MonthlyBundleLimitDataAnalysisNumber) + int32(data.MonthlyIncreaseLimitDataAnalysisNumber) + int32(data.MonthlyBundleLimitExpiredDataAnalysisNumber) + int32(data.MonthlyIncreaseLimitExpiredDataAnalysisNumber) + int32(data.ManualDataAnalysisNumber) + int32(data.IncreaseDataAnalysisNumber) + int32(data.BundleDataAnalysisNumber),
|
||||
DataAnalysisExtendConsumptionNumber: int32(data.MonthlyBundleLimitDataAnalysisConsumptionNumber) + int32(data.MonthlyIncreaseLimitDataAnalysisConsumptionNumber) + int32(data.MonthlyBundleLimitExpiredDataAnalysisConsumptionNumber) + int32(data.MonthlyIncreaseLimitExpiredDataAnalysisConsumptionNumber) + int32(data.ManualDataAnalysisConsumptionNumber) + int32(data.IncreaseDataAnalysisConsumptionNumber) + int32(data.BundleDataAnalysisConsumptionNumber),
|
||||
DataAnalysisAdditional: int32(data.ManualDataAnalysisNumber),
|
||||
DataAnalysisConsumptionNumber: int32(data.BundleDataAnalysisConsumptionNumber) + int32(data.BundleLimitDataAnalysisConsumptionNumber) + int32(data.BundleLimitDataAnalysisExpiredConsumptionNumber) + int32(data.IncreaseDataAnalysisConsumptionNumber) + int32(data.IncreaseLimitDataAnalysisConsumptionNumber) + int32(data.IncreaseLimitDataAnalysisExpiredConsumptionNumber) + int32(data.ManualDataAnalysisConsumptionNumber),
|
||||
CompetitiveNumber: int32(data.BundleCompetitiveNumber) + int32(data.BundleLimitCompetitiveNumber) + int32(data.BundleLimitCompetitiveExpiredNumber) + int32(data.IncreaseCompetitiveNumber) + int32(data.IncreaseLimitCompetitiveNumber) + int32(data.IncreaseLimitCompetitiveExpiredNumber) + int32(data.ManualCompetitiveNumber),
|
||||
CompetitiveExtendNumber: int32(data.MonthlyBundleLimitCompetitiveNumber) + int32(data.MonthlyIncreaseLimitCompetitiveNumber) + int32(data.MonthlyBundleLimitExpiredCompetitiveNumber) + int32(data.MonthlyIncreaseLimitExpiredCompetitiveNumber) + int32(data.ManualCompetitiveNumber) + int32(data.IncreaseCompetitiveNumber) + int32(data.BundleCompetitiveNumber),
|
||||
CompetitiveExtendConsumptionNumber: int32(data.MonthlyBundleLimitCompetitiveConsumptionNumber) + int32(data.MonthlyIncreaseLimitCompetitiveConsumptionNumber) + int32(data.MonthlyBundleLimitExpiredCompetitiveConsumptionNumber) + int32(data.MonthlyIncreaseLimitExpiredCompetitiveConsumptionNumber) + int32(data.ManualCompetitiveConsumptionNumber) + int32(data.IncreaseCompetitiveConsumptionNumber) + int32(data.BundleCompetitiveConsumptionNumber),
|
||||
CompetitiveAdditional: int32(data.ManualCompetitiveNumber),
|
||||
CompetitiveConsumptionNumber: int32(data.BundleCompetitiveConsumptionNumber) + int32(data.BundleLimitCompetitiveConsumptionNumber) + int32(data.BundleLimitCompetitiveExpiredConsumptionNumber) + int32(data.IncreaseCompetitiveConsumptionNumber) + int32(data.IncreaseLimitCompetitiveConsumptionNumber) + int32(data.IncreaseLimitCompetitiveExpiredConsumptionNumber) + int32(data.ManualCompetitiveConsumptionNumber),
|
||||
OrderUUID: data.OrderUUID,
|
||||
BundleName: data.BundleName,
|
||||
PayTime: data.StartAt.UnixMilli(),
|
||||
ExpiredTime: data.ExpiredAt.UnixMilli(),
|
||||
PaymentAmount: data.PaymentAmount,
|
||||
PaymentType: data.PaymentType,
|
||||
AccountNumber: int32(data.BundleAccountNumber) + int32(data.IncreaseAccountNumber) + int32(data.ManualAccountNumber),
|
||||
AccountAdditional: int32(data.ManualAccountNumber),
|
||||
AccountConsumptionNumber: int32(data.BundleAccountConsumptionNumber) + int32(data.IncreaseAccountConsumptionNumber) + int32(data.ManualAccountConsumptionNumber),
|
||||
VideoNumber: int32(data.BundleVideoNumber) + int32(data.BundleLimitVideoNumber) + int32(data.BundleLimitVideoExpiredNumber) + int32(data.IncreaseVideoNumber) + int32(data.IncreaseLimitVideoNumber) + int32(data.IncreaseLimitVideoExpiredNumber) + int32(data.ManualVideoNumber),
|
||||
VideoAdditional: int32(data.ManualVideoNumber),
|
||||
VideoConsumptionNumber: int32(data.BundleVideoConsumptionNumber) + int32(data.BundleLimitVideoConsumptionNumber) + int32(data.BundleLimitVideoExpiredConsumptionNumber) + int32(data.IncreaseVideoConsumptionNumber) + int32(data.IncreaseLimitVideoConsumptionNumber) + int32(data.IncreaseLimitVideoExpiredConsumptionNumber) + int32(data.ManualVideoConsumptionNumber),
|
||||
ImageNumber: int32(data.BundleImageNumber) + int32(data.BundleLimitImageNumber) + int32(data.BundleLimitImageExpiredNumber) + int32(data.IncreaseImageNumber) + int32(data.IncreaseLimitImageNumber) + int32(data.IncreaseLimitImageExpiredNumber) + int32(data.ManualImageNumber),
|
||||
ImageAdditional: int32(data.ManualImageNumber),
|
||||
ImageConsumptionNumber: int32(data.BundleImageConsumptionNumber) + int32(data.BundleLimitImageConsumptionNumber) + int32(data.BundleLimitImageExpiredConsumptionNumber) + int32(data.IncreaseImageConsumptionNumber) + int32(data.IncreaseLimitImageConsumptionNumber) + int32(data.IncreaseLimitImageExpiredConsumptionNumber) + int32(data.ManualImageConsumptionNumber),
|
||||
DataAnalysisNumber: int32(data.BundleDataAnalysisNumber) + int32(data.BundleLimitDataAnalysisNumber) + int32(data.BundleLimitDataAnalysisExpiredNumber) + int32(data.IncreaseDataAnalysisNumber) + int32(data.IncreaseLimitDataAnalysisNumber) + int32(data.IncreaseLimitDataAnalysisExpiredNumber) + int32(data.ManualDataAnalysisNumber),
|
||||
DataAnalysisAdditional: int32(data.ManualDataAnalysisNumber),
|
||||
DataAnalysisConsumptionNumber: int32(data.BundleDataAnalysisConsumptionNumber) + int32(data.BundleLimitDataAnalysisConsumptionNumber) + int32(data.BundleLimitDataAnalysisExpiredConsumptionNumber) + int32(data.IncreaseDataAnalysisConsumptionNumber) + int32(data.IncreaseLimitDataAnalysisConsumptionNumber) + int32(data.IncreaseLimitDataAnalysisExpiredConsumptionNumber) + int32(data.ManualDataAnalysisConsumptionNumber),
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
@ -264,7 +224,6 @@ func AddBundleBalance(req *bundle.AddBundleBalanceReq) (*bundle.AddBundleBalance
|
||||
ImageNumber: int(req.ImageConsumptionNumber),
|
||||
VideoNumber: int(req.VideoConsumptionNumber),
|
||||
DataAnalysisNumber: int(req.DataAnalysisConsumptionNumber),
|
||||
CompetitiveNumber: int(req.CompetitiveConsumptionNumber),
|
||||
}
|
||||
uesdType, err := dao.AddBundleBalanceByUserId(data)
|
||||
return &bundle.AddBundleBalanceResp{
|
||||
@ -307,7 +266,7 @@ func CreateBundleBalance(req *bundle.CreateBundleBalanceReq) (*bundle.CreateBund
|
||||
data.ExpiredAt = time.Now()
|
||||
userId, err := strconv.Atoi(addValues[0].CustomerID)
|
||||
if err != nil {
|
||||
return nil, errors.New("获取用户ID失败")
|
||||
return nil, err
|
||||
}
|
||||
data.Month = time.Now().Format("2006-01")
|
||||
data.UserId = userId
|
||||
@ -383,6 +342,7 @@ func CreateBundleBalance(req *bundle.CreateBundleBalanceReq) (*bundle.CreateBund
|
||||
data.IncreaseLimitDataAnalysisNumber += int(v.Num)
|
||||
}
|
||||
} else {
|
||||
|
||||
data.IncreaseDataAnalysisNumber += int(v.Num)
|
||||
}
|
||||
}
|
||||
@ -401,30 +361,6 @@ func CreateBundleBalance(req *bundle.CreateBundleBalanceReq) (*bundle.CreateBund
|
||||
case "年":
|
||||
data.ExpiredAt = data.ExpiredAt.Add(time.Hour * 24 * 365 * time.Duration(v.Num))
|
||||
}
|
||||
case 6: // 竞品数
|
||||
if v.EquityType == 1 { // 套餐权益
|
||||
if v.QuotaType == 2 { // 限制额度
|
||||
data.MonthlyLimitCompetitiveQuotaNumber = int(v.QuotaValue)
|
||||
if v.IsExpired { // 会过期的限制类型
|
||||
data.BundleLimitCompetitiveExpiredNumber += int(v.Num)
|
||||
} else {
|
||||
data.BundleLimitCompetitiveNumber += int(v.Num)
|
||||
}
|
||||
} else {
|
||||
data.BundleCompetitiveNumber += int(v.Num)
|
||||
}
|
||||
} else {
|
||||
if v.QuotaType == 2 { // 限制额度
|
||||
data.MonthlyLimitCompetitiveQuotaNumber = int(v.QuotaValue)
|
||||
if v.IsExpired { // 会过期的限制类型
|
||||
data.IncreaseLimitCompetitiveExpiredNumber += int(v.Num)
|
||||
} else {
|
||||
data.IncreaseLimitCompetitiveNumber += int(v.Num)
|
||||
}
|
||||
} else {
|
||||
data.IncreaseCompetitiveNumber += int(v.Num)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
now := time.Now()
|
||||
@ -443,11 +379,6 @@ func CreateBundleBalance(req *bundle.CreateBundleBalanceReq) (*bundle.CreateBund
|
||||
data.MonthlyBundleLimitDataAnalysisNumber = cal(data, data.BundleLimitDataAnalysisNumber, data.MonthlyLimitDataAnalysisQuotaNumber, now)
|
||||
data.MonthlyIncreaseLimitDataAnalysisNumber = cal(data, data.IncreaseLimitDataAnalysisNumber, data.MonthlyLimitDataAnalysisQuotaNumber, now)
|
||||
|
||||
data.MonthlyBundleLimitExpiredCompetitiveNumber = cal(data, data.BundleLimitCompetitiveExpiredNumber, data.MonthlyLimitCompetitiveQuotaNumber, now)
|
||||
data.MonthlyIncreaseLimitExpiredCompetitiveNumber = cal(data, data.IncreaseLimitCompetitiveExpiredNumber, data.MonthlyLimitCompetitiveQuotaNumber, now)
|
||||
data.MonthlyBundleLimitCompetitiveNumber = cal(data, data.BundleLimitCompetitiveNumber, data.MonthlyLimitCompetitiveQuotaNumber, now)
|
||||
data.MonthlyIncreaseLimitCompetitiveNumber = cal(data, data.IncreaseLimitCompetitiveNumber, data.MonthlyLimitCompetitiveQuotaNumber, now)
|
||||
|
||||
err = dao.CreateBundleBalance(data)
|
||||
if err != nil {
|
||||
logger.Error(err)
|
||||
@ -516,24 +447,6 @@ func ConfirmWork(req *bundle.ConfirmWorkReq) (*bundle.ConfirmWorkResp, error) {
|
||||
return nil, dao.ConfirmWork(req)
|
||||
}
|
||||
|
||||
func GetWaitConfirmWorkList(req *bundle.GetWaitConfirmWorkListReq) (*bundle.GetWaitConfirmWorkListResp, error) {
|
||||
data, err := dao.GetWaitConfirmWorkList()
|
||||
if err != nil {
|
||||
logger.Error(err)
|
||||
return nil, errors.New("查询失败")
|
||||
}
|
||||
result := &bundle.GetWaitConfirmWorkListResp{}
|
||||
result.Data = lo.Map(data, func(m model.CastWork, _ int) *bundle.ConfirmWorkItem {
|
||||
return &bundle.ConfirmWorkItem{
|
||||
WorkUuid: m.Uuid,
|
||||
WorkCategory: int32(m.WorkCategory),
|
||||
ArtistName: m.ArtistName,
|
||||
ArtistUuid: m.ArtistUuid,
|
||||
}
|
||||
})
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func BundleActivate(req *bundle.BundleActivateReq) error {
|
||||
return dao.BundleActivate(req.Ids)
|
||||
}
|
||||
@ -554,11 +467,11 @@ func BundleBalanceExport(req *bundle.BundleBalanceExportReq) (*bundle.BundleBala
|
||||
PageSize: 99999,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, errors.New("余量列表数据失败")
|
||||
return nil, err
|
||||
}
|
||||
prefixData, err := dao.BalanceExportPrefix()
|
||||
if err != nil {
|
||||
return nil, errors.New("获取前缀数据失败")
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var prefixMap = map[int32]model.BundleExportDto{}
|
||||
@ -584,8 +497,6 @@ func BundleBalanceExport(req *bundle.BundleBalanceExportReq) (*bundle.BundleBala
|
||||
item.MonthlyIncreaseImageConsumptionNumber = v.MonthIncreaseImageConsumptionNumber
|
||||
item.MonthlyBundleDataAnalysisConsumptionNumber = v.MonthBundleDataAnalysisConsumptionNumber
|
||||
item.MonthlyIncreaseDataAnalysisConsumptionNumber = v.MonthIncreaseDataAnalysisConsumptionNumber
|
||||
item.MonthlyBundleCompetitiveConsumptionNumber = v.MonthBundleCompetitiveConsumptionNumber
|
||||
item.MonthlyIncreaseCompetitiveConsumptionNumber = v.MonthIncreaseCompetitiveConsumptionNumber
|
||||
item.Currency = "USD"
|
||||
f, _ := strconv.ParseFloat(prefixItem.Fee, 64)
|
||||
item.Fee = fmt.Sprintf("%.2f", f)
|
||||
@ -599,14 +510,6 @@ func BundleBalanceExport(req *bundle.BundleBalanceExportReq) (*bundle.BundleBala
|
||||
} else {
|
||||
item.IncreaseVideoUnitPrice = float32(math.Round(float64(item.IncreaseAmount/float32(v.IncreaseVideoNumber))*100) / 100)
|
||||
}
|
||||
bundleUnitPrice := decimal.NewFromFloat32(item.BundleVideoUnitPrice)
|
||||
increaseUnitPrice := decimal.NewFromFloat32(item.IncreaseVideoUnitPrice)
|
||||
|
||||
bundlePriceTotal := bundleUnitPrice.Mul(decimal.NewFromInt32(v.MonthBundleVideoConsumptionNumber))
|
||||
increasePriceTotal := increaseUnitPrice.Mul(decimal.NewFromInt32(v.MonthIncreaseVideoConsumptionNumber))
|
||||
|
||||
item.MonthlyBundleVideoConsumptionPrice = bundlePriceTotal.StringFixed(2)
|
||||
item.MonthlyIncreaseVideoConsumptionPrice = increasePriceTotal.StringFixed(2)
|
||||
items = append(items, item)
|
||||
}
|
||||
return &bundle.BundleBalanceExportResp{Total: int64(len(items)), Data: items}, nil
|
||||
@ -691,31 +594,15 @@ func buildDefaultBalanceLayout() string {
|
||||
{"当月可用增值数据数", "monthlyIncreaseDataAnalysisNumber", 2},
|
||||
{"当月作废套餐数据数", "monthlyInvalidBundleDataAnalysisNumber", 2},
|
||||
{"当月作废增值数据数", "monthlyInvalidIncreaseDataAnalysisNumber", 2},
|
||||
{"套餐竞品总数", "bundleCompetitiveNumber", 2},
|
||||
{"增值竞品总数", "increaseCompetitiveNumber", 2},
|
||||
{"当前已用套餐竞品数", "bundleCompetitiveConsumptionNumber", 2},
|
||||
{"当前已用增值竞品数", "increaseCompetitiveConsumptionNumber", 2},
|
||||
{"当前作废套餐竞品数", "invalidBundleCompetitiveNumber", 2},
|
||||
{"当前作废增值竞品数", "invalidIncreaseCompetitiveNumber", 2},
|
||||
{"当月新增套餐竞品数", "monthlyNewBundleCompetitiveNumber", 2},
|
||||
{"当月新增增值竞品数", "monthlyNewIncreaseCompetitiveNumber", 2},
|
||||
{"当月使用套餐竞品数", "monthBundleCompetitiveConsumptionNumber", 2},
|
||||
{"当月使用增值竞品数", "monthIncreaseCompetitiveConsumptionNumber", 2},
|
||||
{"当月可用套餐竞品数", "monthlyBundleCompetitiveNumber", 2},
|
||||
{"当月可用增值竞品数", "monthlyIncreaseCompetitiveNumber", 2},
|
||||
{"当月作废套餐竞品数", "monthlyInvalidBundleCompetitiveNumber", 2},
|
||||
{"当月作废增值竞品数", "monthlyInvalidIncreaseCompetitiveNumber", 2},
|
||||
{"当月新增手动扩展账号数", "monthlyNewManualAccountNumber", 2},
|
||||
{"当月新增手动扩展视频数", "monthlyNewManualVideoNumber", 2},
|
||||
{"当月新增手动扩展图文数", "monthlyNewManualImageNumber", 2},
|
||||
{"当月新增手动扩展数据数", "monthlyNewManualDataAnalysisNumber", 2},
|
||||
{"当月新增手动扩展竞品数", "monthlyNewManualCompetitiveNumber", 2},
|
||||
{"当月新增手动扩展时长(日)", "monthlyNewDurationNumber", 2},
|
||||
{"当月已用手动扩展账号数", "monthlyManualAccountConsumptionNumber", 2},
|
||||
{"当月已用手动扩展视频数", "monthlyManualVideoConsumptionNumber", 2},
|
||||
{"当月已用手动扩展图文数", "monthlyManualImageConsumptionNumber", 2},
|
||||
{"当月已用手动扩展数据数", "monthlyManualDataAnalysisConsumptionNumber", 2},
|
||||
{"当月已用手动扩展竞品数", "monthlyManualCompetitiveConsumptionNumber", 2},
|
||||
}
|
||||
jsonMap := []map[string]any{}
|
||||
for _, v := range data {
|
||||
|
||||
@ -73,7 +73,7 @@ func SaveBundle(req *bundle.BundleProfile) (res *bundle.SaveResponse, err error)
|
||||
Content: req.Content,
|
||||
Price: req.Price,
|
||||
PriceType: req.PriceType,
|
||||
Contract: "https://e-cdn.fontree.cn/fonchain-main/prod/file/contract/saas/template-25122501.pdf",
|
||||
Contract: "https://e-cdn.fontree.cn/fonchain-main/prod/file/saas/contract/template-25032801.pdf",
|
||||
ImgOption: int8(req.ImgOption),
|
||||
BgImg1: req.BgImg1,
|
||||
BgImg2: req.BgImg2,
|
||||
@ -698,13 +698,3 @@ func BundleListH5V2(req *bundle.BundleListRequest) (res *bundle.BundleListRespon
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// 增加h5套餐列表
|
||||
func QueryTheOrderSnapshotInformation(req *bundle.QueryTheOrderSnapshotInformationReq) (res *bundle.QueryTheOrderSnapshotInformationResp, err error) {
|
||||
res = new(bundle.QueryTheOrderSnapshotInformationResp)
|
||||
res, err = dao.QueryTheOrderSnapshotInformation(req)
|
||||
if err != nil {
|
||||
return res, errors.New("获取套餐列表失败")
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
@ -26,7 +26,3 @@ func MetricsArtistAccountExport(req *bundle.MetricsArtistAccountExportReq) (*bun
|
||||
func MetricsVideoSubmitExport(req *bundle.MetricsVideoSubmitExportReq) (*bundle.MetricsVideoSubmitExportResp, error) {
|
||||
return dao.MetricsVideoSubmitExport(req)
|
||||
}
|
||||
|
||||
func ExportWorkCastInfo(req *bundle.ExportWorkCastInfoReq) (*bundle.ExportWorkCastInfoResp, error) {
|
||||
return dao.ExportWorkCastInfo(req)
|
||||
}
|
||||
|
||||
@ -68,8 +68,6 @@ func CreateOrderRecord(req *bundle.OrderCreateRecord) (res *bundle.CommonRespons
|
||||
ExpirationTime: req.ExpirationTime,
|
||||
Language: req.Language,
|
||||
BundleOrderValueAdd: addRecords,
|
||||
PlatformIds: req.PlatformIds,
|
||||
InviterID: req.InviterId,
|
||||
}
|
||||
res, err = dao.CreateOrderRecord(orderRecord)
|
||||
return
|
||||
@ -184,8 +182,3 @@ func SoftDeleteUnfinishedInfo(req *bundle.SoftDeleteUnfinishedInfoRequest) (res
|
||||
res, err = dao.SoftDeleteUnfinishedInfo(req)
|
||||
return
|
||||
}
|
||||
func ReSignTheContract(req *bundle.ReSignTheContractRequest) (res *bundle.CommonResponse, err error) {
|
||||
res = new(bundle.CommonResponse)
|
||||
res, err = dao.ReSignTheContract(req)
|
||||
return
|
||||
}
|
||||
|
||||
@ -3,18 +3,19 @@ package logic
|
||||
import (
|
||||
"encoding/json"
|
||||
"micro-bundle/internal/dao"
|
||||
"micro-bundle/internal/dto"
|
||||
"micro-bundle/pb/bundle"
|
||||
commonErr "micro-bundle/pkg/err"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// GetValidArtistList 查询套餐状态为有效中的艺人列表
|
||||
func GetValidArtistList() ([]dto.ValidArtistInfo, error) {
|
||||
// 调用dao层获取艺人详细信息
|
||||
func GetValidArtistList() ([]dao.ValidArtistInfo, error) {
|
||||
return dao.GetValidArtistList()
|
||||
}
|
||||
|
||||
// GetValidArtistIDs 查询套餐没有过期的艺人ID列表(保持向后兼容)
|
||||
// 根据BundleOrderRecords表查询过期时间大于当前时间且状态为已支付的艺人
|
||||
func GetValidArtistIDs() ([]string, error) {
|
||||
artistList, err := GetValidArtistList()
|
||||
if err != nil {
|
||||
@ -33,6 +34,8 @@ func GetValidArtistIDs() ([]string, error) {
|
||||
|
||||
// todo 目前暂时不做检验,后续需要做判断
|
||||
// GetValidEmployeeIDs 查询可以被指派任务的员工ID列表
|
||||
// 这里可以根据实际业务需求实现,比如查询员工表、权限表等
|
||||
// 目前先返回一个示例实现,实际项目中需要根据具体的员工管理逻辑来实现
|
||||
func GetValidEmployeeIDs() ([]string, error) {
|
||||
var employeeIDs []string
|
||||
|
||||
@ -60,18 +63,40 @@ func ValidateEmployee(employeeNum string) (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
// GetPendingTaskList 查询待指派任务记录
|
||||
func GetPendingTaskList(req *dao.TaskQueryRequest) ([]*dao.TaskQueryResponse, int64, error) {
|
||||
// 1. 先查询套餐没有过期的艺人
|
||||
validArtist, err := GetValidArtistList()
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
|
||||
// 2. 调用DAO层查询待指派任务记录(已包含联表查询和排序分页)
|
||||
recordResponse, total, err := dao.GetPendingTaskList(req, validArtist)
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
|
||||
// 3. 直接返回DAO层的结果(已经包含了所有计算和排序分页逻辑)
|
||||
return recordResponse, total, nil
|
||||
}
|
||||
|
||||
// GetArtistUploadStatsList 查询艺人上传与额度统计列表
|
||||
func GetArtistUploadStatsList(req *dto.TaskQueryRequest) ([]*dto.ArtistUploadStatsItem, int64, error) {
|
||||
func GetArtistUploadStatsList(req *dao.TaskQueryRequest) ([]*dao.ArtistUploadStatsItem, int64, error) {
|
||||
return dao.GetArtistUploadStatsList(req)
|
||||
}
|
||||
|
||||
func GetPendingUploadBreakdownBySubNums(subNums []string, page int, pageSize int) ([]*dao.ArtistPendingUploadBreakdownItem, int64, error) {
|
||||
return dao.GetPendingUploadBreakdownBySubNums(subNums, page, pageSize)
|
||||
}
|
||||
|
||||
// GetPendingAssignBySubNums 查询指定艺人的可指派数量
|
||||
func GetPendingAssignBySubNums(subNums []string, page int, pageSize int) ([]*dto.ArtistPendingAssignItem, int64, error) {
|
||||
func GetPendingAssignBySubNums(subNums []string, page int, pageSize int) ([]*dao.ArtistPendingAssignItem, int64, error) {
|
||||
return dao.GetPendingAssignBySubNums(subNums, page, pageSize)
|
||||
}
|
||||
|
||||
// AssignTask 指派某位员工完成某个艺人的任务
|
||||
func AssignTask(req *dto.TaskAssignRequest) error {
|
||||
func AssignTask(req *dao.TaskAssignRequest) error {
|
||||
// 1. 验证员工是否可以被指派任务
|
||||
isValid, err := ValidateEmployee(req.TaskAssigneeNum)
|
||||
if err != nil {
|
||||
@ -99,7 +124,7 @@ func AssignTask(req *dto.TaskAssignRequest) error {
|
||||
}
|
||||
|
||||
// BatchAssignTask 批量指派
|
||||
func BatchAssignTask(items []*dto.BatchAssignItem) error {
|
||||
func BatchAssignTask(items []*dao.BatchAssignItem) error {
|
||||
if len(items) == 0 {
|
||||
return commonErr.ReturnError(nil, "参数错误", "批量指派项不能为空")
|
||||
}
|
||||
@ -135,6 +160,42 @@ func BatchAssignTask(items []*dto.BatchAssignItem) error {
|
||||
return dao.BatchAssignTasks(items)
|
||||
}
|
||||
|
||||
// UpdatePendingCount 修改待发数量
|
||||
func UpdatePendingCount(req *dao.UpdatePendingCountRequest) error {
|
||||
// 待发视频数、图文数、数据分析数不能都为0
|
||||
if req.PendingVideoCount == 0 && req.PendingPostCount == 0 && req.PendingDataCount == 0 {
|
||||
return commonErr.ReturnError(nil, "请输入正确的本次任务数字", "待发视频数、图文数、数据分析数不能都为0")
|
||||
}
|
||||
|
||||
// 1. 验证艺人是否有有效套餐
|
||||
validArtistIDs, err := GetValidArtistIDs()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// 检查艺人是否在有效列表中
|
||||
isValidArtist := false
|
||||
for _, artistID := range validArtistIDs {
|
||||
if artistID == req.SubNum {
|
||||
isValidArtist = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if !isValidArtist {
|
||||
return commonErr.ReturnError(nil, "艺人套餐已过期", "该艺人没有有效的套餐,无法修改待发数量")
|
||||
}
|
||||
|
||||
// 查询艺人当前任务余额,校验是否存在记录(不做数量比较,避免排除手动余额)
|
||||
_, err = dao.GetRemainingPendingBySubNum(req.SubNum)
|
||||
if err != nil {
|
||||
return commonErr.ReturnError(err, "查询艺人任务余额失败", "查询艺人任务余额失败: ")
|
||||
}
|
||||
|
||||
// 2. 调用DAO层更新待发数量(DAO 内部已做充足的额度与当月限额校验)
|
||||
return dao.UpdatePendingCount(req)
|
||||
}
|
||||
|
||||
// GetRecentAssignRecords 查询最近被指派记录
|
||||
func GetRecentAssignRecords(limit int) ([]*bundle.RecentAssigneeItem, error) {
|
||||
records, err := dao.GetRecentAssignRecords(limit)
|
||||
@ -153,7 +214,7 @@ func GetRecentAssignRecords(limit int) ([]*bundle.RecentAssigneeItem, error) {
|
||||
}
|
||||
|
||||
// GetEmployeeAssignedTasks 根据登录人信息查询被指派给该员工的艺人任务
|
||||
func GetEmployeeAssignedTasks(req *dto.EmployeeTaskQueryRequest) ([]*dto.TaskAssignRecordsResponse, int64, error) {
|
||||
func GetEmployeeAssignedTasks(req *dao.EmployeeTaskQueryRequest) ([]*dao.TaskAssignRecordsResponse, int64, error) {
|
||||
// 1. 调用DAO层查询被指派给该员工的艺人任务
|
||||
record, total, err := dao.GetEmployeeAssignedTasks(req)
|
||||
if err != nil {
|
||||
@ -162,9 +223,9 @@ func GetEmployeeAssignedTasks(req *dto.EmployeeTaskQueryRequest) ([]*dto.TaskAss
|
||||
|
||||
// 如果查询的 status = 2 的话,待发数量就为指派时,指派的数量
|
||||
if req.Status == 2 {
|
||||
var recordResponse []*dto.TaskAssignRecordsResponse
|
||||
var recordResponse []*dao.TaskAssignRecordsResponse
|
||||
for _, record := range record {
|
||||
recordResponse = append(recordResponse, &dto.TaskAssignRecordsResponse{
|
||||
recordResponse = append(recordResponse, &dao.TaskAssignRecordsResponse{
|
||||
AssignRecordsUUID: record.AssignRecordsUUID,
|
||||
SubNum: record.SubNum,
|
||||
TelNum: record.TelNum,
|
||||
@ -191,9 +252,9 @@ func GetEmployeeAssignedTasks(req *dto.EmployeeTaskQueryRequest) ([]*dto.TaskAss
|
||||
}
|
||||
|
||||
// 2. 转换为响应结构体
|
||||
var recordResponse []*dto.TaskAssignRecordsResponse
|
||||
var recordResponse []*dao.TaskAssignRecordsResponse
|
||||
for _, record := range record {
|
||||
recordResponse = append(recordResponse, &dto.TaskAssignRecordsResponse{
|
||||
recordResponse = append(recordResponse, &dao.TaskAssignRecordsResponse{
|
||||
AssignRecordsUUID: record.AssignRecordsUUID,
|
||||
SubNum: record.SubNum,
|
||||
TelNum: record.TelNum,
|
||||
@ -229,6 +290,7 @@ func TerminateTaskByUUID(assignRecordsUUID string) error {
|
||||
}
|
||||
|
||||
// BatchTerminateTaskByUUIDs 批量根据指派记录UUID终止任务(实际状态置为已中止)
|
||||
// 返回成功数量、失败数量、失败UUID列表和错误(仅当整体参数错误时返回错误)
|
||||
func BatchTerminateTaskByUUIDs(assignRecordsUUIDs []string) (int, int, []string, error) {
|
||||
if len(assignRecordsUUIDs) == 0 {
|
||||
return 0, 0, nil, commonErr.ReturnError(nil, "参数错误", "AssignRecordsUUIDs 不能为空")
|
||||
@ -295,7 +357,7 @@ func CompleteTaskManually(assignRecordsUUID string, taskAssigneeNum string) erro
|
||||
}
|
||||
|
||||
// UpdateTaskProgress 员工实际完成任务状态更新
|
||||
func UpdateTaskProgress(req *dto.CompleteTaskRequest) error {
|
||||
func UpdateTaskProgress(req *dao.CompleteTaskRequest) error {
|
||||
if req.UUID == "" {
|
||||
return commonErr.ReturnError(nil, "作品UUID不能为空", "UUID不能为空")
|
||||
}
|
||||
@ -303,16 +365,16 @@ func UpdateTaskProgress(req *dto.CompleteTaskRequest) error {
|
||||
}
|
||||
|
||||
// GetTaskAssignRecordsList 多条件查询操作记录表
|
||||
func GetTaskAssignRecordsList(req *dto.TaskAssignRecordsQueryRequest) ([]*dto.TaskAssignRecordsResponse, int64, *dto.TaskAssignRecordsSummary, error) {
|
||||
func GetTaskAssignRecordsList(req *dao.TaskAssignRecordsQueryRequest) ([]*dao.TaskAssignRecordsResponse, int64, *dao.TaskAssignRecordsSummary, error) {
|
||||
record, total, summary, err := dao.GetTaskAssignRecordsList(req)
|
||||
if err != nil {
|
||||
return nil, 0, nil, err
|
||||
}
|
||||
|
||||
// 2. 转换为响应结构体
|
||||
var recordResponse []*dto.TaskAssignRecordsResponse
|
||||
var recordResponse []*dao.TaskAssignRecordsResponse
|
||||
for _, record := range record {
|
||||
recordResponse = append(recordResponse, &dto.TaskAssignRecordsResponse{
|
||||
recordResponse = append(recordResponse, &dao.TaskAssignRecordsResponse{
|
||||
AssignRecordsUUID: record.AssignRecordsUUID,
|
||||
SubNum: record.SubNum,
|
||||
TelNum: record.TelNum,
|
||||
@ -342,6 +404,65 @@ func GetTaskAssignRecordsList(req *dto.TaskAssignRecordsQueryRequest) ([]*dto.Ta
|
||||
return recordResponse, total, summary, nil
|
||||
}
|
||||
|
||||
// 新增:查询艺人剩余待发数量(区分套餐/增值,共6个字段)
|
||||
func GetArtistRemainingPending(subNum string) (*dao.ArtistRemainingPendingResponse, error) {
|
||||
if strings.TrimSpace(subNum) == "" {
|
||||
return nil, commonErr.ReturnError(nil, "查询参数错误", "艺人编号不能为空")
|
||||
}
|
||||
return dao.GetRemainingPendingBySubNum(subNum)
|
||||
}
|
||||
|
||||
// calculatePendingFromTaskBalance 从TaskBalance表计算待发任务数量
|
||||
func calculatePendingFromTaskBalance(subNum string) (videoTotal, imageTotal, dataTotal int) {
|
||||
// 查询用户的任务余额
|
||||
tb, err := dao.GetTaskBalanceBySubNum(subNum)
|
||||
if err != nil || tb == nil {
|
||||
return 0, 0, 0
|
||||
}
|
||||
|
||||
// 计算视频类待发数量:总余额 - 消耗数量
|
||||
videoTotal = (tb.MonthlyBundleLimitExpiredVideoNumber - tb.MonthlyBundleLimitExpiredVideoConsumptionNumber) +
|
||||
(tb.MonthlyBundleLimitVideoNumber - tb.MonthlyBundleLimitVideoConsumptionNumber) +
|
||||
(tb.BundleVideoNumber - tb.BundleVideoConsumptionNumber) +
|
||||
(tb.IncreaseVideoNumber - tb.IncreaseVideoConsumptionNumber) +
|
||||
(tb.MonthlyIncreaseLimitVideoNumber - tb.MonthlyIncreaseLimitVideoConsumptionNumber) +
|
||||
(tb.MonthlyIncreaseLimitExpiredVideoNumber - tb.MonthlyIncreaseLimitExpiredVideoConsumptionNumber) +
|
||||
(tb.ManualVideoNumber - tb.ManualVideoConsumptionNumber)
|
||||
if videoTotal < 0 {
|
||||
videoTotal = 0
|
||||
}
|
||||
|
||||
// 计算图片类待发数量:总余额 - 消耗数量
|
||||
imageTotal = (tb.MonthlyBundleLimitExpiredImageNumber - tb.MonthlyBundleLimitExpiredImageConsumptionNumber) +
|
||||
(tb.MonthlyBundleLimitImageNumber - tb.MonthlyBundleLimitImageConsumptionNumber) +
|
||||
(tb.BundleImageNumber - tb.BundleImageConsumptionNumber) +
|
||||
(tb.IncreaseImageNumber - tb.IncreaseImageConsumptionNumber) +
|
||||
(tb.MonthlyIncreaseLimitImageNumber - tb.MonthlyIncreaseLimitImageConsumptionNumber) +
|
||||
(tb.MonthlyIncreaseLimitExpiredImageNumber - tb.MonthlyIncreaseLimitExpiredImageConsumptionNumber) +
|
||||
(tb.ManualImageNumber - tb.ManualImageConsumptionNumber)
|
||||
if imageTotal < 0 {
|
||||
imageTotal = 0
|
||||
}
|
||||
|
||||
// 计算数据分析类待发数量:总余额 - 消耗数量
|
||||
dataTotal = (tb.MonthlyBundleLimitExpiredDataAnalysisNumber - tb.MonthlyBundleLimitExpiredDataAnalysisConsumptionNumber) +
|
||||
(tb.MonthlyBundleLimitDataAnalysisNumber - tb.MonthlyBundleLimitDataAnalysisConsumptionNumber) +
|
||||
(tb.BundleDataAnalysisNumber - tb.BundleDataAnalysisConsumptionNumber) +
|
||||
(tb.IncreaseDataAnalysisNumber - tb.IncreaseDataAnalysisConsumptionNumber) +
|
||||
(tb.MonthlyIncreaseLimitDataAnalysisNumber - tb.MonthlyIncreaseLimitDataAnalysisConsumptionNumber) +
|
||||
(tb.MonthlyIncreaseLimitExpiredDataAnalysisNumber - tb.MonthlyIncreaseLimitExpiredDataAnalysisConsumptionNumber) +
|
||||
(tb.ManualDataAnalysisNumber - tb.ManualDataAnalysisConsumptionNumber)
|
||||
if dataTotal < 0 {
|
||||
dataTotal = 0
|
||||
}
|
||||
|
||||
return videoTotal, imageTotal, dataTotal
|
||||
}
|
||||
|
||||
func UpdateTaskBalanceEveryMonLogic() {
|
||||
dao.UpdateTaskBalanceEveryMon()
|
||||
}
|
||||
|
||||
// GetTaskActualStatusByUUID 根据指派记录UUID查询实际完成状态
|
||||
func GetTaskActualStatusByUUID(assignRecordsUUID string) (int, error) {
|
||||
if strings.TrimSpace(assignRecordsUUID) == "" {
|
||||
@ -425,19 +546,3 @@ func AddHiddenTaskAssignee(taskAssignee string, taskAssigneeNum string) error {
|
||||
}
|
||||
return dao.AddHiddenTaskAssignee(taskAssignee, taskAssigneeNum)
|
||||
}
|
||||
|
||||
// CreateTaskWorkLog 创建任务日志记录
|
||||
func CreateTaskWorkLog(req *dto.CreateTaskWorkLogRequest) error {
|
||||
if req.OperationType < 1 || req.OperationType > 4 {
|
||||
return commonErr.ReturnError(nil, "参数错误", "操作类型必须在1-4之间")
|
||||
}
|
||||
if req.TaskType < 1 || req.TaskType > 3 {
|
||||
return commonErr.ReturnError(nil, "参数错误", "任务类型必须在1-3之间")
|
||||
}
|
||||
if req.TaskCount < 0 {
|
||||
return commonErr.ReturnError(nil, "参数错误", "任务数量不能为负数")
|
||||
}
|
||||
|
||||
// 调用 DAO 层创建日志
|
||||
return dao.CreateTaskWorkLog(req)
|
||||
}
|
||||
|
||||
@ -97,7 +97,6 @@ type BundleExtensionRecords struct {
|
||||
OperatorName string `gorm:"column:operator_name;type:varchar(256)" json:"operatorName"`
|
||||
OperatorPhoneNumber string `gorm:"column:operator_phone_number;type:varchar(256)" json:"operatorPhoneNumber"`
|
||||
TimeUnit uint `gorm:"column:time_unit;type:int(11) unsigned;comment:时间单位" json:"timeUnit"`
|
||||
CompetitiveAdditional uint `gorm:"column:competitive_additional;type:int(11) unsigned;comment:竞品数额外增加" json:"competitive_additional"`
|
||||
}
|
||||
|
||||
// TableName 表名称
|
||||
@ -112,7 +111,6 @@ type BundleExtendRecordItemPo struct {
|
||||
ImagesAdditional int
|
||||
DataAdditional int
|
||||
VideoAdditional int
|
||||
CompetitiveAdditional int
|
||||
AvailableDurationAdditional uint `gorm:"column:available_duration_additional;type:int(11) unsigned;comment:可用时长增加" json:"available_duration_additional"`
|
||||
Type int
|
||||
Remark string
|
||||
@ -292,39 +290,6 @@ type BundleBalance struct {
|
||||
|
||||
MonthlyNewDurationNumber int `gorm:"column:monthly_new_duration_number;comment:当月新增手动扩展时长(天)"`
|
||||
ExpansionPacksNumber int `gorm:"column:expansion_packs_number;not null;comment:扩展包数量"`
|
||||
|
||||
// ===== 竞品数 =====
|
||||
BundleCompetitiveNumber int `gorm:"column:bundle_competitive_number;not null;comment:非限制类型套餐权益竞品数总数"`
|
||||
IncreaseCompetitiveNumber int `gorm:"column:increase_competitive_number;not null;comment:非限制类型增值权益竞品数总数"`
|
||||
BundleLimitCompetitiveNumber int `gorm:"column:bundle_limit_competitive_number;not null;comment:套餐权益限制类型竞品数非过期总数"`
|
||||
IncreaseLimitCompetitiveNumber int `gorm:"column:increase_limit_competitive_number;not null;comment:增值权益限制类型竞品数非过期总数"`
|
||||
BundleLimitCompetitiveExpiredNumber int `gorm:"column:bundle_limit_competitive_expired_number;not null;comment:套餐权益限制类型竞品数会过期总数"`
|
||||
IncreaseLimitCompetitiveExpiredNumber int `gorm:"column:increase_limit_competitive_expired_number;not null;comment:增值权益限制类型竞品数会过期总数"`
|
||||
MonthlyInvalidBundleCompetitiveNumber int `gorm:"column:monthly_invalid_bundle_competitive_number;not null;comment:当月失效的套餐权益竞品数总数"`
|
||||
InvalidBundleCompetitiveNumber int `gorm:"column:invalid_bundle_competitive_number;not null;comment:历史失效的套餐权益竞品数总数"`
|
||||
MonthlyInvalidIncreaseCompetitiveNumber int `gorm:"column:monthly_invalid_increase_competitive_number;not null;comment:当月失效的增值权益竞品数总数"`
|
||||
InvalidIncreaseCompetitiveNumber int `gorm:"column:invalid_increase_competitive_number;not null;comment:历史失效的增值权益竞品数总数"`
|
||||
BundleCompetitiveConsumptionNumber int `gorm:"column:bundle_competitive_consumption_number;not null;comment:非限制类型套餐权益竞品数使用数"`
|
||||
IncreaseCompetitiveConsumptionNumber int `gorm:"column:increase_competitive_consumption_number;not null;comment:非限制类型增值权益竞品数使用数"`
|
||||
BundleLimitCompetitiveConsumptionNumber int `gorm:"column:bundle_limit_competitive_consumption_number;not null;comment:套餐权益限制类型竞品数非过期使用数"`
|
||||
IncreaseLimitCompetitiveConsumptionNumber int `gorm:"column:increase_limit_competitive_consumption_number;not null;comment:增值权益限制类型竞品数非过期使用数"`
|
||||
BundleLimitCompetitiveExpiredConsumptionNumber int `gorm:"column:bundle_limit_competitive_expired_consumption_number;not null;comment:套餐权益限制类型竞品数会过期使用数"`
|
||||
IncreaseLimitCompetitiveExpiredConsumptionNumber int `gorm:"column:increase_limit_competitive_expired_consumption_number;not null;comment:增值权益限制类型竞品数会过期使用数"`
|
||||
MonthlyBundleCompetitiveConsumptionNumber int `gorm:"column:monthly_bundle_competitive_consumption_number;not null;comment:当月套餐类型竞品数已使用额度"`
|
||||
MonthlyIncreaseCompetitiveConsumptionNumber int `gorm:"column:monthly_increase_competitive_consumption_number;not null;comment:当月增值类型竞品数已使用额度"`
|
||||
MonthlyBundleLimitCompetitiveNumber int `gorm:"column:monthly_bundle_limit_competitive_number;not null;comment:当月套餐限制类型竞品数可使用额度"`
|
||||
MonthlyIncreaseLimitCompetitiveNumber int `gorm:"column:monthly_increase_limit_competitive_number;not null;comment:当月增值限制类型竞品数可使用额度"`
|
||||
MonthlyBundleLimitCompetitiveConsumptionNumber int `gorm:"column:monthly_bundle_limit_competitive_consumption_number;not null;comment:当月套餐限制类型竞品数已使用额度"`
|
||||
MonthlyIncreaseLimitCompetitiveConsumptionNumber int `gorm:"column:monthly_increase_limit_competitive_consumption_number;not null;comment:当月增值限制类型竞品数已使用额度"`
|
||||
MonthlyBundleLimitExpiredCompetitiveNumber int `gorm:"column:monthly_bundle_limit_expired_competitive_number;not null;comment:当月套餐限制类会过期型竞品数可使用额度"`
|
||||
MonthlyIncreaseLimitExpiredCompetitiveNumber int `gorm:"column:monthly_increase_limit_expired_competitive_number;not null;comment:当月增值限制类会过期型竞品数可使用额度"`
|
||||
MonthlyBundleLimitExpiredCompetitiveConsumptionNumber int `gorm:"column:monthly_bundle_limit_expired_competitive_consumption_number;not null;comment:当月套餐限制类型会过期竞品数已使用额度"`
|
||||
MonthlyIncreaseLimitExpiredCompetitiveConsumptionNumber int `gorm:"column:monthly_increase_limit_expired_competitive_consumption_number;not null;comment:当月增值限制类会过期型竞品数已使用额度"`
|
||||
MonthlyLimitCompetitiveQuotaNumber int `gorm:"column:monthly_limit_competitive_quota_number;not null;comment:当月限制类型竞品数额度"`
|
||||
ManualCompetitiveNumber int `gorm:"column:manual_competitive_number;comment:手动扩展竞品数总数"`
|
||||
ManualCompetitiveConsumptionNumber int `gorm:"column:manual_competitive_consumption_number;comment:手动扩展竞品数使用数"`
|
||||
MonthlyNewManualCompetitiveNumber int `gorm:"column:monthly_new_manual_competitive_number;comment:当月手动扩展竞品数新增数"`
|
||||
MonthlyManualCompetitiveConsumptionNumber int `gorm:"column:monthly_manual_competitive_consumption_number;comment:当月手动扩展竞品数使用数"`
|
||||
}
|
||||
|
||||
// TableName 表名称
|
||||
@ -349,14 +314,12 @@ type BundleBalanceUsePo struct {
|
||||
VideoNumber int
|
||||
ImageNumber int
|
||||
DataAnalysisNumber int
|
||||
CompetitiveNumber int
|
||||
}
|
||||
type BundleBalanceExtendPo struct {
|
||||
UserId int
|
||||
AccountNumber int
|
||||
VideoNumber int
|
||||
ImageNumber int
|
||||
CompetitiveNumber int
|
||||
DataAnalysisNumber int
|
||||
DurationNumber int
|
||||
}
|
||||
@ -414,21 +377,4 @@ type ManualIncreaseBundleBalance struct {
|
||||
TotalVideoAdditional int `gorm:"column:total_video_additional"`
|
||||
TotalImageAdditional int `gorm:"column:total_image_additional"`
|
||||
TotalDataAnalysisAdditional int `gorm:"column:total_data_analysis_additional"`
|
||||
TotalCompetitiveAdditional int `gorm:"column:total_competitive_additional"`
|
||||
}
|
||||
|
||||
// 套餐购买导出
|
||||
type PurchaseItem struct {
|
||||
OrderNo string `gorm:"column:orderNo"`
|
||||
BundleName string `gorm:"column:bundleName"`
|
||||
UserNum string `gorm:"column:userNum"`
|
||||
UserName string `gorm:"column:userName"`
|
||||
PhoneNumber string `gorm:"column:phoneNumber"`
|
||||
PayTime string `gorm:"column:payTime"`
|
||||
IncreaseVideoCount float64 `gorm:"column:increaseVideoCount"`
|
||||
BundleAmount float32 `gorm:"column:bundleAmount"`
|
||||
IncreaseAmount float32 `gorm:"column:increaseAmount"`
|
||||
PaymentAmount float32 `gorm:"column:paymentAmount"`
|
||||
FinalAmount float32 `gorm:"column:finalAmount"`
|
||||
FeeAmount float32 `gorm:"column:feeAmount"`
|
||||
}
|
||||
|
||||
@ -1,9 +1,7 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"database/sql/driver"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
@ -43,9 +41,6 @@ type BundleOrderRecords struct {
|
||||
BundleCommonJson json.RawMessage `json:"bundle_common_json" gorm:"column:bundle_common_json;type:json;serializer:json;comment:套餐信息"`
|
||||
Language string `gorm:"column:language;comment:语言" json:"language"`
|
||||
BundleOrderValueAdd []BundleOrderValueAdd `gorm:"foreignKey:OrderUUID;references:UUID" json:"bundleOrderValueAdd"`
|
||||
ReSignature int `json:"reSignature" gorm:"column:re_signature;default:2;type:int;comment:是否重新签 1:是 2:否"`
|
||||
PlatformIds PlatformIDs `gorm:"column:platform_ids;type:json;NOT NULL;comment:发布平台ID集合 TIKTOK= 1, YOUTUBE = 2, INS = 3 , DM = 4, BL = 5;" json:"platformIDs"`
|
||||
InviterID uint64 `gorm:"column:inviter_id;type:bigint;comment:邀请人ID" json:"inviterID"`
|
||||
}
|
||||
type BundleOrderValueAdd struct {
|
||||
gorm.Model
|
||||
@ -77,30 +72,6 @@ type BundleOrderValueAdd struct {
|
||||
QuotaValue int32 `json:"quotaValue" gorm:"column:quota_value;type:int;comment:额度值"`
|
||||
IsExpired bool `json:"isExpired" gorm:"column:is_expired;default:false;comment:是否过期作废 false:不作废 true:作废"`
|
||||
}
|
||||
type PlatformIDs []uint32
|
||||
|
||||
// 实现 Scanner 接口
|
||||
func (p *PlatformIDs) Scan(value interface{}) error {
|
||||
if value == nil {
|
||||
*p = []uint32{}
|
||||
return nil
|
||||
}
|
||||
|
||||
bytes, ok := value.([]byte)
|
||||
if !ok {
|
||||
return errors.New("type assertion to []byte failed")
|
||||
}
|
||||
|
||||
return json.Unmarshal(bytes, p)
|
||||
}
|
||||
|
||||
// 实现 Valuer 接口
|
||||
func (p PlatformIDs) Value() (driver.Value, error) {
|
||||
if len(p) == 0 {
|
||||
return "[]", nil
|
||||
}
|
||||
return json.Marshal(p)
|
||||
}
|
||||
|
||||
// 财务确认状态
|
||||
const (
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
"time"
|
||||
)
|
||||
|
||||
// 用来自动导入 来创建用户和订单的 数据
|
||||
@ -20,7 +19,6 @@ type FieePaymentAuto struct {
|
||||
UserIdCardFrontUrl string `json:"userIdCardFrontUrl" gorm:"column:user_id_card_front_url;type:varchar(1024);comment:用户身份证正面"`
|
||||
UserIdCardReverseUrl string `json:"userIdCardReverseUrl" gorm:"column:user_id_card_reverse_url;type:varchar(1024);comment:用户身份证反面"`
|
||||
UserIdCardValidity string `json:"userIdCardValidity" gorm:"column:user_id_card_validity;type:varchar(64);comment:证件有效期"`
|
||||
CardNum string `json:"cardNum" gorm:"column:card_num;type:varchar(64);comment:证件号码"`
|
||||
OrderNo string `json:"orderNo" gorm:"column:order_no;type:varchar(128);comment:订单编号"`
|
||||
OrderPayAmount string `gorm:"column:order_pay_amount;type:decimal(20,2);comment:订单支付金额" json:"orderPayAmount"`
|
||||
OrderSettlementAmount string `gorm:"column:order_settlement_amount;type:decimal(20,2);comment:订单结算金额" json:"orderSettlementAmount"`
|
||||
|
||||
@ -12,7 +12,6 @@ var OrderByDataAnalysis = map[string]string{
|
||||
"increase_data_analysis_total": "increase_data_total",
|
||||
"released_data_analysis_total": "released_data_total",
|
||||
"pending_data_analysis_count": "pending_data_count",
|
||||
"sub_num": "customer_num",
|
||||
}
|
||||
|
||||
var OrderByPending = map[string]string{
|
||||
@ -242,6 +241,41 @@ func (TaskSyncStatus) TableName() string { return "task_sync_status" }
|
||||
// InitialSyncKey 一次性同步的唯一标识键
|
||||
const InitialSyncKey = "bundle_to_task_balance_initial_sync"
|
||||
|
||||
// 任务日志表
|
||||
type TaskLog struct {
|
||||
LogUUID string `gorm:"column:log_uuid;type:varchar(50);comment:任务日志UUID;not null" json:"taskLogUUID"`
|
||||
SubNum string `gorm:"column:sub_num;comment:任务用户编号;index:idx_task_log_sub_num;not null" json:"taskSubNum"`
|
||||
TelNum string `gorm:"column:tel_num;comment:任务用户手机号;index:idx_task_log_tel_num;not null" json:"taskTelNum"`
|
||||
ArtistName string `gorm:"column:artist_name;comment:任务艺人名称;index:idx_task_log_artist_name" json:"taskArtistName"`
|
||||
|
||||
// ===== 操作信息 =====
|
||||
OperationType int `gorm:"column:operation_type;type:int(11);comment:任务操作类型 1:加任务 2:消耗任务 3:完成任务;4:任务过期;index:idx_task_operation_type;not null" json:"taskOperationType"`
|
||||
TaskType int `gorm:"column:task_type;type:int(11);comment:任务类型 1:视频 2:图片 3:数据分析;index:idx_task_type;not null" json:"taskType"`
|
||||
TaskCount int `gorm:"column:task_count;type:int(11);comment:任务数量;not null" json:"taskCount"`
|
||||
Remark string `gorm:"column:remark;type:varchar(500);comment:任务备注" json:"taskRemark"`
|
||||
|
||||
// ===== 操作人信息 =====
|
||||
OperatorName string `gorm:"column:operator_name;comment:任务操作人姓名;index:idx_task_operator_name" json:"taskOperatorName"`
|
||||
OperatorNum string `gorm:"column:operator_num;comment:任务操作人账号;index:idx_task_operator_num" json:"taskOperatorNum"`
|
||||
CompletorName string `gorm:"column:completor_name;comment:任务完成人姓名;index:idx_task_completor_name" json:"taskCompletorName"`
|
||||
CompletorNum string `gorm:"column:completor_num;comment:任务完成人账号;index:idx_task_completor_num" json:"taskCompletorNum"`
|
||||
|
||||
// ===== 关联ID字段 =====
|
||||
VideoPublishUUID string `gorm:"column:video_publish_id;type:varchar(50);comment:任务关联的发布视频UUID;index:idx_task_video_publish_id" json:"taskVideoPublishID"`
|
||||
PostPublishUUID string `gorm:"column:post_publish_id;type:varchar(50);comment:任务关联的图文发布UUID;index:idx_task_post_publish_id" json:"taskPostPublishID"`
|
||||
DataAnalysisUUID string `gorm:"column:data_analysis_id;type:varchar(50);comment:任务关联的数据分析UUID;index:idx_task_data_analysis_id" json:"taskDataAnalysisID"`
|
||||
|
||||
// ===== 时间字段 =====
|
||||
OperationTime int `gorm:"column:operation_time;type:int(11);comment:任务操作时间;index:idx_task_operation_time;not null" json:"taskOperationTime"`
|
||||
CreatedAt int `gorm:"column:created_at;type:int(11);comment:任务日志创建时间" json:"taskCreatedAt"`
|
||||
UpdatedAt int `gorm:"column:updated_at;type:int(11);comment:任务日志更新时间" json:"taskUpdatedAt"`
|
||||
DeletedAt soft_delete.DeletedAt `gorm:"column:deleted_at;type:int(11);index:idx_task_log_deleted_at" json:"taskDeletedAt"`
|
||||
}
|
||||
|
||||
func (t *TaskLog) TableName() string {
|
||||
return "task_log"
|
||||
}
|
||||
|
||||
// 隐藏指派人表
|
||||
type TaskAssigneeHidden struct {
|
||||
// 让id自增
|
||||
@ -257,36 +291,3 @@ type TaskAssigneeHidden struct {
|
||||
func (TaskAssigneeHidden) TableName() string {
|
||||
return "task_assignee_hidden"
|
||||
}
|
||||
|
||||
// 任务日志表
|
||||
type TaskWorkLog struct {
|
||||
WorkLogUUID string `gorm:"column:work_log_uuid;type:varchar(50);comment:任务作品日志UUID;primarykey;not null" json:"taskWorkLogUUID"`
|
||||
AssignRecordsUUID string `gorm:"column:assign_records_uuid;type:varchar(50);comment:任务指派记录UUID;index:idx_assign_records_uuid;not null" json:"assignRecordsUUID"`
|
||||
WorkUUID string `gorm:"column:work_uuid;type:varchar(50);comment:任务作品UUID;index:idx_work_uuid;not null" json:"workUUID"`
|
||||
Title string `gorm:"column:title;type:varchar(50);comment:任务作品标题;not null" default:"" json:"title"`
|
||||
|
||||
ArtistUUID string `gorm:"column:artist_uuid;type:varchar(50);comment:任务艺人UUID;index:idx_artist_uuid;not null" default:"" json:"artistUUID"`
|
||||
SubNum string `gorm:"column:sub_num;comment:任务用户编号;index:idx_sub_num;not null" default:"" json:"subNum"`
|
||||
TelNum string `gorm:"column:tel_num;comment:任务用户手机号;index:idx_tel_num;not null" default:"" json:"telNum"`
|
||||
ArtistName string `gorm:"column:artist_name;comment:任务艺人名称;index:idx_artist_name" default:"" json:"artistName"`
|
||||
|
||||
// ===== 操作信息 =====
|
||||
OperationType int `gorm:"column:operation_type;type:int(11);comment:任务操作类型 1:加任务 2:消耗任务 3:完成任务;4:任务过期;index:idx_operation_type;not null" default:"0" json:"operationType"`
|
||||
TaskType int `gorm:"column:task_type;type:int(11);comment:任务类型 1:视频 2:图片 3:数据分析;index:idx_task_type;not null" default:"0" json:"taskType"`
|
||||
TaskCount int `gorm:"column:task_count;type:int(11);comment:任务数量;not null" default:"0" json:"taskCount"`
|
||||
Remark string `gorm:"column:remark;type:varchar(500);comment:任务备注" default:"" json:"remark"`
|
||||
|
||||
// ===== 操作人信息 =====
|
||||
OperatorName string `gorm:"column:operator_name;comment:任务操作人姓名;index:idx_operator_name" json:"taskOperatorName"`
|
||||
OperatorNum string `gorm:"column:operator_num;comment:任务操作人账号;index:idx_operator_num" json:"taskOperatorNum"`
|
||||
|
||||
// ===== 时间字段 =====
|
||||
OperationTime int `gorm:"column:operation_time;type:int(11);comment:任务操作时间;index:idx_operation_time;not null" json:"taskOperationTime"`
|
||||
CreatedAt int `gorm:"column:created_at;type:int(11);comment:任务日志创建时间" json:"taskCreatedAt"`
|
||||
UpdatedAt int `gorm:"column:updated_at;type:int(11);comment:任务日志更新时间" json:"taskUpdatedAt"`
|
||||
DeletedAt soft_delete.DeletedAt `gorm:"column:deleted_at;type:int(11);index:idx_work_log_deleted_at" json:"taskDeletedAt"`
|
||||
}
|
||||
|
||||
func (t *TaskWorkLog) TableName() string {
|
||||
return "task_work_log"
|
||||
}
|
||||
|
||||
348
pb/bundle.proto
348
pb/bundle.proto
@ -14,11 +14,15 @@ service Bundle {
|
||||
rpc HandShelf(HandShelfRequest) returns(CommonResponse) {} //更新套餐上下架状态
|
||||
rpc SaveBundle(BundleProfile)returns (SaveResponse) {}
|
||||
|
||||
|
||||
rpc BundleListV2(BundleListRequest) returns(BundleListResponse) {}
|
||||
rpc BundleDetailV2(BundleDetailRequest) returns(BundleDetailResponseV2) {}
|
||||
rpc BundleListH5V2(BundleListRequest) returns(BundleListResponse) {}
|
||||
rpc BundleLangDetailV2(BundleDetailRequest) returns(BundleProfileLang) {}
|
||||
|
||||
|
||||
|
||||
|
||||
rpc BundleList(BundleListRequest) returns (BundleListResponse) {}
|
||||
rpc BundleDetail(BundleDetailRequest) returns (BundleDetailResponse) {}
|
||||
|
||||
@ -33,7 +37,6 @@ service Bundle {
|
||||
rpc OrderRecordsListV2(OrderRecordsRequestV2) returns (OrderRecordsResponseV2) {}
|
||||
rpc OrderListByOrderNo(OrderInfoByOrderNoRequest) returns (OrderInfoByOrderNoResp) {}
|
||||
rpc OnlyAddValueListByOrderNo(OnlyAddValueListByOrderNoRequest) returns (OnlyAddValueListByOrderNoResp) {} // 根据orderNo只查增值服务
|
||||
rpc ReSignTheContract(ReSignTheContractRequest) returns (CommonResponse) {}
|
||||
|
||||
//增值套餐
|
||||
rpc CreateValueAddBundle(CreateValueAddBundleRequest) returns (CreateValueAddBundleResponse) {}
|
||||
@ -69,7 +72,6 @@ service Bundle {
|
||||
|
||||
rpc ToBeComfirmedWorks(ToBeComfirmedWorksReq) returns (ToBeComfirmedWorksResp) {} // 待确认作品列表
|
||||
rpc ConfirmWork(ConfirmWorkReq) returns (ConfirmWorkResp) {} // 确认作品
|
||||
rpc GetWaitConfirmWorkList(GetWaitConfirmWorkListReq) returns (GetWaitConfirmWorkListResp) {} // 获取待确认作品列表
|
||||
|
||||
//对账单
|
||||
rpc GetReconciliationList(GetReconciliationListReq) returns (GetReconciliationListResp) {} // 获取对账单列表
|
||||
@ -102,7 +104,6 @@ service Bundle {
|
||||
rpc GetPendingAssign(PendingAssignRequest) returns (PendingAssignResponse) {} // 查询艺人可指派数量
|
||||
rpc RevertTaskCompletionByUUIDItem(RevertTaskCompletionByUUIDItemRequest) returns (ComResponse) {}
|
||||
rpc AddHiddenTaskAssignee(AddHiddenTaskAssigneeRequest) returns (ComResponse) {}
|
||||
rpc CreateTaskWorkLog(CreateTaskWorkLogRequest) returns (CommonResponse) {} // 创建任务日志记录
|
||||
|
||||
//数据指标
|
||||
rpc MetricsBusiness(MetricsBusinessReq) returns (MetricsBusinessResp) {}
|
||||
@ -111,28 +112,7 @@ service Bundle {
|
||||
rpc MetricsBundlePurchaseExport(MetricsBundlePurchaseExportReq) returns (MetricsBundlePurchaseExportResp) {}
|
||||
rpc MetricsArtistAccountExport(MetricsArtistAccountExportReq) returns (MetricsArtistAccountExportResp) {}
|
||||
rpc MetricsVideoSubmitExport(MetricsVideoSubmitExportReq) returns (MetricsVideoSubmitExportResp) {}
|
||||
rpc QueryTheOrderSnapshotInformation(QueryTheOrderSnapshotInformationReq) returns (QueryTheOrderSnapshotInformationResp) {}
|
||||
|
||||
//临时接口
|
||||
rpc ExportWorkCastInfo(ExportWorkCastInfoReq) returns (ExportWorkCastInfoResp) {}
|
||||
}
|
||||
message QueryTheOrderSnapshotInformationReq{
|
||||
string orderNo = 1;
|
||||
}
|
||||
message QueryTheOrderSnapshotInformationResp{
|
||||
repeated ServiceInformation bundleOrder = 1;
|
||||
repeated ServiceInformation addBundleOrder = 2;
|
||||
string bundleContent = 3;
|
||||
}
|
||||
message ServiceInformation{
|
||||
uint64 serviceType = 1;
|
||||
uint64 num = 2;
|
||||
string unit = 3;
|
||||
}
|
||||
message ReSignTheContractRequest{
|
||||
string orderNo = 1;
|
||||
string contractNo = 2;
|
||||
string signContract = 3;
|
||||
}
|
||||
message DeleteValueAddServiceRequest{
|
||||
string orderNo = 1;
|
||||
@ -216,8 +196,6 @@ message OrderCreateRecord{
|
||||
int32 payType = 19 [json_name = "payType"];
|
||||
repeated OrderCreateAddRecord addRecords = 20 [json_name = "addRecords"]; //增值服务
|
||||
string orderNo = 21 [json_name = "orderNo"];
|
||||
repeated uint32 platformIds = 22; // 发布平台ID集合 (json 格式字符串)
|
||||
uint64 inviterId = 23; // 邀请人ID
|
||||
}
|
||||
message OrderCreateAddRecord{
|
||||
int32 serviceType = 1 [json_name = "serviceType"];
|
||||
@ -270,9 +248,6 @@ message OrderBundleRecordInfo{
|
||||
int64 customerId = 9;
|
||||
string payTime = 10;
|
||||
string subNum = 11;
|
||||
uint64 inviterId = 12;
|
||||
string inviterCode = 13;
|
||||
string inviterName = 14;
|
||||
}
|
||||
message OrderAddBundleRecordInfo{
|
||||
string orderAddNo = 1;
|
||||
@ -453,7 +428,6 @@ message OrderRecord {
|
||||
string expirationTime = 37 [json_name = "expirationTime"];
|
||||
string snapshot = 38 [json_name = "snapshot"];
|
||||
repeated AddInfo addInfos = 39 [json_name = "addInfos"];
|
||||
int32 reSignature = 40 [json_name = "reSignature"];
|
||||
}
|
||||
message AddInfo{
|
||||
string orderNo = 1 [json_name = "orderNo"];
|
||||
@ -603,7 +577,7 @@ message ValueAddService {
|
||||
message ValueAddServiceLang {
|
||||
string uuid = 1 [json_name = "uuid"];
|
||||
string serviceName = 2 [json_name = "serviceName"]; //服务名称
|
||||
int32 serviceType = 3 [json_name = "serviceType"]; //服务类型 1:数据分析 2:图文 3:数据报表 4:账号数 5:可用时长 6:竞品数
|
||||
int32 serviceType = 3 [json_name = "serviceType"]; //服务类型 1:数据分析 2:图文 3:数据报表 4:账号数 5:可用时长
|
||||
int32 priceMode = 4 [json_name = "priceMode"]; //套餐价格类型 1:单价 2:总价
|
||||
string originalPrice = 5 [json_name = "originalPrice"];//原单价
|
||||
string unit = 6 [json_name = "unit"];//单位 1:个 2:条 3:天 4:月 5:年 6:自然月 7:自然季度 8:半年 9:自然年
|
||||
@ -670,18 +644,17 @@ message BatchGetValueAddServiceLangResponse{
|
||||
message BundleExtendRequest{
|
||||
int64 userId = 1;
|
||||
uint32 accountAdditional = 2;
|
||||
uint32 videoAdditional = 3;//视频
|
||||
uint32 imagesAdditional = 4; //图文
|
||||
uint32 dataAdditional = 5;//数据分析
|
||||
uint32 competitiveAdditional = 6;//竞品数
|
||||
uint32 availableDurationAdditional = 7;
|
||||
uint32 timeUnit = 8; // 1 日 2 月 3年
|
||||
string remark = 9;
|
||||
string associatedorderNumber = 10;
|
||||
uint64 operatorId = 11;
|
||||
string operatorName = 12;
|
||||
string operatorPhoneNumber = 13;
|
||||
int32 type = 14;
|
||||
uint32 videoAdditional = 3;
|
||||
uint32 imagesAdditional = 4;
|
||||
uint32 dataAdditional = 5;
|
||||
uint32 availableDurationAdditional = 6;
|
||||
uint32 timeUnit = 7; // 1 日 2 月 3年
|
||||
string remark = 8;
|
||||
string associatedorderNumber = 9;
|
||||
uint64 operatorId = 10;
|
||||
string operatorName = 11;
|
||||
string operatorPhoneNumber = 12;
|
||||
int32 type = 13;
|
||||
}
|
||||
|
||||
message BundleExtendResponse{
|
||||
@ -731,7 +704,7 @@ message GetBundleBalanceListReq{
|
||||
int64 expiredTimeEnd = 8;
|
||||
int32 page = 9;
|
||||
int32 pageSize = 10;
|
||||
repeated string month = 11;
|
||||
string month = 11;
|
||||
int32 statusType = 12;
|
||||
}
|
||||
|
||||
@ -814,44 +787,24 @@ message BundleBalanceItem {
|
||||
int32 monthlyInvalidBundleDataAnalysisNumber = 57; // 当月作废套餐数据数
|
||||
int32 monthlyInvalidIncreaseDataAnalysisNumber = 58; // 当月作废增值数据数
|
||||
|
||||
// 竞品数
|
||||
int32 bundleCompetitiveNumber = 59; // 当前可用套餐竞品数
|
||||
int32 increaseCompetitiveNumber = 60; // 当前可用增值竞品数
|
||||
int32 bundleCompetitiveConsumptionNumber = 61; // 当前已用套餐竞品数
|
||||
int32 increaseCompetitiveConsumptionNumber = 62; // 当前已用增值竞品数
|
||||
int32 invalidBundleCompetitiveNumber = 63; // 当前作废套餐竞品数
|
||||
int32 invalidIncreaseCompetitiveNumber = 64; // 当前作废增值竞品数
|
||||
int32 monthlyNewBundleCompetitiveNumber = 65; // 当月新增套餐竞品数
|
||||
int32 monthlyNewIncreaseCompetitiveNumber = 66; // 当月新增增值竞品数
|
||||
int32 monthlyBundleCompetitiveNumber = 67; // 当月可用套餐竞品数
|
||||
int32 monthlyIncreaseCompetitiveNumber = 68; // 当月可用增值竞品数
|
||||
int32 monthBundleCompetitiveConsumptionNumber = 69; // 当月使用套餐竞品数
|
||||
int32 monthIncreaseCompetitiveConsumptionNumber = 70; // 当月使用增值竞品数
|
||||
int32 monthlyInvalidBundleCompetitiveNumber = 71; // 当月作废套餐竞品数
|
||||
int32 monthlyInvalidIncreaseCompetitiveNumber = 72; // 当月作废增值竞品数
|
||||
|
||||
// 手动扩展数据
|
||||
int32 monthlyNewManualAccountNumber = 73; // 当月新增手动扩展账号数
|
||||
int32 monthlyNewManualVideoNumber = 74; // 当月新增手动扩展视频数
|
||||
int32 monthlyNewManualImageNumber = 75; // 当月新增手动扩展图文数
|
||||
int32 monthlyNewManualDataAnalysisNumber = 76; // 当月新增手动扩展数据数
|
||||
int32 monthlyNewManualCompetitiveNumber = 77; // 当月新增手动扩展竞品数
|
||||
int32 monthlyNewDurationNumber = 78; // 当月新增手动扩展时长(日)
|
||||
int32 monthlyManualAccountConsumptionNumber = 79; // 当月已用手动扩展账号数
|
||||
int32 monthlyManualVideoConsumptionNumber = 80; // 当月已用手动扩展视频数
|
||||
int32 monthlyManualImageConsumptionNumber = 81; // 当月已用手动扩展图文数
|
||||
int32 monthlyManualDataAnalysisConsumptionNumber = 82; // 当月已用手动扩展数据数
|
||||
int32 monthlyManualCompetitiveConsumptionNumber = 83; // 当月已用手动扩展竞品数
|
||||
int32 manualAccountConsumptionNumber = 84; // 已用手动扩展账号数
|
||||
int32 manualVideoConsumptionNumber = 85; // 已用手动扩展视频数
|
||||
int32 manualImageConsumptionNumber = 86; // 已用手动扩展图文数
|
||||
int32 manualDataAnalysisConsumptionNumber = 87; // 已用手动扩展数据数
|
||||
int32 manualCompetitiveConsumptionNumber = 88; // 已用手动扩展竞品数
|
||||
int32 manualAccountNumber = 89; // 可用手动扩展账号数
|
||||
int32 manualVideoNumber = 90; // 可用手动扩展视频数
|
||||
int32 manualImageNumber = 91; // 可用手动扩展图文数
|
||||
int32 manualDataAnalysisNumber = 92; // 可用手动扩展数据数
|
||||
int32 manualCompetitiveNumber = 93; // 可用手动扩展竞品数
|
||||
int32 monthlyNewManualAccountNumber = 59; // 当月新增手动扩展账号数
|
||||
int32 monthlyNewManualVideoNumber = 60; // 当月新增手动扩展视频数
|
||||
int32 monthlyNewManualImageNumber = 61; // 当月新增手动扩展图文数
|
||||
int32 monthlyNewManualDataAnalysisNumber = 62; // 当月新增手动扩展数据数
|
||||
int32 monthlyNewDurationNumber = 63; // 当月新增手动扩展时长(日)
|
||||
int32 monthlyManualAccountConsumptionNumber = 64; // 当月已用手动扩展账号数
|
||||
int32 monthlyManualVideoConsumptionNumber = 65; // 当月已用手动扩展视频数
|
||||
int32 monthlyManualImageConsumptionNumber = 66; // 当月已用手动扩展图文数
|
||||
int32 monthlyManualDataAnalysisConsumptionNumber = 67; // 当月已用手动扩展数据数
|
||||
int32 manualAccountConsumptionNumber = 68; // 已用手动扩展账号数
|
||||
int32 manualVideoConsumptionNumber = 69; // 已用手动扩展视频数
|
||||
int32 manualImageConsumptionNumber = 70; // 已用手动扩展图文数
|
||||
int32 manualDataAnalysisConsumptionNumber = 71; // 已用手动扩展数据数
|
||||
int32 manualAccountNumber = 72; // 可用手动扩展账号数
|
||||
int32 manualVideoNumber = 73; // 可用手动扩展视频数
|
||||
int32 manualImageNumber = 74; // 可用手动扩展图文数
|
||||
int32 manualDataAnalysisNumber = 75; // 可用手动扩展数据数
|
||||
}
|
||||
|
||||
|
||||
@ -925,43 +878,21 @@ message BundleBalanceExportItem {
|
||||
int32 monthlyInvalidBundleDataAnalysisNumber = 57; // 当月作废套餐数据分析数
|
||||
int32 monthlyInvalidIncreaseDataAnalysisNumber = 58; // 当月作废增值数据分析数
|
||||
|
||||
// 竞品数
|
||||
int32 bundleCompetitiveNumber = 59; // 当前可用套餐竞品数
|
||||
int32 increaseCompetitiveNumber = 60; // 当前可用增值竞品数
|
||||
int32 bundleCompetitiveConsumptionNumber = 61; // 当前已用套餐竞品数
|
||||
int32 increaseCompetitiveConsumptionNumber = 62; // 当前已用增值竞品数
|
||||
int32 invalidBundleCompetitiveNumber = 63; // 当前作废套餐竞品数
|
||||
int32 invalidIncreaseCompetitiveNumber = 64; // 当前作废增值竞品数
|
||||
int32 monthlyNewBundleCompetitiveNumber = 65; // 当月新增套餐竞品数
|
||||
int32 monthlyNewIncreaseCompetitiveNumber = 66; // 当月新增增值竞品数
|
||||
int32 monthlyBundleCompetitiveNumber = 67; // 当月可用套餐竞品数
|
||||
int32 monthlyIncreaseCompetitiveNumber = 68; // 当月可用增值竞品数
|
||||
int32 monthlyBundleCompetitiveConsumptionNumber = 69; // 当月使用套餐竞品数
|
||||
int32 monthlyIncreaseCompetitiveConsumptionNumber = 70; // 当月使用增值竞品数
|
||||
int32 monthlyInvalidBundleCompetitiveNumber = 71; // 当月作废套餐竞品数
|
||||
int32 monthlyInvalidIncreaseCompetitiveNumber = 72; // 当月作废增值竞品数
|
||||
|
||||
// 手动扩展类
|
||||
int32 monthlyNewManualAccountNumber = 73; // 当月手动扩展账号新增数
|
||||
int32 monthlyNewManualVideoNumber = 74; // 当月手动扩展视频新增数
|
||||
int32 monthlyNewManualImageNumber = 75; // 当月手动扩展图文新增数
|
||||
int32 monthlyNewManualDataAnalysisNumber = 76; // 当月手动扩展数据分析新增数
|
||||
int32 monthlyNewManualCompetitiveNumber = 77; // 当月新增手动扩展竞品数
|
||||
int32 monthlyNewDurationNumber = 78; // 当月新增手动扩展时长(天)
|
||||
int32 monthlyManualAccountConsumptionNumber = 79; // 当月手动扩展账号使用数
|
||||
int32 monthlyManualVideoConsumptionNumber = 80; // 当月手动扩展视频使用数
|
||||
int32 monthlyManualImageConsumptionNumber = 81; // 当月手动扩展图文使用数
|
||||
int32 monthlyManualDataAnalysisConsumptionNumber = 82; // 当月手动扩展数据分析使用数
|
||||
int32 monthlyManualCompetitiveConsumptionNumber = 83; // 当月手动扩展竞品使用数
|
||||
|
||||
//视频当月消耗金额
|
||||
string monthlyBundleVideoConsumptionPrice = 84;//当月套餐消耗总金额
|
||||
string monthlyIncreaseVideoConsumptionPrice = 85;//当月增值消耗总金额
|
||||
int32 monthlyNewManualAccountNumber = 59; // 当月手动扩展账号新增数
|
||||
int32 monthlyNewManualVideoNumber = 60; // 当月手动扩展视频新增数
|
||||
int32 monthlyNewManualImageNumber = 61; // 当月手动扩展图文新增数
|
||||
int32 monthlyNewManualDataAnalysisNumber = 62; // 当月手动扩展数据分析新增数
|
||||
int32 monthlyNewDurationNumber = 63; // 当月新增手动扩展时长(天)
|
||||
int32 monthlyManualAccountConsumptionNumber = 64; // 当月手动扩展账号使用数
|
||||
int32 monthlyManualVideoConsumptionNumber = 65; // 当月手动扩展视频使用数
|
||||
int32 monthlyManualImageConsumptionNumber = 66; // 当月手动扩展图文使用数
|
||||
int32 monthlyManualDataAnalysisConsumptionNumber = 67; // 当月手动扩展数据分析使用数
|
||||
}
|
||||
|
||||
|
||||
message BundleBalanceExportReq{
|
||||
repeated string month = 1;
|
||||
string month = 1;
|
||||
string userName = 2;
|
||||
uint64 expiredTimeStart = 3;
|
||||
uint64 expiredTimeEnd = 4;
|
||||
@ -1009,9 +940,7 @@ message AddBundleBalanceReq{
|
||||
int32 imageConsumptionNumber = 9;
|
||||
int32 dataAnalysisNumber = 10;
|
||||
int32 dataAnalysisConsumptionNumber = 11;
|
||||
int32 competitiveNumber = 12;
|
||||
int32 competitiveConsumptionNumber = 13;
|
||||
int32 expansionPacksNumber = 14;
|
||||
int32 expansionPacksNumber = 12;
|
||||
}
|
||||
|
||||
message AddBundleBalanceResp{
|
||||
@ -1106,8 +1035,6 @@ message ToBeComfirmedWorksResp{
|
||||
repeated workItem data = 3;
|
||||
}
|
||||
|
||||
|
||||
|
||||
message GetBundleBalanceByUserIdReq{
|
||||
int32 userId = 1;
|
||||
}
|
||||
@ -1116,36 +1043,24 @@ message GetBundleBalanceByUserIdResp{
|
||||
string orderUUID = 1;
|
||||
string bundleUuid = 2; // 套餐ID uuid
|
||||
string bundleName = 3; // 套餐名称
|
||||
int32 bundleStatus = 4; // 套餐状态是否过期 1 是 0 否
|
||||
string bundleStatus = 4; // 套餐名称
|
||||
int64 payTime = 5;
|
||||
int64 expiredTime = 6;
|
||||
string paymentAmount = 7;
|
||||
int32 paymentType = 8;
|
||||
int32 accountNumber = 9;
|
||||
int32 accountExtendNumber = 10;
|
||||
int32 accountAdditional = 11;
|
||||
int32 accountConsumptionNumber = 12;
|
||||
int32 videoNumber = 13;
|
||||
int32 videoExtendNumber = 14;
|
||||
int32 videoExtendConsumptionNumber = 15;
|
||||
int32 videoAdditional = 16;
|
||||
int32 videoConsumptionNumber = 17;
|
||||
int32 imageNumber = 18;
|
||||
int32 imageExtendNumber = 19;
|
||||
int32 imageExtendConsumptionNumber = 20;
|
||||
int32 imageAdditional = 21;
|
||||
int32 imageConsumptionNumber = 22;
|
||||
int32 dataAnalysisNumber = 23;
|
||||
int32 dataAnalysisExtendNumber = 24;
|
||||
int32 dataAnalysisExtendConsumptionNumber = 25;
|
||||
int32 dataAnalysisAdditional = 26;
|
||||
int32 dataAnalysisConsumptionNumber = 27;
|
||||
int32 competitiveNumber = 28;
|
||||
int32 competitiveExtendNumber = 29;
|
||||
int32 competitiveExtendConsumptionNumber = 30;
|
||||
int32 competitiveAdditional = 31;
|
||||
int32 competitiveConsumptionNumber = 32;
|
||||
int32 expansionPacksNumber = 33;
|
||||
int32 accountNumber = 9;
|
||||
int32 accountAdditional = 10;
|
||||
int32 accountConsumptionNumber = 11;
|
||||
int32 videoNumber = 12;
|
||||
int32 videoAdditional = 13;
|
||||
int32 videoConsumptionNumber = 14;
|
||||
int32 imageNumber = 15;
|
||||
int32 imageAdditional = 16;
|
||||
int32 imageConsumptionNumber = 17;
|
||||
int32 dataAnalysisNumber = 18;
|
||||
int32 dataAnalysisAdditional = 19;
|
||||
int32 dataAnalysisConsumptionNumber = 20;
|
||||
int32 expansionPacksNumber = 21;
|
||||
}
|
||||
|
||||
message OnlyAddValueListByOrderNoRequest{
|
||||
@ -1178,20 +1093,6 @@ message ConfirmWorkResp{
|
||||
|
||||
}
|
||||
|
||||
message ConfirmWorkItem{
|
||||
string workUuid = 1;
|
||||
string artistName = 2;
|
||||
string artistUuid = 3;
|
||||
int32 workCategory = 4;
|
||||
}
|
||||
|
||||
message GetWaitConfirmWorkListReq{}
|
||||
|
||||
message GetWaitConfirmWorkListResp{
|
||||
repeated ConfirmWorkItem data = 1;
|
||||
}
|
||||
|
||||
|
||||
message AutoCreateUserAndOrderRequest {
|
||||
int32 num = 1; // 处理数量
|
||||
}
|
||||
@ -1220,7 +1121,6 @@ message UnfinishedInfo {
|
||||
string orderPayCurrency = 17;
|
||||
string orderAccountCurrency = 18;
|
||||
string payTime = 19;
|
||||
string cardNum = 20;
|
||||
}
|
||||
|
||||
message SoftDeleteUnfinishedInfoRequest {
|
||||
@ -1633,23 +1533,6 @@ message GetPendingTaskLayoutResp{ string data = 1; }
|
||||
message SetPendingTaskLayoutReq{ string data = 1; }
|
||||
message SetPendingTaskLayoutResp{}
|
||||
|
||||
// 创建任务日志请求
|
||||
message CreateTaskWorkLogRequest {
|
||||
string assignRecordsUUID = 1 [json_name = "assignRecordsUUID"]; // 任务指派记录UUID(必填)
|
||||
string workUUID = 2 [json_name = "workUUID"]; // 任务作品UUID(必填)
|
||||
string title = 3 [json_name = "title"]; // 任务作品标题
|
||||
string artistUUID = 4 [json_name = "artistUUID"]; // 任务艺人UUID
|
||||
string subNum = 5 [json_name = "subNum"]; // 任务用户编号(必填)
|
||||
string telNum = 6 [json_name = "telNum"]; // 任务用户手机号(必填)
|
||||
string artistName = 7 [json_name = "artistName"]; // 任务艺人名称
|
||||
int32 operationType = 8 [json_name = "operationType"]; // 任务操作类型 1:加任务 2:消耗任务 3:完成任务 4:任务过期(必填)
|
||||
int32 taskType = 9 [json_name = "taskType"]; // 任务类型 1:视频 2:图片 3:数据分析(必填)
|
||||
int32 taskCount = 10 [json_name = "taskCount"]; // 任务数量(必填)
|
||||
string remark = 11 [json_name = "remark"]; // 任务备注
|
||||
string operatorName = 12 [json_name = "operatorName"]; // 任务操作人姓名
|
||||
string operatorNum = 13 [json_name = "operatorNum"]; // 任务操作人账号
|
||||
}
|
||||
|
||||
message MetricsBusinessReq{
|
||||
string bundleUuid = 1;
|
||||
string start = 2;
|
||||
@ -1664,11 +1547,11 @@ message MetricsBusinessResp {
|
||||
string finalPaymentAmount = 4; // 合计结算金额
|
||||
string totalFeePaymentAmount = 5; // 合计手续费
|
||||
|
||||
string newBundlePaymentAmount = 6; // 新增套餐购买金额
|
||||
string newIncreasePaymentAmount = 7; // 新增增值服务金额
|
||||
string newPaymentAmount = 8; // 新增支付金额
|
||||
string newFinalPaymentAmount = 9; // 新增结算金额
|
||||
string newFeePaymentAmount = 10; // 新增手续费
|
||||
float newBundlePaymentAmount = 6; // 新增套餐购买金额
|
||||
float newIncreasePaymentAmount = 7; // 新增增值服务金额
|
||||
float newPaymentAmount = 8; // 新增支付金额
|
||||
float newFinalPaymentAmount = 9; // 新增结算金额
|
||||
float newFeePaymentAmount = 10; // 新增手续费
|
||||
|
||||
// ====== 套餐统计 ======
|
||||
int64 newBundleCount = 11; // 新购买套餐数
|
||||
@ -1703,11 +1586,6 @@ message MetricsBusinessResp {
|
||||
int64 newUploadedDataAnalysisCount = 30; // 新增已上传的数据分析数
|
||||
int64 newPendingUploadDataAnalysisCount = 31; // 新增待上传的数据分析数
|
||||
int64 totalPendingUploadDataAnalysisCount = 32; // 总待上传的数据分析数
|
||||
|
||||
// ====== 竞品数统计 ======
|
||||
int64 newUploadedCompetitiveCount = 33; // 新增已上传的竞品数
|
||||
int64 newPendingUploadCompetitiveCount = 34; // 新增待上传的竞品数
|
||||
int64 totalPendingUploadCompetitiveCount = 35; // 总待上传的竞品数
|
||||
}
|
||||
|
||||
|
||||
@ -1752,16 +1630,6 @@ message MetricsOperatingCreateResp {
|
||||
int64 newUploadedIncreaseDataAnalysisCount = 26; // 新增已做增值数据数
|
||||
int64 totalUploadedBundleDataAnalysisCount = 27; // 总已做套餐数据数截止
|
||||
int64 totalUploadedIncreaseDataAnalysisCount = 28; // 总已做增值数据数截止
|
||||
|
||||
// ======================== 套餐/增值竞品数 ========================
|
||||
int64 newPendingUploadBundleCompetitiveCount = 29; // 新增待上传套餐竞品数
|
||||
int64 newPendingUploadIncreaseCompetitiveCount = 30; // 新增待上传增值竞品数
|
||||
int64 totalPendingUploadBundleCompetitiveCount = 31; // 总待上传套餐竞品数截止
|
||||
int64 totalPendingUploadIncreaseCompetitiveCount = 32; // 总待上传增值竞品数截止
|
||||
int64 newUploadedBundleCompetitiveCount = 33; // 新增已上传套餐竞品数
|
||||
int64 newUploadedIncreaseCompetitiveCount = 34; // 新增已上传增值竞品数
|
||||
int64 totalUploadedBundleCompetitiveCount = 35; // 总已上传套餐竞品数截止
|
||||
int64 totalUploadedIncreaseCompetitiveCount = 36; // 总已上传增值竞品数截止
|
||||
}
|
||||
|
||||
message MetricsOperatingStatusReq{
|
||||
@ -1799,24 +1667,12 @@ message MetricsOperatingStatusResp {
|
||||
int64 autoConfirmDataAnalysisCount = 23;// 系统已自动确认数据数
|
||||
int64 pendingUploadDataAnalysisCount = 24;// 待发布数据数
|
||||
int64 uploadSuccessDataAnalysisCount = 25;// 发布成功数据数
|
||||
int64 uploadFailedDataAnalysisCount = 26;// 发布异常数据数
|
||||
|
||||
// ===== 竞品数 =====
|
||||
int64 reviewingCompetitiveCount = 27; // 审核中竞品数
|
||||
int64 rejectCompetitiveCount = 28; // 已驳回竞品数
|
||||
int64 waitConfirmCompetitiveCount = 29; // 待艺人确认竞品数
|
||||
int64 artistConfirmCompetitiveCount = 30; // 艺人已验收确认竞品数
|
||||
int64 autoConfirmCompetitiveCount = 31; // 系统已自动确认竞品数
|
||||
int64 pendingUploadCompetitiveCount = 32; // 待发布竞品数
|
||||
int64 uploadSuccessCompetitiveCount = 33; // 发布成功竞品数
|
||||
int64 uploadFailedCompetitiveCount = 34; // 发布异常竞品数
|
||||
|
||||
int64 abnormalAccountAcount = 35; // 触发预警的账号数
|
||||
int64 abnormalAccountAcount = 26; // 触发预警的账号数
|
||||
}
|
||||
|
||||
message MetricsBundlePurchaseExportReq{
|
||||
string month = 1;//月份
|
||||
string endTime = 2;//结时间
|
||||
string month = 1;
|
||||
}
|
||||
|
||||
message MetricsBundlePurchaseExportResp{
|
||||
@ -1824,23 +1680,24 @@ message MetricsBundlePurchaseExportResp{
|
||||
}
|
||||
|
||||
message MetricsBundlePurchaseItem{
|
||||
string orderNo = 1;//订单编号
|
||||
string bundleName = 2;//套餐名称
|
||||
string userNum = 3;//用户编号
|
||||
string userName = 4;//客户名称
|
||||
string phoneNumber = 5;//手机号
|
||||
string payTime = 6;//支付时间
|
||||
int64 increaseVideoCount = 7;//增值服务视频数量
|
||||
float bundleAmount = 8;//套餐金额
|
||||
float increaseAmount = 9;//增值服务金额
|
||||
float paymentAmount = 10;//支付金额
|
||||
float finalAmount = 11;//结算金额
|
||||
float feeAmount = 12;//手续费
|
||||
int64 rate = 13;//汇率
|
||||
string orderNo = 1;
|
||||
string bundleName = 2;
|
||||
string userNum = 3;
|
||||
string userName = 4;
|
||||
string phoneNumber = 5;
|
||||
string payTime = 6;
|
||||
int64 bundleVideoCount = 7;
|
||||
int64 increaseVideoCount = 8;
|
||||
float bundleAmount = 9;
|
||||
float increaseAmount = 10;
|
||||
float paymentAmount = 11;
|
||||
float finalAmount = 12;
|
||||
float feeAmount = 13;
|
||||
int64 rate = 14;
|
||||
}
|
||||
|
||||
message MetricsArtistAccountExportReq{
|
||||
repeated string month = 1;
|
||||
string month = 1;
|
||||
}
|
||||
|
||||
message MetricsArtistAccountExportResp{
|
||||
@ -1852,25 +1709,18 @@ message MetricsArtistAccountExportItem{
|
||||
string userNum = 2;
|
||||
string dmAccount = 3;
|
||||
string dmNickname = 4;
|
||||
int32 dmAuthStatus = 5;
|
||||
string instagramAccount = 6;
|
||||
string instagramNickname = 7;
|
||||
int32 insAuthStatus = 8;
|
||||
string tiktokAccount = 9;
|
||||
string tiktokNickname = 10;
|
||||
int32 tiktokAuthStatus = 11;
|
||||
string youtubeAccount = 12;
|
||||
string youtubeNickname = 13;
|
||||
int32 youtubeAuthStatus = 14;
|
||||
string blueskyAccount = 15;
|
||||
string blueskyNickname = 16;
|
||||
int32 blueskyAuthStatus = 17;
|
||||
// string youtubeAccount = 3; 现在没有YouTube了
|
||||
// string youtubeNickname = 4;
|
||||
string instagramAccount = 5;
|
||||
string instagramNickname = 6;
|
||||
string tiktokAccount = 7;
|
||||
string tiktokNickname = 8;
|
||||
}
|
||||
|
||||
|
||||
|
||||
message MetricsVideoSubmitExportReq{
|
||||
repeated string month = 1;
|
||||
string month = 1;
|
||||
}
|
||||
|
||||
message MetricsVideoSubmitExportResp{
|
||||
@ -1890,25 +1740,3 @@ message MetricsVideoSubmitExportItem {
|
||||
message MetricsBalanceDetailExportReq{
|
||||
string month = 1;
|
||||
}
|
||||
|
||||
message WorkCastInfo{
|
||||
string customerName = 1;
|
||||
string customerNum = 2;
|
||||
string bundleName = 3;
|
||||
string signedTime = 4;
|
||||
string title = 5;
|
||||
int64 costType = 6;
|
||||
int64 workCategory = 7;
|
||||
string submitTime = 8;
|
||||
string waitingTime = 9;
|
||||
string confirmTime = 10;
|
||||
}
|
||||
|
||||
message ExportWorkCastInfoReq{
|
||||
string startTime = 1;
|
||||
string endTime = 2;
|
||||
}
|
||||
|
||||
message ExportWorkCastInfoResp{
|
||||
repeated WorkCastInfo data = 1;
|
||||
}
|
||||
10868
pb/bundle/bundle.pb.go
10868
pb/bundle/bundle.pb.go
File diff suppressed because it is too large
Load Diff
@ -17,32 +17,6 @@ var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
func (this *QueryTheOrderSnapshotInformationReq) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *QueryTheOrderSnapshotInformationResp) Validate() error {
|
||||
for _, item := range this.BundleOrder {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("BundleOrder", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, item := range this.AddBundleOrder {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("AddBundleOrder", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *ServiceInformation) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *ReSignTheContractRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *DeleteValueAddServiceRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
@ -509,22 +483,6 @@ func (this *ConfirmWorkReq) Validate() error {
|
||||
func (this *ConfirmWorkResp) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *ConfirmWorkItem) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *GetWaitConfirmWorkListReq) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *GetWaitConfirmWorkListResp) Validate() error {
|
||||
for _, item := range this.Data {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Data", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *AutoCreateUserAndOrderRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
@ -740,9 +698,6 @@ func (this *SetPendingTaskLayoutReq) Validate() error {
|
||||
func (this *SetPendingTaskLayoutResp) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *CreateTaskWorkLogRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *MetricsBusinessReq) Validate() error {
|
||||
return nil
|
||||
}
|
||||
@ -812,19 +767,3 @@ func (this *MetricsVideoSubmitExportItem) Validate() error {
|
||||
func (this *MetricsBalanceDetailExportReq) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *WorkCastInfo) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *ExportWorkCastInfoReq) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *ExportWorkCastInfoResp) Validate() error {
|
||||
for _, item := range this.Data {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Data", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-triple v1.0.5
|
||||
// - protoc v5.26.0
|
||||
// - protoc-gen-go-triple v1.0.8
|
||||
// - protoc v3.21.1
|
||||
// source: pb/bundle.proto
|
||||
|
||||
package bundle
|
||||
@ -50,7 +50,6 @@ type BundleClient interface {
|
||||
OrderRecordsListV2(ctx context.Context, in *OrderRecordsRequestV2, opts ...grpc_go.CallOption) (*OrderRecordsResponseV2, common.ErrorWithAttachment)
|
||||
OrderListByOrderNo(ctx context.Context, in *OrderInfoByOrderNoRequest, opts ...grpc_go.CallOption) (*OrderInfoByOrderNoResp, common.ErrorWithAttachment)
|
||||
OnlyAddValueListByOrderNo(ctx context.Context, in *OnlyAddValueListByOrderNoRequest, opts ...grpc_go.CallOption) (*OnlyAddValueListByOrderNoResp, common.ErrorWithAttachment)
|
||||
ReSignTheContract(ctx context.Context, in *ReSignTheContractRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
|
||||
// 增值套餐
|
||||
CreateValueAddBundle(ctx context.Context, in *CreateValueAddBundleRequest, opts ...grpc_go.CallOption) (*CreateValueAddBundleResponse, common.ErrorWithAttachment)
|
||||
ValueAddBundleList(ctx context.Context, in *ValueAddBundleListRequest, opts ...grpc_go.CallOption) (*ValueAddBundleListResponse, common.ErrorWithAttachment)
|
||||
@ -80,7 +79,6 @@ type BundleClient interface {
|
||||
GetVedioWorkDetail(ctx context.Context, in *GetVedioWorkDetailReq, opts ...grpc_go.CallOption) (*GetVedioeWorkDetailResp, common.ErrorWithAttachment)
|
||||
ToBeComfirmedWorks(ctx context.Context, in *ToBeComfirmedWorksReq, opts ...grpc_go.CallOption) (*ToBeComfirmedWorksResp, common.ErrorWithAttachment)
|
||||
ConfirmWork(ctx context.Context, in *ConfirmWorkReq, opts ...grpc_go.CallOption) (*ConfirmWorkResp, common.ErrorWithAttachment)
|
||||
GetWaitConfirmWorkList(ctx context.Context, in *GetWaitConfirmWorkListReq, opts ...grpc_go.CallOption) (*GetWaitConfirmWorkListResp, common.ErrorWithAttachment)
|
||||
// 对账单
|
||||
GetReconciliationList(ctx context.Context, in *GetReconciliationListReq, opts ...grpc_go.CallOption) (*GetReconciliationListResp, common.ErrorWithAttachment)
|
||||
CreateReconciliation(ctx context.Context, in *ReconciliationInfo, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
|
||||
@ -110,7 +108,6 @@ type BundleClient interface {
|
||||
GetPendingAssign(ctx context.Context, in *PendingAssignRequest, opts ...grpc_go.CallOption) (*PendingAssignResponse, common.ErrorWithAttachment)
|
||||
RevertTaskCompletionByUUIDItem(ctx context.Context, in *RevertTaskCompletionByUUIDItemRequest, opts ...grpc_go.CallOption) (*ComResponse, common.ErrorWithAttachment)
|
||||
AddHiddenTaskAssignee(ctx context.Context, in *AddHiddenTaskAssigneeRequest, opts ...grpc_go.CallOption) (*ComResponse, common.ErrorWithAttachment)
|
||||
CreateTaskWorkLog(ctx context.Context, in *CreateTaskWorkLogRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
|
||||
// 数据指标
|
||||
MetricsBusiness(ctx context.Context, in *MetricsBusinessReq, opts ...grpc_go.CallOption) (*MetricsBusinessResp, common.ErrorWithAttachment)
|
||||
MetricsOperatingCreate(ctx context.Context, in *MetricsOperatingCreateReq, opts ...grpc_go.CallOption) (*MetricsOperatingCreateResp, common.ErrorWithAttachment)
|
||||
@ -118,9 +115,6 @@ type BundleClient interface {
|
||||
MetricsBundlePurchaseExport(ctx context.Context, in *MetricsBundlePurchaseExportReq, opts ...grpc_go.CallOption) (*MetricsBundlePurchaseExportResp, common.ErrorWithAttachment)
|
||||
MetricsArtistAccountExport(ctx context.Context, in *MetricsArtistAccountExportReq, opts ...grpc_go.CallOption) (*MetricsArtistAccountExportResp, common.ErrorWithAttachment)
|
||||
MetricsVideoSubmitExport(ctx context.Context, in *MetricsVideoSubmitExportReq, opts ...grpc_go.CallOption) (*MetricsVideoSubmitExportResp, common.ErrorWithAttachment)
|
||||
QueryTheOrderSnapshotInformation(ctx context.Context, in *QueryTheOrderSnapshotInformationReq, opts ...grpc_go.CallOption) (*QueryTheOrderSnapshotInformationResp, common.ErrorWithAttachment)
|
||||
// 临时接口
|
||||
ExportWorkCastInfo(ctx context.Context, in *ExportWorkCastInfoReq, opts ...grpc_go.CallOption) (*ExportWorkCastInfoResp, common.ErrorWithAttachment)
|
||||
}
|
||||
|
||||
type bundleClient struct {
|
||||
@ -150,7 +144,6 @@ type BundleClientImpl struct {
|
||||
OrderRecordsListV2 func(ctx context.Context, in *OrderRecordsRequestV2) (*OrderRecordsResponseV2, error)
|
||||
OrderListByOrderNo func(ctx context.Context, in *OrderInfoByOrderNoRequest) (*OrderInfoByOrderNoResp, error)
|
||||
OnlyAddValueListByOrderNo func(ctx context.Context, in *OnlyAddValueListByOrderNoRequest) (*OnlyAddValueListByOrderNoResp, error)
|
||||
ReSignTheContract func(ctx context.Context, in *ReSignTheContractRequest) (*CommonResponse, error)
|
||||
CreateValueAddBundle func(ctx context.Context, in *CreateValueAddBundleRequest) (*CreateValueAddBundleResponse, error)
|
||||
ValueAddBundleList func(ctx context.Context, in *ValueAddBundleListRequest) (*ValueAddBundleListResponse, error)
|
||||
ValueAddBundleDetail func(ctx context.Context, in *ValueAddBundleDetailRequest) (*ValueAddBundleDetailResponse, error)
|
||||
@ -176,7 +169,6 @@ type BundleClientImpl struct {
|
||||
GetVedioWorkDetail func(ctx context.Context, in *GetVedioWorkDetailReq) (*GetVedioeWorkDetailResp, error)
|
||||
ToBeComfirmedWorks func(ctx context.Context, in *ToBeComfirmedWorksReq) (*ToBeComfirmedWorksResp, error)
|
||||
ConfirmWork func(ctx context.Context, in *ConfirmWorkReq) (*ConfirmWorkResp, error)
|
||||
GetWaitConfirmWorkList func(ctx context.Context, in *GetWaitConfirmWorkListReq) (*GetWaitConfirmWorkListResp, error)
|
||||
GetReconciliationList func(ctx context.Context, in *GetReconciliationListReq) (*GetReconciliationListResp, error)
|
||||
CreateReconciliation func(ctx context.Context, in *ReconciliationInfo) (*CommonResponse, error)
|
||||
UpdateReconciliation func(ctx context.Context, in *ReconciliationInfo) (*CommonResponse, error)
|
||||
@ -203,15 +195,12 @@ type BundleClientImpl struct {
|
||||
GetPendingAssign func(ctx context.Context, in *PendingAssignRequest) (*PendingAssignResponse, error)
|
||||
RevertTaskCompletionByUUIDItem func(ctx context.Context, in *RevertTaskCompletionByUUIDItemRequest) (*ComResponse, error)
|
||||
AddHiddenTaskAssignee func(ctx context.Context, in *AddHiddenTaskAssigneeRequest) (*ComResponse, error)
|
||||
CreateTaskWorkLog func(ctx context.Context, in *CreateTaskWorkLogRequest) (*CommonResponse, error)
|
||||
MetricsBusiness func(ctx context.Context, in *MetricsBusinessReq) (*MetricsBusinessResp, error)
|
||||
MetricsOperatingCreate func(ctx context.Context, in *MetricsOperatingCreateReq) (*MetricsOperatingCreateResp, error)
|
||||
MetricsOperatingStatus func(ctx context.Context, in *MetricsOperatingStatusReq) (*MetricsOperatingStatusResp, error)
|
||||
MetricsBundlePurchaseExport func(ctx context.Context, in *MetricsBundlePurchaseExportReq) (*MetricsBundlePurchaseExportResp, error)
|
||||
MetricsArtistAccountExport func(ctx context.Context, in *MetricsArtistAccountExportReq) (*MetricsArtistAccountExportResp, error)
|
||||
MetricsVideoSubmitExport func(ctx context.Context, in *MetricsVideoSubmitExportReq) (*MetricsVideoSubmitExportResp, error)
|
||||
QueryTheOrderSnapshotInformation func(ctx context.Context, in *QueryTheOrderSnapshotInformationReq) (*QueryTheOrderSnapshotInformationResp, error)
|
||||
ExportWorkCastInfo func(ctx context.Context, in *ExportWorkCastInfoReq) (*ExportWorkCastInfoResp, error)
|
||||
}
|
||||
|
||||
func (c *BundleClientImpl) GetDubboStub(cc *triple.TripleConn) BundleClient {
|
||||
@ -358,12 +347,6 @@ func (c *bundleClient) OnlyAddValueListByOrderNo(ctx context.Context, in *OnlyAd
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/OnlyAddValueListByOrderNo", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) ReSignTheContract(ctx context.Context, in *ReSignTheContractRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment) {
|
||||
out := new(CommonResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/ReSignTheContract", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) CreateValueAddBundle(ctx context.Context, in *CreateValueAddBundleRequest, opts ...grpc_go.CallOption) (*CreateValueAddBundleResponse, common.ErrorWithAttachment) {
|
||||
out := new(CreateValueAddBundleResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
@ -514,12 +497,6 @@ func (c *bundleClient) ConfirmWork(ctx context.Context, in *ConfirmWorkReq, opts
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/ConfirmWork", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) GetWaitConfirmWorkList(ctx context.Context, in *GetWaitConfirmWorkListReq, opts ...grpc_go.CallOption) (*GetWaitConfirmWorkListResp, common.ErrorWithAttachment) {
|
||||
out := new(GetWaitConfirmWorkListResp)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetWaitConfirmWorkList", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) GetReconciliationList(ctx context.Context, in *GetReconciliationListReq, opts ...grpc_go.CallOption) (*GetReconciliationListResp, common.ErrorWithAttachment) {
|
||||
out := new(GetReconciliationListResp)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
@ -676,12 +653,6 @@ func (c *bundleClient) AddHiddenTaskAssignee(ctx context.Context, in *AddHiddenT
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/AddHiddenTaskAssignee", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) CreateTaskWorkLog(ctx context.Context, in *CreateTaskWorkLogRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment) {
|
||||
out := new(CommonResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/CreateTaskWorkLog", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) MetricsBusiness(ctx context.Context, in *MetricsBusinessReq, opts ...grpc_go.CallOption) (*MetricsBusinessResp, common.ErrorWithAttachment) {
|
||||
out := new(MetricsBusinessResp)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
@ -718,18 +689,6 @@ func (c *bundleClient) MetricsVideoSubmitExport(ctx context.Context, in *Metrics
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/MetricsVideoSubmitExport", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) QueryTheOrderSnapshotInformation(ctx context.Context, in *QueryTheOrderSnapshotInformationReq, opts ...grpc_go.CallOption) (*QueryTheOrderSnapshotInformationResp, common.ErrorWithAttachment) {
|
||||
out := new(QueryTheOrderSnapshotInformationResp)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/QueryTheOrderSnapshotInformation", in, out)
|
||||
}
|
||||
|
||||
func (c *bundleClient) ExportWorkCastInfo(ctx context.Context, in *ExportWorkCastInfoReq, opts ...grpc_go.CallOption) (*ExportWorkCastInfoResp, common.ErrorWithAttachment) {
|
||||
out := new(ExportWorkCastInfoResp)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/ExportWorkCastInfo", in, out)
|
||||
}
|
||||
|
||||
// BundleServer is the server API for Bundle service.
|
||||
// All implementations must embed UnimplementedBundleServer
|
||||
// for forward compatibility
|
||||
@ -756,7 +715,6 @@ type BundleServer interface {
|
||||
OrderRecordsListV2(context.Context, *OrderRecordsRequestV2) (*OrderRecordsResponseV2, error)
|
||||
OrderListByOrderNo(context.Context, *OrderInfoByOrderNoRequest) (*OrderInfoByOrderNoResp, error)
|
||||
OnlyAddValueListByOrderNo(context.Context, *OnlyAddValueListByOrderNoRequest) (*OnlyAddValueListByOrderNoResp, error)
|
||||
ReSignTheContract(context.Context, *ReSignTheContractRequest) (*CommonResponse, error)
|
||||
// 增值套餐
|
||||
CreateValueAddBundle(context.Context, *CreateValueAddBundleRequest) (*CreateValueAddBundleResponse, error)
|
||||
ValueAddBundleList(context.Context, *ValueAddBundleListRequest) (*ValueAddBundleListResponse, error)
|
||||
@ -786,7 +744,6 @@ type BundleServer interface {
|
||||
GetVedioWorkDetail(context.Context, *GetVedioWorkDetailReq) (*GetVedioeWorkDetailResp, error)
|
||||
ToBeComfirmedWorks(context.Context, *ToBeComfirmedWorksReq) (*ToBeComfirmedWorksResp, error)
|
||||
ConfirmWork(context.Context, *ConfirmWorkReq) (*ConfirmWorkResp, error)
|
||||
GetWaitConfirmWorkList(context.Context, *GetWaitConfirmWorkListReq) (*GetWaitConfirmWorkListResp, error)
|
||||
// 对账单
|
||||
GetReconciliationList(context.Context, *GetReconciliationListReq) (*GetReconciliationListResp, error)
|
||||
CreateReconciliation(context.Context, *ReconciliationInfo) (*CommonResponse, error)
|
||||
@ -816,7 +773,6 @@ type BundleServer interface {
|
||||
GetPendingAssign(context.Context, *PendingAssignRequest) (*PendingAssignResponse, error)
|
||||
RevertTaskCompletionByUUIDItem(context.Context, *RevertTaskCompletionByUUIDItemRequest) (*ComResponse, error)
|
||||
AddHiddenTaskAssignee(context.Context, *AddHiddenTaskAssigneeRequest) (*ComResponse, error)
|
||||
CreateTaskWorkLog(context.Context, *CreateTaskWorkLogRequest) (*CommonResponse, error)
|
||||
// 数据指标
|
||||
MetricsBusiness(context.Context, *MetricsBusinessReq) (*MetricsBusinessResp, error)
|
||||
MetricsOperatingCreate(context.Context, *MetricsOperatingCreateReq) (*MetricsOperatingCreateResp, error)
|
||||
@ -824,9 +780,6 @@ type BundleServer interface {
|
||||
MetricsBundlePurchaseExport(context.Context, *MetricsBundlePurchaseExportReq) (*MetricsBundlePurchaseExportResp, error)
|
||||
MetricsArtistAccountExport(context.Context, *MetricsArtistAccountExportReq) (*MetricsArtistAccountExportResp, error)
|
||||
MetricsVideoSubmitExport(context.Context, *MetricsVideoSubmitExportReq) (*MetricsVideoSubmitExportResp, error)
|
||||
QueryTheOrderSnapshotInformation(context.Context, *QueryTheOrderSnapshotInformationReq) (*QueryTheOrderSnapshotInformationResp, error)
|
||||
// 临时接口
|
||||
ExportWorkCastInfo(context.Context, *ExportWorkCastInfoReq) (*ExportWorkCastInfoResp, error)
|
||||
mustEmbedUnimplementedBundleServer()
|
||||
}
|
||||
|
||||
@ -901,9 +854,6 @@ func (UnimplementedBundleServer) OrderListByOrderNo(context.Context, *OrderInfoB
|
||||
func (UnimplementedBundleServer) OnlyAddValueListByOrderNo(context.Context, *OnlyAddValueListByOrderNoRequest) (*OnlyAddValueListByOrderNoResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method OnlyAddValueListByOrderNo not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) ReSignTheContract(context.Context, *ReSignTheContractRequest) (*CommonResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ReSignTheContract not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) CreateValueAddBundle(context.Context, *CreateValueAddBundleRequest) (*CreateValueAddBundleResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CreateValueAddBundle not implemented")
|
||||
}
|
||||
@ -979,9 +929,6 @@ func (UnimplementedBundleServer) ToBeComfirmedWorks(context.Context, *ToBeComfir
|
||||
func (UnimplementedBundleServer) ConfirmWork(context.Context, *ConfirmWorkReq) (*ConfirmWorkResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ConfirmWork not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) GetWaitConfirmWorkList(context.Context, *GetWaitConfirmWorkListReq) (*GetWaitConfirmWorkListResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetWaitConfirmWorkList not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) GetReconciliationList(context.Context, *GetReconciliationListReq) (*GetReconciliationListResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetReconciliationList not implemented")
|
||||
}
|
||||
@ -1060,9 +1007,6 @@ func (UnimplementedBundleServer) RevertTaskCompletionByUUIDItem(context.Context,
|
||||
func (UnimplementedBundleServer) AddHiddenTaskAssignee(context.Context, *AddHiddenTaskAssigneeRequest) (*ComResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method AddHiddenTaskAssignee not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) CreateTaskWorkLog(context.Context, *CreateTaskWorkLogRequest) (*CommonResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CreateTaskWorkLog not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) MetricsBusiness(context.Context, *MetricsBusinessReq) (*MetricsBusinessResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method MetricsBusiness not implemented")
|
||||
}
|
||||
@ -1081,12 +1025,6 @@ func (UnimplementedBundleServer) MetricsArtistAccountExport(context.Context, *Me
|
||||
func (UnimplementedBundleServer) MetricsVideoSubmitExport(context.Context, *MetricsVideoSubmitExportReq) (*MetricsVideoSubmitExportResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method MetricsVideoSubmitExport not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) QueryTheOrderSnapshotInformation(context.Context, *QueryTheOrderSnapshotInformationReq) (*QueryTheOrderSnapshotInformationResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method QueryTheOrderSnapshotInformation not implemented")
|
||||
}
|
||||
func (UnimplementedBundleServer) ExportWorkCastInfo(context.Context, *ExportWorkCastInfoReq) (*ExportWorkCastInfoResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ExportWorkCastInfo not implemented")
|
||||
}
|
||||
func (s *UnimplementedBundleServer) XXX_SetProxyImpl(impl protocol.Invoker) {
|
||||
s.proxyImpl = impl
|
||||
}
|
||||
@ -1753,35 +1691,6 @@ func _Bundle_OnlyAddValueListByOrderNo_Handler(srv interface{}, ctx context.Cont
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Bundle_ReSignTheContract_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ReSignTheContractRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("ReSignTheContract", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Bundle_CreateValueAddBundle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CreateValueAddBundleRequest)
|
||||
if err := dec(in); err != nil {
|
||||
@ -2507,35 +2416,6 @@ func _Bundle_ConfirmWork_Handler(srv interface{}, ctx context.Context, dec func(
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Bundle_GetWaitConfirmWorkList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetWaitConfirmWorkListReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("GetWaitConfirmWorkList", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Bundle_GetReconciliationList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetReconciliationListReq)
|
||||
if err := dec(in); err != nil {
|
||||
@ -3290,35 +3170,6 @@ func _Bundle_AddHiddenTaskAssignee_Handler(srv interface{}, ctx context.Context,
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Bundle_CreateTaskWorkLog_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CreateTaskWorkLogRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("CreateTaskWorkLog", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Bundle_MetricsBusiness_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(MetricsBusinessReq)
|
||||
if err := dec(in); err != nil {
|
||||
@ -3493,64 +3344,6 @@ func _Bundle_MetricsVideoSubmitExport_Handler(srv interface{}, ctx context.Conte
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Bundle_QueryTheOrderSnapshotInformation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QueryTheOrderSnapshotInformationReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("QueryTheOrderSnapshotInformation", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Bundle_ExportWorkCastInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ExportWorkCastInfoReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("ExportWorkCastInfo", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Bundle_ServiceDesc is the grpc_go.ServiceDesc for Bundle service.
|
||||
// It's only intended for direct use with grpc_go.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
@ -3646,10 +3439,6 @@ var Bundle_ServiceDesc = grpc_go.ServiceDesc{
|
||||
MethodName: "OnlyAddValueListByOrderNo",
|
||||
Handler: _Bundle_OnlyAddValueListByOrderNo_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ReSignTheContract",
|
||||
Handler: _Bundle_ReSignTheContract_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "CreateValueAddBundle",
|
||||
Handler: _Bundle_CreateValueAddBundle_Handler,
|
||||
@ -3750,10 +3539,6 @@ var Bundle_ServiceDesc = grpc_go.ServiceDesc{
|
||||
MethodName: "ConfirmWork",
|
||||
Handler: _Bundle_ConfirmWork_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetWaitConfirmWorkList",
|
||||
Handler: _Bundle_GetWaitConfirmWorkList_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetReconciliationList",
|
||||
Handler: _Bundle_GetReconciliationList_Handler,
|
||||
@ -3858,10 +3643,6 @@ var Bundle_ServiceDesc = grpc_go.ServiceDesc{
|
||||
MethodName: "AddHiddenTaskAssignee",
|
||||
Handler: _Bundle_AddHiddenTaskAssignee_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "CreateTaskWorkLog",
|
||||
Handler: _Bundle_CreateTaskWorkLog_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "MetricsBusiness",
|
||||
Handler: _Bundle_MetricsBusiness_Handler,
|
||||
@ -3886,14 +3667,6 @@ var Bundle_ServiceDesc = grpc_go.ServiceDesc{
|
||||
MethodName: "MetricsVideoSubmitExport",
|
||||
Handler: _Bundle_MetricsVideoSubmitExport_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "QueryTheOrderSnapshotInformation",
|
||||
Handler: _Bundle_QueryTheOrderSnapshotInformation_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ExportWorkCastInfo",
|
||||
Handler: _Bundle_ExportWorkCastInfo_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc_go.StreamDesc{},
|
||||
Metadata: "pb/bundle.proto",
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package cron
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"micro-bundle/internal/logic"
|
||||
|
||||
@ -20,6 +21,17 @@ func InitCronJob() {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// 避免冲突,任务余额每月更新定时任务 - 每月1号1点执行
|
||||
taskBalanceSpec := "0 0 1 1 * *"
|
||||
_, err = c.AddFunc(taskBalanceSpec, func() {
|
||||
log.Printf("执行任务余额每月数据更新")
|
||||
logic.UpdateTaskBalanceEveryMonLogic()
|
||||
})
|
||||
if err != nil {
|
||||
fmt.Println("添加任务余额每月数据更新定时任务失败", err)
|
||||
panic(err)
|
||||
}
|
||||
|
||||
c.Start()
|
||||
|
||||
}
|
||||
|
||||
@ -47,7 +47,7 @@ func loadMysqlConn(conn string) *gorm.DB {
|
||||
// Bundle数据库的自动迁移
|
||||
err = db.AutoMigrate(
|
||||
&model.BundleProfile{},
|
||||
//&model.BundleOrderRecords{},
|
||||
// &model.BundleOrderRecords{},
|
||||
&model.ValueAddBundleProfile{},
|
||||
//&model.ValueAddBundleRecord{}
|
||||
&model.BundleProfileLang{},
|
||||
@ -63,16 +63,7 @@ func loadMysqlConn(conn string) *gorm.DB {
|
||||
&model.BundleActivate{},
|
||||
&model.BundleBalanceLayout{},
|
||||
)
|
||||
if db.Migrator().HasColumn(&model.BundleOrderRecords{}, "platform_ids") == false {
|
||||
if err := db.Migrator().AddColumn(&model.BundleOrderRecords{}, "platform_ids"); err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
}
|
||||
if db.Migrator().HasColumn(&model.BundleOrderRecords{}, "inviter_id") == false {
|
||||
if err := db.Migrator().AddColumn(&model.BundleOrderRecords{}, "inviter_id"); err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
// return nil
|
||||
panic(err)
|
||||
@ -115,12 +106,12 @@ func loadTaskBenchMysqlConn(conn string) *gorm.DB {
|
||||
&model.TaskManagement{},
|
||||
&model.TaskAssignRecords{},
|
||||
// &model.TaskBalance{},
|
||||
&model.TaskLog{},
|
||||
&model.TaskSyncStatus{},
|
||||
&model.TaskPendingLayout{},
|
||||
&model.TaskAssignUUIDItems{},
|
||||
// 隐藏人员人记录表
|
||||
&model.TaskAssigneeHidden{},
|
||||
&model.TaskWorkLog{},
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
|
||||
@ -120,9 +120,3 @@ const (
|
||||
AccountService = 4 //账号数
|
||||
AvailableTimeService = 5 //可用时长
|
||||
)
|
||||
|
||||
// 套餐状态
|
||||
const (
|
||||
IsExpired = 1 //已过期
|
||||
NotExpired = 0 //未过期
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user