Compare commits
72 Commits
feat-hjj-M
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
80555657dc | ||
|
|
a9e1730402 | ||
|
|
9760aab1bb | ||
|
|
1bddcbef56 | ||
|
|
63ccfb5c90 | ||
|
|
ca02baa840 | ||
| 418521b451 | |||
| 67d4cf0aaa | |||
|
|
8c0f2eabcf | ||
|
|
0d1becb99b | ||
|
|
f924c003eb | ||
| c87f1defa9 | |||
| e1702d7b46 | |||
| 4d8203bf8c | |||
| a03f14de50 | |||
| 2a75c3eb78 | |||
|
|
278606b5e7 | ||
|
|
cd261657fd | ||
|
|
54296dd70a | ||
|
|
e170a086af | ||
|
|
cbe50785c3 | ||
|
|
bf4aa92713 | ||
|
|
c4571c8bef | ||
|
|
a89e39abc5 | ||
|
|
508f714dae | ||
|
|
3abd57aa9a | ||
|
|
c0bfd322a8 | ||
|
|
e9bef82968 | ||
|
|
aae7aa077b | ||
|
|
61e5a69484 | ||
|
|
0524d503f3 | ||
|
|
36a751b8ac | ||
|
|
7f5384c935 | ||
|
|
137e752c1b | ||
|
|
94258657e7 | ||
|
|
debb225291 | ||
| 8b85aeee28 | |||
|
|
8536070eea | ||
| bbe0c0390c | |||
|
|
bf41622eab | ||
|
|
7ac61c197c | ||
|
|
e5baa91e9d | ||
| 3584a9f948 | |||
| fc25533193 | |||
| 71f7be5716 | |||
| 55a5ba3152 | |||
| 185e5da57a | |||
|
|
55d1554e13 | ||
|
|
b9c44fdc7e | ||
|
|
5ad9417042 | ||
|
|
65ffc2c43a | ||
|
|
44c4a8627c | ||
|
|
7c4c7b0faa | ||
|
|
8f5c21e3f2 | ||
| d730106309 | |||
|
|
f40fc853de | ||
|
|
2a75b9b6db | ||
| 0bf1f34bba | |||
|
|
32a9bb8283 | ||
|
|
0e64d40489 | ||
| d11a7a5c6a | |||
| edc85ae53e | |||
| 10f336ec66 | |||
| fb77431848 | |||
| 88ea6356c0 | |||
| fa640ed8ef | |||
| bfaac2fd95 | |||
|
|
5dd3eb98c4 | ||
|
|
24980bd23f | ||
|
|
a0f54358b7 | ||
|
|
6b61b43464 | ||
| 1b2e5f8fd1 |
10
cmd/app.go
10
cmd/app.go
@ -34,16 +34,6 @@ func main() {
|
|||||||
panic(err)
|
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")
|
//l, err := net.Listen("tcp", ":8883")
|
||||||
//if err != nil {
|
//if err != nil {
|
||||||
// fmt.Printf("failed to listen: %v", err)
|
// fmt.Printf("failed to listen: %v", err)
|
||||||
|
|||||||
@ -127,3 +127,6 @@ func (b *BundleProvider) ListUnfinishedInfos(_ context.Context, req *bundle.Auto
|
|||||||
func (b *BundleProvider) SoftDeleteUnfinishedInfo(_ context.Context, req *bundle.SoftDeleteUnfinishedInfoRequest) (res *bundle.CommonResponse, err error) {
|
func (b *BundleProvider) SoftDeleteUnfinishedInfo(_ context.Context, req *bundle.SoftDeleteUnfinishedInfoRequest) (res *bundle.CommonResponse, err error) {
|
||||||
return logic.SoftDeleteUnfinishedInfo(req)
|
return logic.SoftDeleteUnfinishedInfo(req)
|
||||||
}
|
}
|
||||||
|
func (b *BundleProvider) ReSignTheContract(_ context.Context, req *bundle.ReSignTheContractRequest) (res *bundle.CommonResponse, err error) {
|
||||||
|
return logic.ReSignTheContract(req)
|
||||||
|
}
|
||||||
|
|||||||
@ -29,3 +29,7 @@ func (b *BundleProvider) MetricsArtistAccountExport(_ context.Context, req *bund
|
|||||||
func (b *BundleProvider) MetricsVideoSubmitExport(_ context.Context, req *bundle.MetricsVideoSubmitExportReq) (*bundle.MetricsVideoSubmitExportResp, error) {
|
func (b *BundleProvider) MetricsVideoSubmitExport(_ context.Context, req *bundle.MetricsVideoSubmitExportReq) (*bundle.MetricsVideoSubmitExportResp, error) {
|
||||||
return logic.MetricsVideoSubmitExport(req)
|
return logic.MetricsVideoSubmitExport(req)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (b *BundleProvider) ExportWorkCastInfo(_ context.Context, req *bundle.ExportWorkCastInfoReq) (*bundle.ExportWorkCastInfoResp, error) {
|
||||||
|
return logic.ExportWorkCastInfo(req)
|
||||||
|
}
|
||||||
|
|||||||
@ -51,3 +51,6 @@ func (b *BundleProvider) BatchGetValueAddServiceLang(ctx context.Context, req *b
|
|||||||
func (b *BundleProvider) BundleListH5V2(_ context.Context, req *bundle.BundleListRequest) (res *bundle.BundleListResponse, err error) {
|
func (b *BundleProvider) BundleListH5V2(_ context.Context, req *bundle.BundleListRequest) (res *bundle.BundleListResponse, err error) {
|
||||||
return logic.BundleListH5V2(req)
|
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 (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"micro-bundle/internal/dao"
|
"micro-bundle/internal/dto"
|
||||||
"micro-bundle/internal/logic"
|
"micro-bundle/internal/logic"
|
||||||
"micro-bundle/internal/model"
|
"micro-bundle/internal/model"
|
||||||
"micro-bundle/pb/bundle"
|
"micro-bundle/pb/bundle"
|
||||||
@ -13,57 +13,12 @@ import (
|
|||||||
"go.uber.org/zap"
|
"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 指派某位员工完成某个艺人的任务
|
// AssignTask 指派某位员工完成某个艺人的任务
|
||||||
func (b *BundleProvider) AssignTask(_ context.Context, req *bundle.TaskAssignRequest) (*bundle.CommonResponse, error) {
|
func (b *BundleProvider) AssignTask(_ context.Context, req *bundle.TaskAssignRequest) (*bundle.CommonResponse, error) {
|
||||||
// 转换请求参数
|
daoReq := &dto.TaskAssignRequest{
|
||||||
daoReq := &dao.TaskAssignRequest{
|
|
||||||
SubNum: req.SubNum,
|
SubNum: req.SubNum,
|
||||||
TelNum: req.TelNum,
|
TelNum: req.TelNum,
|
||||||
ArtistName: req.ArtistName, // 添加缺失的ArtistName字段
|
ArtistName: req.ArtistName,
|
||||||
TaskAssignee: req.TaskAssignee,
|
TaskAssignee: req.TaskAssignee,
|
||||||
TaskAssigneeNum: req.TaskAssigneeNum,
|
TaskAssigneeNum: req.TaskAssigneeNum,
|
||||||
Operator: req.Operator,
|
Operator: req.Operator,
|
||||||
@ -75,7 +30,6 @@ func (b *BundleProvider) AssignTask(_ context.Context, req *bundle.TaskAssignReq
|
|||||||
AssignVideoScriptCount: int(req.AssignVideoScriptCount),
|
AssignVideoScriptCount: int(req.AssignVideoScriptCount),
|
||||||
}
|
}
|
||||||
|
|
||||||
// 调用logic层
|
|
||||||
err := logic.AssignTask(daoReq)
|
err := logic.AssignTask(daoReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return &bundle.CommonResponse{
|
return &bundle.CommonResponse{
|
||||||
@ -88,35 +42,6 @@ func (b *BundleProvider) AssignTask(_ context.Context, req *bundle.TaskAssignReq
|
|||||||
}, nil
|
}, 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 查询最近被指派记录
|
// GetRecentAssignRecords 查询最近被指派记录
|
||||||
func (b *BundleProvider) GetRecentAssignRecords(_ context.Context, req *bundle.RecentAssignRecordsRequest) (*bundle.RecentAssignRecordsResponse, error) {
|
func (b *BundleProvider) GetRecentAssignRecords(_ context.Context, req *bundle.RecentAssignRecordsRequest) (*bundle.RecentAssignRecordsResponse, error) {
|
||||||
limit := int(req.Limit)
|
limit := int(req.Limit)
|
||||||
@ -142,8 +67,7 @@ func (b *BundleProvider) GetEmployeeAssignedTasks(_ context.Context, req *bundle
|
|||||||
if int(req.Status) == 2 {
|
if int(req.Status) == 2 {
|
||||||
req.SortBy = "complete_time"
|
req.SortBy = "complete_time"
|
||||||
}
|
}
|
||||||
// 转换请求参数
|
daoReq := &dto.EmployeeTaskQueryRequest{
|
||||||
daoReq := &dao.EmployeeTaskQueryRequest{
|
|
||||||
TaskAssigneeNum: req.TaskAssigneeNum,
|
TaskAssigneeNum: req.TaskAssigneeNum,
|
||||||
Keyword: req.Keyword,
|
Keyword: req.Keyword,
|
||||||
Operator: req.Operator,
|
Operator: req.Operator,
|
||||||
@ -158,13 +82,11 @@ func (b *BundleProvider) GetEmployeeAssignedTasks(_ context.Context, req *bundle
|
|||||||
TaskBatch: req.TaskBatch,
|
TaskBatch: req.TaskBatch,
|
||||||
}
|
}
|
||||||
|
|
||||||
// 调用logic层
|
|
||||||
records, total, err := logic.GetEmployeeAssignedTasks(daoReq)
|
records, total, err := logic.GetEmployeeAssignedTasks(daoReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// 转换响应数据
|
|
||||||
var recordInfos []*bundle.TaskAssignRecordInfo
|
var recordInfos []*bundle.TaskAssignRecordInfo
|
||||||
for _, record := range records {
|
for _, record := range records {
|
||||||
recordInfo := convertToTaskAssignRecordInfo(record)
|
recordInfo := convertToTaskAssignRecordInfo(record)
|
||||||
@ -181,7 +103,6 @@ func (b *BundleProvider) GetEmployeeAssignedTasks(_ context.Context, req *bundle
|
|||||||
|
|
||||||
// CompleteTaskManually 员工手动点击完成任务
|
// CompleteTaskManually 员工手动点击完成任务
|
||||||
func (b *BundleProvider) CompleteTaskManually(_ context.Context, req *bundle.CompleteTaskManuallyRequest) (*bundle.CommonResponse, error) {
|
func (b *BundleProvider) CompleteTaskManually(_ context.Context, req *bundle.CompleteTaskManuallyRequest) (*bundle.CommonResponse, error) {
|
||||||
// 调用logic层
|
|
||||||
err := logic.CompleteTaskManually(req.AssignRecordsUUID, req.TaskAssigneeNum)
|
err := logic.CompleteTaskManually(req.AssignRecordsUUID, req.TaskAssigneeNum)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return &bundle.CommonResponse{
|
return &bundle.CommonResponse{
|
||||||
@ -196,8 +117,7 @@ func (b *BundleProvider) CompleteTaskManually(_ context.Context, req *bundle.Com
|
|||||||
|
|
||||||
// UpdateTaskProgress 员工实际完成任务状态更新
|
// UpdateTaskProgress 员工实际完成任务状态更新
|
||||||
func (b *BundleProvider) UpdateTaskProgress(_ context.Context, req *bundle.UpdateTaskProgressRequest) (*bundle.CommonResponse, error) {
|
func (b *BundleProvider) UpdateTaskProgress(_ context.Context, req *bundle.UpdateTaskProgressRequest) (*bundle.CommonResponse, error) {
|
||||||
// 转换请求参数
|
daoReq := &dto.CompleteTaskRequest{
|
||||||
daoReq := &dao.CompleteTaskRequest{
|
|
||||||
AssignRecordsUUID: req.AssignRecordsUUID,
|
AssignRecordsUUID: req.AssignRecordsUUID,
|
||||||
EmployeeName: req.EmployeeName,
|
EmployeeName: req.EmployeeName,
|
||||||
EmployeeNum: req.EmployeeNum,
|
EmployeeNum: req.EmployeeNum,
|
||||||
@ -206,7 +126,6 @@ func (b *BundleProvider) UpdateTaskProgress(_ context.Context, req *bundle.Updat
|
|||||||
UUID: req.Uuid,
|
UUID: req.Uuid,
|
||||||
}
|
}
|
||||||
|
|
||||||
// 调用logic层
|
|
||||||
err := logic.UpdateTaskProgress(daoReq)
|
err := logic.UpdateTaskProgress(daoReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return &bundle.CommonResponse{
|
return &bundle.CommonResponse{
|
||||||
@ -219,9 +138,8 @@ func (b *BundleProvider) UpdateTaskProgress(_ context.Context, req *bundle.Updat
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// TerminateTaskByUUID 根据指派记录UUID终止任务(实际状态置为已中止)
|
// TerminateTaskByUUID 根据指派记录UUID终止任务
|
||||||
func (b *BundleProvider) TerminateTaskByUUID(_ context.Context, req *bundle.TerminateTaskByUUIDRequest) (*bundle.ComResponse, error) {
|
func (b *BundleProvider) TerminateTaskByUUID(_ context.Context, req *bundle.TerminateTaskByUUIDRequest) (*bundle.ComResponse, error) {
|
||||||
// 调用logic层
|
|
||||||
err := logic.TerminateTaskByUUID(req.AssignRecordsUUID)
|
err := logic.TerminateTaskByUUID(req.AssignRecordsUUID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return &bundle.ComResponse{Msg: err.Error()}, err
|
return &bundle.ComResponse{Msg: err.Error()}, err
|
||||||
@ -274,8 +192,7 @@ func (b *BundleProvider) GetTaskAssignRecordsList(_ context.Context, req *bundle
|
|||||||
if sortBy, ok := model.OrderByPending[req.SortBy]; ok {
|
if sortBy, ok := model.OrderByPending[req.SortBy]; ok {
|
||||||
req.SortBy = sortBy
|
req.SortBy = sortBy
|
||||||
}
|
}
|
||||||
// 转换请求参数
|
daoReq := &dto.TaskAssignRecordsQueryRequest{
|
||||||
daoReq := &dao.TaskAssignRecordsQueryRequest{
|
|
||||||
Keyword: req.Keyword,
|
Keyword: req.Keyword,
|
||||||
TaskAssignee: req.TaskAssignee,
|
TaskAssignee: req.TaskAssignee,
|
||||||
Operator: req.Operator,
|
Operator: req.Operator,
|
||||||
@ -297,7 +214,6 @@ func (b *BundleProvider) GetTaskAssignRecordsList(_ context.Context, req *bundle
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// 转换响应数据
|
|
||||||
var recordInfos []*bundle.TaskAssignRecordInfo
|
var recordInfos []*bundle.TaskAssignRecordInfo
|
||||||
for _, record := range records {
|
for _, record := range records {
|
||||||
recordInfo := convertToTaskAssignRecordInfo(record)
|
recordInfo := convertToTaskAssignRecordInfo(record)
|
||||||
@ -314,7 +230,7 @@ func (b *BundleProvider) GetTaskAssignRecordsList(_ context.Context, req *bundle
|
|||||||
}
|
}
|
||||||
|
|
||||||
// convertToTaskAssignRecordInfo 转换TaskAssignRecords模型为proto消息
|
// convertToTaskAssignRecordInfo 转换TaskAssignRecords模型为proto消息
|
||||||
func convertToTaskAssignRecordInfo(record *dao.TaskAssignRecordsResponse) *bundle.TaskAssignRecordInfo {
|
func convertToTaskAssignRecordInfo(record *dto.TaskAssignRecordsResponse) *bundle.TaskAssignRecordInfo {
|
||||||
var completeTime string
|
var completeTime string
|
||||||
if record.CompleteTime != nil {
|
if record.CompleteTime != nil {
|
||||||
completeTime = record.CompleteTime.Format("2006-01-02 15:04:05")
|
completeTime = record.CompleteTime.Format("2006-01-02 15:04:05")
|
||||||
@ -348,7 +264,7 @@ func convertToTaskAssignRecordInfo(record *dao.TaskAssignRecordsResponse) *bundl
|
|||||||
}
|
}
|
||||||
|
|
||||||
// convertToTaskAssignRecordsSummary 转换汇总结构到proto
|
// convertToTaskAssignRecordsSummary 转换汇总结构到proto
|
||||||
func convertToTaskAssignRecordsSummary(s *dao.TaskAssignRecordsSummary) *bundle.TaskAssignRecordsSummary {
|
func convertToTaskAssignRecordsSummary(s *dto.TaskAssignRecordsSummary) *bundle.TaskAssignRecordsSummary {
|
||||||
if s == nil {
|
if s == nil {
|
||||||
return &bundle.TaskAssignRecordsSummary{}
|
return &bundle.TaskAssignRecordsSummary{}
|
||||||
}
|
}
|
||||||
@ -364,64 +280,20 @@ func convertToTaskAssignRecordsSummary(s *dao.TaskAssignRecordsSummary) *bundle.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetArtistBundleBalance 查询艺人的当前任务余额与待发数量(区分套餐/增值两类)
|
// BatchAssignTask 批量指派
|
||||||
// 说明:
|
|
||||||
// - 查询条件优先使用艺人编号(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) {
|
func (b *BundleProvider) BatchAssignTask(_ context.Context, req *bundle.BatchAssignTaskRequest) (*bundle.ComResponse, error) {
|
||||||
if req == nil || len(req.Items) == 0 {
|
if req == nil || len(req.Items) == 0 {
|
||||||
return &bundle.ComResponse{Msg: "批量指派项不能为空"}, fmt.Errorf("批量指派项不能为空")
|
return &bundle.ComResponse{Msg: "批量指派项不能为空"}, fmt.Errorf("批量指派项不能为空")
|
||||||
}
|
}
|
||||||
|
|
||||||
// 转换请求项为DAO层结构
|
// 转换请求项为DAO层结构
|
||||||
var items []*dao.BatchAssignItem
|
var items []*dto.BatchAssignItem
|
||||||
items = make([]*dao.BatchAssignItem, 0, len(req.Items))
|
items = make([]*dto.BatchAssignItem, 0, len(req.Items))
|
||||||
for _, it := range req.Items {
|
for _, it := range req.Items {
|
||||||
if it == nil {
|
if it == nil {
|
||||||
return &bundle.ComResponse{Msg: "存在空的指派项"}, fmt.Errorf("存在空的指派项")
|
return &bundle.ComResponse{Msg: "存在空的指派项"}, fmt.Errorf("存在空的指派项")
|
||||||
}
|
}
|
||||||
items = append(items, &dao.BatchAssignItem{
|
items = append(items, &dto.BatchAssignItem{
|
||||||
SubNum: it.SubNum,
|
SubNum: it.SubNum,
|
||||||
TelNum: it.TelNum,
|
TelNum: it.TelNum,
|
||||||
ArtistName: it.ArtistName,
|
ArtistName: it.ArtistName,
|
||||||
@ -451,8 +323,7 @@ func (b *BundleProvider) GetArtistUploadStatsList(_ context.Context, req *bundle
|
|||||||
if sortBy, ok := model.OrderByDataAnalysis[req.SortBy]; ok {
|
if sortBy, ok := model.OrderByDataAnalysis[req.SortBy]; ok {
|
||||||
req.SortBy = sortBy
|
req.SortBy = sortBy
|
||||||
}
|
}
|
||||||
// 构造 DAO 请求参数
|
daoReq := &dto.TaskQueryRequest{
|
||||||
daoReq := &dao.TaskQueryRequest{
|
|
||||||
Keyword: req.Keyword,
|
Keyword: req.Keyword,
|
||||||
Page: int(req.Page),
|
Page: int(req.Page),
|
||||||
PageSize: int(req.PageSize),
|
PageSize: int(req.PageSize),
|
||||||
@ -462,13 +333,11 @@ func (b *BundleProvider) GetArtistUploadStatsList(_ context.Context, req *bundle
|
|||||||
SubNums: req.SubNums,
|
SubNums: req.SubNums,
|
||||||
}
|
}
|
||||||
|
|
||||||
// 调用逻辑层
|
|
||||||
items, total, err := logic.GetArtistUploadStatsList(daoReq)
|
items, total, err := logic.GetArtistUploadStatsList(daoReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// 转换响应数据
|
|
||||||
formatTime := func(s string) string {
|
formatTime := func(s string) string {
|
||||||
if s == "" {
|
if s == "" {
|
||||||
return ""
|
return ""
|
||||||
@ -525,29 +394,6 @@ func (b *BundleProvider) GetArtistUploadStatsList(_ context.Context, req *bundle
|
|||||||
}, nil
|
}, 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 查询艺人可指派数量
|
// GetPendingAssign 查询艺人可指派数量
|
||||||
func (b *BundleProvider) GetPendingAssign(_ context.Context, req *bundle.PendingAssignRequest) (*bundle.PendingAssignResponse, error) {
|
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))
|
items, total, err := logic.GetPendingAssignBySubNums(req.SubNums, int(req.Page), int(req.PageSize))
|
||||||
@ -590,3 +436,35 @@ func (b *BundleProvider) AddHiddenTaskAssignee(_ context.Context, req *bundle.Ad
|
|||||||
}
|
}
|
||||||
return &bundle.ComResponse{Msg: "删除该指派人成功"}, nil
|
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,6 +1,7 @@
|
|||||||
package dao
|
package dao
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"micro-bundle/internal/model"
|
"micro-bundle/internal/model"
|
||||||
"micro-bundle/pb/bundle"
|
"micro-bundle/pb/bundle"
|
||||||
"micro-bundle/pkg/app"
|
"micro-bundle/pkg/app"
|
||||||
@ -464,7 +465,40 @@ 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
|
err = app.ModuleClients.BundleDB.Model(&model.CastWork{}).Where("status = ? and update_time < ?", 4, time.Now().Add(-time.Hour*24)).Find(&data).Error
|
||||||
return
|
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
|
||||||
|
}
|
||||||
|
|||||||
@ -10,7 +10,6 @@ import (
|
|||||||
"micro-bundle/pkg/utils"
|
"micro-bundle/pkg/utils"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"dubbo.apache.org/dubbo-go/v3/common/logger"
|
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
"gorm.io/gorm/clause"
|
"gorm.io/gorm/clause"
|
||||||
)
|
)
|
||||||
@ -84,7 +83,7 @@ func GetBundleBalanceList(req *bundle.GetBundleBalanceListReq) (data []model.Bun
|
|||||||
WHEN bb.expired_at > NOW() THEN 2
|
WHEN bb.expired_at > NOW() THEN 2
|
||||||
ELSE 1
|
ELSE 1
|
||||||
END AS balance_status`).
|
END AS balance_status`).
|
||||||
Joins("LEFT JOIN `micro-account`.real_name rn ON u.real_name_id = rn.id").
|
Joins("LEFT JOIN `micro-account`.real_name rn ON u.real_name_id = rn.id and rn.deleted_at = 0").
|
||||||
Joins("LEFT JOIN (?) as bor ON bor.customer_id = u.id", subQuery).
|
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_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").
|
Joins("LEFT JOIN bundle_activate bc on bc.user_id = u.id").
|
||||||
@ -135,11 +134,11 @@ func GetBundleBalanceList(req *bundle.GetBundleBalanceListReq) (data []model.Bun
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if req.Month == "" {
|
if len(req.Month) == 0 {
|
||||||
newestMonthQuery := app.ModuleClients.BundleDB.Model(&model.BundleBalance{}).Select("max(month) as month,user_id").Group("user_id")
|
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("")
|
session.Joins("LEFT JOIN (?) as newest_month on newest_month.user_id = bb.user_id", newestMonthQuery).Where("")
|
||||||
} else {
|
} else {
|
||||||
session = session.Where("bb.month = ?", req.Month)
|
session = session.Where("bb.month in (?)", req.Month)
|
||||||
}
|
}
|
||||||
err = session.Count(&total).Error
|
err = session.Count(&total).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -202,7 +201,7 @@ func AddBundleBalanceByUserId(data model.BundleBalanceUsePo) (usedType int, err
|
|||||||
if oldData.ManualAccountConsumptionNumber < oldData.ManualAccountNumber { // 最后消耗手动扩展的
|
if oldData.ManualAccountConsumptionNumber < oldData.ManualAccountNumber { // 最后消耗手动扩展的
|
||||||
oldData.ManualAccountConsumptionNumber++
|
oldData.ManualAccountConsumptionNumber++
|
||||||
oldData.MonthlyManualAccountConsumptionNumber++
|
oldData.MonthlyManualAccountConsumptionNumber++
|
||||||
usedType = 3
|
usedType = 2
|
||||||
goto Over
|
goto Over
|
||||||
}
|
}
|
||||||
return errors.New("账号数不足")
|
return errors.New("账号数不足")
|
||||||
@ -210,7 +209,7 @@ func AddBundleBalanceByUserId(data model.BundleBalanceUsePo) (usedType int, err
|
|||||||
if oldData.ManualAccountConsumptionNumber > 0 { // 最后消耗手动扩展的
|
if oldData.ManualAccountConsumptionNumber > 0 { // 最后消耗手动扩展的
|
||||||
oldData.ManualAccountConsumptionNumber--
|
oldData.ManualAccountConsumptionNumber--
|
||||||
oldData.MonthlyManualAccountConsumptionNumber--
|
oldData.MonthlyManualAccountConsumptionNumber--
|
||||||
usedType = 3
|
usedType = 2
|
||||||
goto Over
|
goto Over
|
||||||
}
|
}
|
||||||
if oldData.IncreaseAccountConsumptionNumber > 0 {
|
if oldData.IncreaseAccountConsumptionNumber > 0 {
|
||||||
@ -269,14 +268,13 @@ func AddBundleBalanceByUserId(data model.BundleBalanceUsePo) (usedType int, err
|
|||||||
if oldData.ManualVideoConsumptionNumber < oldData.ManualVideoNumber { // 手动扩展类型充足
|
if oldData.ManualVideoConsumptionNumber < oldData.ManualVideoNumber { // 手动扩展类型充足
|
||||||
oldData.ManualVideoConsumptionNumber++
|
oldData.ManualVideoConsumptionNumber++
|
||||||
oldData.MonthlyManualVideoConsumptionNumber++ // 记录本月使用的手动扩展
|
oldData.MonthlyManualVideoConsumptionNumber++ // 记录本月使用的手动扩展
|
||||||
usedType = 3
|
usedType = 2
|
||||||
goto Over
|
goto Over
|
||||||
}
|
}
|
||||||
return errors.New("可用视频数不足")
|
return errors.New("可用视频数不足")
|
||||||
}
|
}
|
||||||
|
|
||||||
if data.ImageNumber > 0 {
|
if data.ImageNumber > 0 {
|
||||||
// 当月可使用的会过期的限制类型充足
|
|
||||||
// 当月可使用的会过期的限制类型充足
|
// 当月可使用的会过期的限制类型充足
|
||||||
if oldData.MonthlyBundleLimitExpiredImageConsumptionNumber < oldData.MonthlyBundleLimitExpiredImageNumber { // 套餐内会过期的限制类型图片充足
|
if oldData.MonthlyBundleLimitExpiredImageConsumptionNumber < oldData.MonthlyBundleLimitExpiredImageNumber { // 套餐内会过期的限制类型图片充足
|
||||||
oldData.MonthlyBundleLimitExpiredImageConsumptionNumber++
|
oldData.MonthlyBundleLimitExpiredImageConsumptionNumber++
|
||||||
@ -327,7 +325,6 @@ func AddBundleBalanceByUserId(data model.BundleBalanceUsePo) (usedType int, err
|
|||||||
}
|
}
|
||||||
|
|
||||||
if data.DataAnalysisNumber > 0 {
|
if data.DataAnalysisNumber > 0 {
|
||||||
// 当月可使用的会过期的限制类型充足
|
|
||||||
// 当月可使用的会过期的限制类型充足
|
// 当月可使用的会过期的限制类型充足
|
||||||
if oldData.MonthlyBundleLimitExpiredDataAnalysisConsumptionNumber < oldData.MonthlyBundleLimitExpiredDataAnalysisNumber { // 套餐内会过期的限制类型数据分析充足
|
if oldData.MonthlyBundleLimitExpiredDataAnalysisConsumptionNumber < oldData.MonthlyBundleLimitExpiredDataAnalysisNumber { // 套餐内会过期的限制类型数据分析充足
|
||||||
oldData.MonthlyBundleLimitExpiredDataAnalysisConsumptionNumber++
|
oldData.MonthlyBundleLimitExpiredDataAnalysisConsumptionNumber++
|
||||||
@ -376,6 +373,52 @@ func AddBundleBalanceByUserId(data model.BundleBalanceUsePo) (usedType int, err
|
|||||||
}
|
}
|
||||||
return errors.New("可用数据分析数不足")
|
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:
|
Over:
|
||||||
return tx.Model(&model.BundleBalance{}).Where("id = ?", oldData.ID).Save(&oldData).Error
|
return tx.Model(&model.BundleBalance{}).Where("id = ?", oldData.ID).Save(&oldData).Error
|
||||||
})
|
})
|
||||||
@ -389,7 +432,7 @@ func CreateUsedRecord(tx *gorm.DB, data model.BundleUsedRecord) error {
|
|||||||
func ExtendBundleBalanceByUserId(data model.BundleBalanceExtendPo) error {
|
func ExtendBundleBalanceByUserId(data model.BundleBalanceExtendPo) error {
|
||||||
err := app.ModuleClients.BundleDB.Transaction(func(tx *gorm.DB) error {
|
err := app.ModuleClients.BundleDB.Transaction(func(tx *gorm.DB) error {
|
||||||
oldData := model.BundleBalance{}
|
oldData := model.BundleBalance{}
|
||||||
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 {
|
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 {
|
||||||
return errors.New("用户还没有套餐信息")
|
return errors.New("用户还没有套餐信息")
|
||||||
}
|
}
|
||||||
oldData.ManualAccountNumber += data.AccountNumber
|
oldData.ManualAccountNumber += data.AccountNumber
|
||||||
@ -400,6 +443,8 @@ func ExtendBundleBalanceByUserId(data model.BundleBalanceExtendPo) error {
|
|||||||
oldData.MonthlyNewManualDataAnalysisNumber += data.DataAnalysisNumber
|
oldData.MonthlyNewManualDataAnalysisNumber += data.DataAnalysisNumber
|
||||||
oldData.ManualVideoNumber += data.VideoNumber
|
oldData.ManualVideoNumber += data.VideoNumber
|
||||||
oldData.MonthlyNewManualVideoNumber += data.VideoNumber
|
oldData.MonthlyNewManualVideoNumber += data.VideoNumber
|
||||||
|
oldData.ManualCompetitiveNumber += data.CompetitiveNumber
|
||||||
|
oldData.MonthlyNewManualCompetitiveNumber += data.CompetitiveNumber
|
||||||
oldData.MonthlyNewDurationNumber += data.DurationNumber // 记录本月新增手动扩展时长
|
oldData.MonthlyNewDurationNumber += data.DurationNumber // 记录本月新增手动扩展时长
|
||||||
oldData.ExpiredAt = oldData.ExpiredAt.Add(time.Hour * 24 * time.Duration(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
|
return tx.Model(&model.BundleBalance{}).Where("id = ?", oldData.ID).Save(&oldData).Error
|
||||||
@ -408,14 +453,6 @@ func ExtendBundleBalanceByUserId(data model.BundleBalanceExtendPo) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -423,13 +460,6 @@ func CreateBundleBalance(data model.BundleBalance) error {
|
|||||||
if err := app.ModuleClients.BundleDB.Save(&data).Error; err != nil {
|
if err := app.ModuleClients.BundleDB.Save(&data).Error; err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// 同步任务余额(新建套餐余额时)
|
|
||||||
// 如果任务余额同步失败,只记录错误日志,不影响主流程
|
|
||||||
if taskErr := SyncTaskBalanceFromBundleBalance(data); taskErr != nil {
|
|
||||||
// 记录错误日志但不返回错误,避免影响主流程
|
|
||||||
logger.Errorf("新建套餐余额时任务余额同步失败,更新数据: %v, 错误 %v", data, taskErr)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -647,6 +677,26 @@ inner join (
|
|||||||
return min(limit, remaining)
|
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
|
v.MonthlyInvalidBundleVideoNumber = v.MonthlyBundleLimitExpiredVideoNumber - v.MonthlyBundleLimitExpiredVideoConsumptionNumber
|
||||||
// 历史失效的套餐权益视频总数
|
// 历史失效的套餐权益视频总数
|
||||||
@ -659,6 +709,10 @@ inner join (
|
|||||||
v.MonthlyInvalidBundleDataAnalysisNumber = v.MonthlyBundleLimitExpiredDataAnalysisNumber - v.MonthlyBundleLimitExpiredDataAnalysisConsumptionNumber // 当月过期的数据分析数
|
v.MonthlyInvalidBundleDataAnalysisNumber = v.MonthlyBundleLimitExpiredDataAnalysisNumber - v.MonthlyBundleLimitExpiredDataAnalysisConsumptionNumber // 当月过期的数据分析数
|
||||||
// 历史失效的套餐权益数据分析总数
|
// 历史失效的套餐权益数据分析总数
|
||||||
v.InvalidBundleDataAnalysisNumber += v.MonthlyInvalidBundleDataAnalysisNumber
|
v.InvalidBundleDataAnalysisNumber += v.MonthlyInvalidBundleDataAnalysisNumber
|
||||||
|
// 当月过期的竞品数
|
||||||
|
v.MonthlyInvalidBundleCompetitiveNumber = v.MonthlyBundleLimitExpiredCompetitiveNumber - v.MonthlyBundleLimitExpiredCompetitiveConsumptionNumber
|
||||||
|
// 历史失效的套餐权益竞品数总数
|
||||||
|
v.InvalidBundleCompetitiveNumber += v.MonthlyInvalidBundleCompetitiveNumber
|
||||||
|
|
||||||
// 当月失效的增值权益视频总数
|
// 当月失效的增值权益视频总数
|
||||||
v.MonthlyInvalidIncreaseVideoNumber = v.MonthlyIncreaseLimitExpiredVideoNumber - v.MonthlyIncreaseLimitExpiredVideoConsumptionNumber
|
v.MonthlyInvalidIncreaseVideoNumber = v.MonthlyIncreaseLimitExpiredVideoNumber - v.MonthlyIncreaseLimitExpiredVideoConsumptionNumber
|
||||||
@ -672,6 +726,10 @@ inner join (
|
|||||||
v.MonthlyInvalidIncreaseDataAnalysisNumber = v.MonthlyIncreaseLimitExpiredDataAnalysisNumber - v.MonthlyIncreaseLimitExpiredDataAnalysisConsumptionNumber
|
v.MonthlyInvalidIncreaseDataAnalysisNumber = v.MonthlyIncreaseLimitExpiredDataAnalysisNumber - v.MonthlyIncreaseLimitExpiredDataAnalysisConsumptionNumber
|
||||||
// 历史失效的增值权益数据分析总数
|
// 历史失效的增值权益数据分析总数
|
||||||
v.InvalidIncreaseDataAnalysisNumber += v.MonthlyInvalidIncreaseDataAnalysisNumber
|
v.InvalidIncreaseDataAnalysisNumber += v.MonthlyInvalidIncreaseDataAnalysisNumber
|
||||||
|
// 当月失效的增值权益竞品数总数
|
||||||
|
v.MonthlyInvalidIncreaseCompetitiveNumber = v.MonthlyIncreaseLimitExpiredCompetitiveNumber - v.MonthlyIncreaseLimitExpiredCompetitiveConsumptionNumber
|
||||||
|
// 历史失效的增值权益竞品数总数
|
||||||
|
v.InvalidIncreaseCompetitiveNumber += v.MonthlyInvalidIncreaseCompetitiveNumber
|
||||||
|
|
||||||
// 当月套餐限制类会过期型视频可使用额度
|
// 当月套餐限制类会过期型视频可使用额度
|
||||||
v.MonthlyBundleLimitExpiredVideoNumber = cal(v.BundleLimitVideoExpiredNumber, v.MonthlyLimitVideoQuotaNumber)
|
v.MonthlyBundleLimitExpiredVideoNumber = cal(v.BundleLimitVideoExpiredNumber, v.MonthlyLimitVideoQuotaNumber)
|
||||||
@ -681,6 +739,7 @@ inner join (
|
|||||||
v.MonthlyBundleLimitVideoNumber = v.MonthlyBundleLimitVideoNumber - v.MonthlyBundleLimitVideoConsumptionNumber + cal(v.BundleLimitVideoNumber, 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.MonthlyIncreaseLimitVideoNumber = v.MonthlyIncreaseLimitVideoNumber - v.MonthlyIncreaseLimitVideoConsumptionNumber + cal(v.IncreaseLimitVideoNumber, v.MonthlyLimitVideoQuotaNumber)
|
||||||
|
|
||||||
// 当月套餐限制类会过期型图片可使用额度
|
// 当月套餐限制类会过期型图片可使用额度
|
||||||
v.MonthlyBundleLimitExpiredImageNumber = cal(v.BundleLimitImageExpiredNumber, v.MonthlyLimitImageQuotaNumber)
|
v.MonthlyBundleLimitExpiredImageNumber = cal(v.BundleLimitImageExpiredNumber, v.MonthlyLimitImageQuotaNumber)
|
||||||
// 当月增值限制类会过期型图片可使用额度
|
// 当月增值限制类会过期型图片可使用额度
|
||||||
@ -689,16 +748,27 @@ inner join (
|
|||||||
v.MonthlyBundleLimitImageNumber = v.MonthlyBundleLimitImageNumber - v.MonthlyBundleLimitImageConsumptionNumber + cal(v.BundleLimitImageNumber, 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.MonthlyIncreaseLimitImageNumber = v.MonthlyIncreaseLimitImageNumber - v.MonthlyIncreaseLimitImageConsumptionNumber + cal(v.IncreaseLimitImageNumber, v.MonthlyLimitImageQuotaNumber)
|
||||||
|
|
||||||
// 当月套餐限制类会过期型数据分析可使用额度
|
// 当月套餐限制类会过期型数据分析可使用额度
|
||||||
v.MonthlyBundleLimitExpiredDataAnalysisNumber = cal(v.BundleLimitDataAnalysisExpiredNumber, v.MonthlyLimitDataAnalysisQuotaNumber)
|
v.MonthlyBundleLimitExpiredDataAnalysisNumber = cal(v.BundleLimitDataAnalysisExpiredNumber, v.MonthlyLimitDataAnalysisQuotaNumber)
|
||||||
// 当月增值限制类会过期型数据分析可使用额度
|
// 当月增值限制类会过期型数据分析可使用额度
|
||||||
v.MonthlyIncreaseLimitExpiredDataAnalysisNumber = cal(v.IncreaseLimitDataAnalysisExpiredNumber, v.MonthlyLimitDataAnalysisQuotaNumber)
|
v.MonthlyIncreaseLimitExpiredDataAnalysisNumber = cal(v.IncreaseLimitDataAnalysisExpiredNumber, v.MonthlyLimitDataAnalysisQuotaNumber)
|
||||||
// 当月套餐限制类型数据分析可使用额度
|
// 当月套餐限制类型数据分析可使用额度
|
||||||
v.MonthlyBundleLimitDataAnalysisNumber = v.MonthlyBundleLimitDataAnalysisNumber - v.MonthlyBundleLimitDataAnalysisConsumptionNumber + cal(v.BundleLimitImageNumber, v.MonthlyLimitImageQuotaNumber)
|
v.MonthlyBundleLimitDataAnalysisNumber = v.MonthlyBundleLimitDataAnalysisNumber - v.MonthlyBundleLimitDataAnalysisConsumptionNumber + cal(v.BundleLimitDataAnalysisNumber, v.MonthlyLimitDataAnalysisQuotaNumber)
|
||||||
// 当月增值限制类型数据分析可使用额度
|
// 当月增值限制类型数据分析可使用额度
|
||||||
v.MonthlyIncreaseLimitDataAnalysisNumber = v.MonthlyIncreaseLimitDataAnalysisNumber - v.MonthlyIncreaseLimitDataAnalysisConsumptionNumber + cal(v.IncreaseLimitImageNumber, 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.MonthlyBundleVideoConsumptionNumber = 0
|
v.MonthlyBundleVideoConsumptionNumber = 0
|
||||||
v.MonthlyIncreaseVideoConsumptionNumber = 0
|
v.MonthlyIncreaseVideoConsumptionNumber = 0
|
||||||
v.MonthlyBundleLimitVideoConsumptionNumber = 0
|
v.MonthlyBundleLimitVideoConsumptionNumber = 0
|
||||||
@ -707,6 +777,7 @@ inner join (
|
|||||||
v.MonthlyIncreaseLimitExpiredVideoConsumptionNumber = 0
|
v.MonthlyIncreaseLimitExpiredVideoConsumptionNumber = 0
|
||||||
v.MonthlyNewManualVideoNumber = 0
|
v.MonthlyNewManualVideoNumber = 0
|
||||||
v.MonthlyManualVideoConsumptionNumber = 0
|
v.MonthlyManualVideoConsumptionNumber = 0
|
||||||
|
//图文
|
||||||
v.MonthlyBundleImageConsumptionNumber = 0
|
v.MonthlyBundleImageConsumptionNumber = 0
|
||||||
v.MonthlyIncreaseImageConsumptionNumber = 0
|
v.MonthlyIncreaseImageConsumptionNumber = 0
|
||||||
v.MonthlyBundleLimitImageConsumptionNumber = 0
|
v.MonthlyBundleLimitImageConsumptionNumber = 0
|
||||||
@ -715,6 +786,7 @@ inner join (
|
|||||||
v.MonthlyIncreaseLimitExpiredImageConsumptionNumber = 0
|
v.MonthlyIncreaseLimitExpiredImageConsumptionNumber = 0
|
||||||
v.MonthlyNewManualImageNumber = 0
|
v.MonthlyNewManualImageNumber = 0
|
||||||
v.MonthlyManualImageConsumptionNumber = 0
|
v.MonthlyManualImageConsumptionNumber = 0
|
||||||
|
//数据分析
|
||||||
v.MonthlyBundleDataAnalysisConsumptionNumber = 0
|
v.MonthlyBundleDataAnalysisConsumptionNumber = 0
|
||||||
v.MonthlyIncreaseDataAnalysisConsumptionNumber = 0
|
v.MonthlyIncreaseDataAnalysisConsumptionNumber = 0
|
||||||
v.MonthlyBundleLimitDataAnalysisConsumptionNumber = 0
|
v.MonthlyBundleLimitDataAnalysisConsumptionNumber = 0
|
||||||
@ -723,9 +795,20 @@ inner join (
|
|||||||
v.MonthlyIncreaseLimitExpiredDataAnalysisConsumptionNumber = 0
|
v.MonthlyIncreaseLimitExpiredDataAnalysisConsumptionNumber = 0
|
||||||
v.MonthlyNewManualDataAnalysisNumber = 0
|
v.MonthlyNewManualDataAnalysisNumber = 0
|
||||||
v.MonthlyManualDataAnalysisConsumptionNumber = 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.Month = month
|
||||||
v.ID = 0
|
v.ID = 0
|
||||||
|
v.CreatedAt = time.Time{}
|
||||||
|
v.UpdatedAt = time.Time{}
|
||||||
app.ModuleClients.BundleDB.Create(&v)
|
app.ModuleClients.BundleDB.Create(&v)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -760,7 +843,7 @@ left join (
|
|||||||
where r.deleted_at is null
|
where r.deleted_at is null
|
||||||
group by
|
group by
|
||||||
r.bundle_order_on
|
r.bundle_order_on
|
||||||
) r on r.bundle_order_on = bor.order_no
|
) r on r.bundle_order_on COLLATE utf8mb4_general_ci = bor.order_no COLLATE utf8mb4_general_ci
|
||||||
`).Scan(&data).Error
|
`).Scan(&data).Error
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import (
|
|||||||
"micro-bundle/internal/model"
|
"micro-bundle/internal/model"
|
||||||
"micro-bundle/pb/bundle"
|
"micro-bundle/pb/bundle"
|
||||||
"micro-bundle/pkg/app"
|
"micro-bundle/pkg/app"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/duke-git/lancet/v2/datetime"
|
"github.com/duke-git/lancet/v2/datetime"
|
||||||
@ -20,7 +21,7 @@ func MetricsBusiness(req *bundle.MetricsBusinessReq) (result *bundle.MetricsBusi
|
|||||||
// ---------- 总金额统计 ----------
|
// ---------- 总金额统计 ----------
|
||||||
subQuery := app.ModuleClients.BundleDB.Model(&model.Reconciliation{}).
|
subQuery := app.ModuleClients.BundleDB.Model(&model.Reconciliation{}).
|
||||||
Select("TRUNCATE(COALESCE(SUM(CAST(handling_fee AS DECIMAL(12,3))), 0), 3) as total_fee_payment_amount").
|
Select("TRUNCATE(COALESCE(SUM(CAST(handling_fee AS DECIMAL(12,3))), 0), 3) as total_fee_payment_amount").
|
||||||
Joins("LEFT JOIN bundle_order_records bor ON bor.order_no = bundle_order_on").
|
Joins("LEFT JOIN bundle_order_records bor ON bor.order_no COLLATE utf8mb4_general_ci = reconciliation.bundle_order_on COLLATE utf8mb4_general_ci").
|
||||||
Where("bor.deleted_at is null and bor.status=2")
|
Where("bor.deleted_at is null and bor.status=2")
|
||||||
// if req.BundleUuid != "" {
|
// if req.BundleUuid != "" {
|
||||||
// subQuery = subQuery.Where("bor.bundle_uuid = ?", req.BundleUuid)
|
// subQuery = subQuery.Where("bor.bundle_uuid = ?", req.BundleUuid)
|
||||||
@ -38,7 +39,7 @@ func MetricsBusiness(req *bundle.MetricsBusinessReq) (result *bundle.MetricsBusi
|
|||||||
// }
|
// }
|
||||||
err = query.First(result).Error
|
err = query.First(result).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return nil, fmt.Errorf("总金额统计失败")
|
||||||
}
|
}
|
||||||
|
|
||||||
// 将字符串转换为数值进行计算
|
// 将字符串转换为数值进行计算
|
||||||
@ -66,13 +67,13 @@ func MetricsBusiness(req *bundle.MetricsBusinessReq) (result *bundle.MetricsBusi
|
|||||||
// ---------- 新增金额统计 ----------
|
// ---------- 新增金额统计 ----------
|
||||||
|
|
||||||
var NewFeePaymentAmount struct {
|
var NewFeePaymentAmount struct {
|
||||||
NewFeePaymentAmount float32 `gorm:"column:new_fee_payment_amount"`
|
NewFeePaymentAmount string `gorm:"column:new_fee_payment_amount"`
|
||||||
NewPaymentAmount float32 `gorm:"column:new_payment_amount"`
|
NewPaymentAmount string `gorm:"column:new_payment_amount"`
|
||||||
}
|
}
|
||||||
|
|
||||||
subQuery = app.ModuleClients.BundleDB.Model(&model.Reconciliation{}).
|
subQuery = app.ModuleClients.BundleDB.Model(&model.Reconciliation{}).
|
||||||
Select("SUM(handling_fee) as new_fee_payment_amount, SUM(pay_amount) as new_payment_amount").
|
Select("TRUNCATE(COALESCE(SUM(CAST(handling_fee AS DECIMAL(12,3))), 0), 3) AS new_fee_payment_amount,TRUNCATE(COALESCE(SUM(CAST(pay_amount AS DECIMAL(12,3))), 0), 3) AS new_payment_amount").
|
||||||
Joins("LEFT JOIN bundle_order_records bor ON bor.order_no = bundle_order_on").
|
Joins("LEFT JOIN bundle_order_records bor ON bor.order_no COLLATE utf8mb4_general_ci = reconciliation.bundle_order_on COLLATE utf8mb4_general_ci").
|
||||||
Where("`reconciliation`.pay_time >= ?", req.Start+" 00:00:00").
|
Where("`reconciliation`.pay_time >= ?", req.Start+" 00:00:00").
|
||||||
Where("`reconciliation`.pay_time <= ?", req.End+" 23:59:59").
|
Where("`reconciliation`.pay_time <= ?", req.End+" 23:59:59").
|
||||||
Where("`reconciliation`.deleted_at is null and reconciliation.pay_status = 2 and bor.status=2 and bor.deleted_at is null")
|
Where("`reconciliation`.deleted_at is null and reconciliation.pay_status = 2 and bor.status=2 and bor.deleted_at is null")
|
||||||
@ -102,7 +103,16 @@ func MetricsBusiness(req *bundle.MetricsBusinessReq) (result *bundle.MetricsBusi
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
result.NewFinalPaymentAmount = result.NewPaymentAmount - result.NewFeePaymentAmount
|
// 使用 decimal 计算新增结算金额,避免精度丢失
|
||||||
|
newPayDecimal, err := decimal.NewFromString(result.NewPaymentAmount)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("解析实收金额失败: %v", err)
|
||||||
|
}
|
||||||
|
newFeeDecimal, err := decimal.NewFromString(result.NewFeePaymentAmount)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("解析手续费失败: %v", err)
|
||||||
|
}
|
||||||
|
result.NewFinalPaymentAmount = newPayDecimal.Sub(newFeeDecimal).Truncate(3).StringFixed(2)
|
||||||
|
|
||||||
// ---------- 新套餐数统计 ----------
|
// ---------- 新套餐数统计 ----------
|
||||||
var newBundleCount int64
|
var newBundleCount int64
|
||||||
@ -191,6 +201,7 @@ func MetricsBusiness(req *bundle.MetricsBusinessReq) (result *bundle.MetricsBusi
|
|||||||
Where("cwe.cost_type = 1").
|
Where("cwe.cost_type = 1").
|
||||||
Where("cwl.update_time >= ?", req.Start+" 00:00:00").
|
Where("cwl.update_time >= ?", req.Start+" 00:00:00").
|
||||||
Where("cwl.update_time <= ?", req.End+" 23:59:59").
|
Where("cwl.update_time <= ?", req.End+" 23:59:59").
|
||||||
|
Where("cast_work.origin_uuid = ''").
|
||||||
Where("cast_work.deleted_at = 0 and ccl.deleted_at = 0 and cwe.deleted_at = 0")
|
Where("cast_work.deleted_at = 0 and ccl.deleted_at = 0 and cwe.deleted_at = 0")
|
||||||
if req.BundleUuid != "" {
|
if req.BundleUuid != "" {
|
||||||
query = query.Where("ccl.bundle_uuid = ?", req.BundleUuid)
|
query = query.Where("ccl.bundle_uuid = ?", req.BundleUuid)
|
||||||
@ -209,6 +220,7 @@ func MetricsBusiness(req *bundle.MetricsBusinessReq) (result *bundle.MetricsBusi
|
|||||||
Where("cwe.cost_type != 1").
|
Where("cwe.cost_type != 1").
|
||||||
Where("cwl.update_time >= ?", req.Start+" 00:00:00").
|
Where("cwl.update_time >= ?", req.Start+" 00:00:00").
|
||||||
Where("cwl.update_time <= ?", req.End+" 23:59:59").
|
Where("cwl.update_time <= ?", req.End+" 23:59:59").
|
||||||
|
Where("cast_work.origin_uuid = ''").
|
||||||
Where("cast_work.deleted_at = 0 and ccl.deleted_at = 0 and cwe.deleted_at = 0")
|
Where("cast_work.deleted_at = 0 and ccl.deleted_at = 0 and cwe.deleted_at = 0")
|
||||||
if req.BundleUuid != "" {
|
if req.BundleUuid != "" {
|
||||||
query = query.Where("ccl.bundle_uuid = ?", req.BundleUuid)
|
query = query.Where("ccl.bundle_uuid = ?", req.BundleUuid)
|
||||||
@ -237,9 +249,11 @@ func MetricsBusiness(req *bundle.MetricsBusinessReq) (result *bundle.MetricsBusi
|
|||||||
Joins("LEFT JOIN cast_work_log AS cwl ON cwl.work_uuid = cw.uuid and cwl.work_status = 9").
|
Joins("LEFT JOIN cast_work_log AS cwl ON cwl.work_uuid = cw.uuid and cwl.work_status = 9").
|
||||||
Where("cwl.work_status = 9").
|
Where("cwl.work_status = 9").
|
||||||
Where("cwe.cost_type in ?", []int{1, 2}).
|
Where("cwe.cost_type in ?", []int{1, 2}).
|
||||||
|
Where("cw.work_category = ?", 2).
|
||||||
Where("cw.status in ?", []int{7, 6, 9}).
|
Where("cw.status in ?", []int{7, 6, 9}).
|
||||||
Where("cwl.update_time >= ?", req.Start+" 00:00:00").
|
Where("cwl.update_time >= ?", req.Start+" 00:00:00").
|
||||||
Where("cwl.update_time <= ?", req.End+" 23:59:59").
|
Where("cwl.update_time <= ?", req.End+" 23:59:59").
|
||||||
|
Where("cw.origin_uuid = ''").
|
||||||
Where("cw.deleted_at = 0 and cwl.deleted_at = 0 and cwe.deleted_at = 0").
|
Where("cw.deleted_at = 0 and cwl.deleted_at = 0 and cwe.deleted_at = 0").
|
||||||
Group("cw.artist_uuid")
|
Group("cw.artist_uuid")
|
||||||
|
|
||||||
@ -302,6 +316,7 @@ func MetricsBusiness(req *bundle.MetricsBusinessReq) (result *bundle.MetricsBusi
|
|||||||
Where("cast_work.work_category = 2").
|
Where("cast_work.work_category = 2").
|
||||||
Where("cast_work.submit_time >= ?", req.Start+" 00:00:00").
|
Where("cast_work.submit_time >= ?", req.Start+" 00:00:00").
|
||||||
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
||||||
|
Where("cast_work.origin_uuid = ''").
|
||||||
Where("cast_work.deleted_at = 0")
|
Where("cast_work.deleted_at = 0")
|
||||||
|
|
||||||
if req.BundleUuid != "" {
|
if req.BundleUuid != "" {
|
||||||
@ -322,6 +337,7 @@ func MetricsBusiness(req *bundle.MetricsBusinessReq) (result *bundle.MetricsBusi
|
|||||||
Where("cast_work.work_category = 2").
|
Where("cast_work.work_category = 2").
|
||||||
Where("cast_work.submit_time >= ?", req.Start+" 00:00:00").
|
Where("cast_work.submit_time >= ?", req.Start+" 00:00:00").
|
||||||
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
||||||
|
Where("cast_work.origin_uuid = ''").
|
||||||
Where("cast_work.deleted_at = 0 and bor.deleted_at IS NULL and bb.deleted_at IS NULL").
|
Where("cast_work.deleted_at = 0 and bor.deleted_at IS NULL and bb.deleted_at IS NULL").
|
||||||
Where("bor.bundle_uuid = ?", req.BundleUuid)
|
Where("bor.bundle_uuid = ?", req.BundleUuid)
|
||||||
err = query.Count(&newVideoUsed).Error
|
err = query.Count(&newVideoUsed).Error
|
||||||
@ -337,6 +353,8 @@ func MetricsBusiness(req *bundle.MetricsBusinessReq) (result *bundle.MetricsBusi
|
|||||||
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
||||||
Where("cast_work.work_category = 2"). // 视频类型
|
Where("cast_work.work_category = 2"). // 视频类型
|
||||||
Where("cwe.cost_type = 1"). // 套餐类型
|
Where("cwe.cost_type = 1"). // 套餐类型
|
||||||
|
Where("cast_work.status != 8").
|
||||||
|
Where("cast_work.origin_uuid = ''").
|
||||||
Where("cast_work.deleted_at = 0")
|
Where("cast_work.deleted_at = 0")
|
||||||
if req.BundleUuid != "" {
|
if req.BundleUuid != "" {
|
||||||
queryBundleVideo = queryBundleVideo.Where("ccl.bundle_uuid = ?", req.BundleUuid)
|
queryBundleVideo = queryBundleVideo.Where("ccl.bundle_uuid = ?", req.BundleUuid)
|
||||||
@ -353,6 +371,8 @@ func MetricsBusiness(req *bundle.MetricsBusinessReq) (result *bundle.MetricsBusi
|
|||||||
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
||||||
Where("cast_work.work_category = 2"). // 视频类型
|
Where("cast_work.work_category = 2"). // 视频类型
|
||||||
Where("cwe.cost_type in ?", []int{2, 3}). // 增值类型
|
Where("cwe.cost_type in ?", []int{2, 3}). // 增值类型
|
||||||
|
Where("cast_work.status != 8").
|
||||||
|
Where("cast_work.origin_uuid = ''").
|
||||||
Where("cast_work.deleted_at = 0")
|
Where("cast_work.deleted_at = 0")
|
||||||
if req.BundleUuid != "" {
|
if req.BundleUuid != "" {
|
||||||
queryIncreaseVideo = queryIncreaseVideo.Where("ccl.bundle_uuid = ?", req.BundleUuid)
|
queryIncreaseVideo = queryIncreaseVideo.Where("ccl.bundle_uuid = ?", req.BundleUuid)
|
||||||
@ -436,6 +456,7 @@ func MetricsBusiness(req *bundle.MetricsBusinessReq) (result *bundle.MetricsBusi
|
|||||||
Where("cast_work.work_category = 1").
|
Where("cast_work.work_category = 1").
|
||||||
Where("cast_work.submit_time >= ?", req.Start+" 00:00:00").
|
Where("cast_work.submit_time >= ?", req.Start+" 00:00:00").
|
||||||
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
||||||
|
Where("cast_work.origin_uuid = ''").
|
||||||
Where("cast_work.deleted_at = 0")
|
Where("cast_work.deleted_at = 0")
|
||||||
|
|
||||||
if req.BundleUuid != "" {
|
if req.BundleUuid != "" {
|
||||||
@ -455,6 +476,7 @@ func MetricsBusiness(req *bundle.MetricsBusinessReq) (result *bundle.MetricsBusi
|
|||||||
Where("cast_work.work_category = 1").
|
Where("cast_work.work_category = 1").
|
||||||
Where("cast_work.submit_time >= ?", req.Start+" 00:00:00").
|
Where("cast_work.submit_time >= ?", req.Start+" 00:00:00").
|
||||||
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
||||||
|
Where("cast_work.origin_uuid = ''").
|
||||||
Where("cast_work.deleted_at = 0 and bor.deleted_at IS NULL and bb.deleted_at IS NULL").
|
Where("cast_work.deleted_at = 0 and bor.deleted_at IS NULL and bb.deleted_at IS NULL").
|
||||||
Where("bor.bundle_uuid = ?", req.BundleUuid)
|
Where("bor.bundle_uuid = ?", req.BundleUuid)
|
||||||
err = query.Count(&newImageUsed).Error
|
err = query.Count(&newImageUsed).Error
|
||||||
@ -470,6 +492,8 @@ func MetricsBusiness(req *bundle.MetricsBusinessReq) (result *bundle.MetricsBusi
|
|||||||
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
||||||
Where("cast_work.work_category = 1"). // 图文类型
|
Where("cast_work.work_category = 1"). // 图文类型
|
||||||
Where("cwe.cost_type = 1 "). // 套餐类型
|
Where("cwe.cost_type = 1 "). // 套餐类型
|
||||||
|
Where("cast_work.status != 8").
|
||||||
|
Where("cast_work.origin_uuid = ''").
|
||||||
Where("cast_work.deleted_at = 0")
|
Where("cast_work.deleted_at = 0")
|
||||||
if req.BundleUuid != "" {
|
if req.BundleUuid != "" {
|
||||||
queryBundleImage = queryBundleImage.Where("ccl.bundle_uuid = ?", req.BundleUuid)
|
queryBundleImage = queryBundleImage.Where("ccl.bundle_uuid = ?", req.BundleUuid)
|
||||||
@ -486,6 +510,8 @@ func MetricsBusiness(req *bundle.MetricsBusinessReq) (result *bundle.MetricsBusi
|
|||||||
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
||||||
Where("cast_work.work_category = 1"). // 图文类型
|
Where("cast_work.work_category = 1"). // 图文类型
|
||||||
Where("cwe.cost_type in ?", []int{2, 3}). // 增值类型
|
Where("cwe.cost_type in ?", []int{2, 3}). // 增值类型
|
||||||
|
Where("cast_work.status != 8").
|
||||||
|
Where("cast_work.origin_uuid = ''").
|
||||||
Where("cast_work.deleted_at = 0")
|
Where("cast_work.deleted_at = 0")
|
||||||
if req.BundleUuid != "" {
|
if req.BundleUuid != "" {
|
||||||
queryIncreaseImage = queryIncreaseImage.Where("ccl.bundle_uuid = ?", req.BundleUuid)
|
queryIncreaseImage = queryIncreaseImage.Where("ccl.bundle_uuid = ?", req.BundleUuid)
|
||||||
@ -502,18 +528,17 @@ func MetricsBusiness(req *bundle.MetricsBusinessReq) (result *bundle.MetricsBusi
|
|||||||
UnUsedDataAnalysis int64 `gorm:"column:un_used_data_analysis"`
|
UnUsedDataAnalysis int64 `gorm:"column:un_used_data_analysis"`
|
||||||
}
|
}
|
||||||
var dataAnalysisCountInfo DataAnalysisCountResult
|
var dataAnalysisCountInfo DataAnalysisCountResult
|
||||||
query = app.ModuleClients.BundleDB.Model(&model.CastWork{}).
|
query = app.ModuleClients.BundleDB.Table("cast_work_analysis as cwa").
|
||||||
Select(`
|
Select(`
|
||||||
SUM(CASE WHEN ccl.uuid IS NOT NULL AND ccl.deleted_at = 0 THEN 1 ELSE 0 END) AS data_analysis_used,
|
SUM(CASE WHEN ccal.uuid IS NOT NULL AND ccal.deleted_at = 0 THEN 1 ELSE 0 END) AS data_analysis_used,
|
||||||
SUM(CASE WHEN ccl.uuid IS NULL THEN 1 ELSE 0 END) AS un_used_data_analysis
|
SUM(CASE WHEN ccal.uuid IS NULL THEN 1 ELSE 0 END) AS un_used_data_analysis
|
||||||
`).
|
`).
|
||||||
Joins("left join cast_cost_log ccl on ccl.work_uuid = cast_work.uuid").
|
Joins("left join cast_cost_analysis_log ccal on ccal.analysis_uuid = cwa.uuid").
|
||||||
Where("cast_work.work_category = 3").
|
Where("cwa.submit_time >= ?", req.Start+" 00:00:00").
|
||||||
Where("cast_work.submit_time >= ?", req.Start+" 00:00:00").
|
Where("cwa.submit_time <= ?", req.End+" 23:59:59").
|
||||||
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
Where("cwa.deleted_at = 0")
|
||||||
Where("cast_work.deleted_at = 0")
|
|
||||||
if req.BundleUuid != "" {
|
if req.BundleUuid != "" {
|
||||||
query = query.Where("ccl.bundle_uuid = ?", req.BundleUuid)
|
query = query.Where("ccal.bundle_uuid = ?", req.BundleUuid)
|
||||||
}
|
}
|
||||||
err = query.Scan(&dataAnalysisCountInfo).Error
|
err = query.Scan(&dataAnalysisCountInfo).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -523,52 +548,121 @@ func MetricsBusiness(req *bundle.MetricsBusinessReq) (result *bundle.MetricsBusi
|
|||||||
if req.BundleUuid == "" {
|
if req.BundleUuid == "" {
|
||||||
newDataAnalysisUsed = dataAnalysisCountInfo.DataAnalysisUsed + dataAnalysisCountInfo.UnUsedDataAnalysis
|
newDataAnalysisUsed = dataAnalysisCountInfo.DataAnalysisUsed + dataAnalysisCountInfo.UnUsedDataAnalysis
|
||||||
} else {
|
} else {
|
||||||
query = app.ModuleClients.BundleDB.Model(&model.CastWork{}).
|
query = app.ModuleClients.BundleDB.Table("cast_work_analysis as cwa").
|
||||||
Joins("left join bundle_balance bb ON CAST(bb.user_id AS CHAR) COLLATE utf8mb4_general_ci = cast_work.artist_uuid COLLATE utf8mb4_general_ci AND cast_work.submit_time >= bb.start_at AND cast_work.submit_time <= bb.expired_at and bb.month = DATE_FORMAT(cast_work.submit_time, '%Y-%m')").
|
Joins("left join bundle_balance bb ON CAST(bb.user_id AS CHAR) COLLATE utf8mb4_general_ci = cwa.artist_id COLLATE utf8mb4_general_ci AND cwa.submit_time >= bb.start_at AND cwa.submit_time <= bb.expired_at and bb.month = DATE_FORMAT(cwa.submit_time, '%Y-%m')").
|
||||||
Joins("left join bundle_order_records bor ON bor.uuid = bb.order_uuid").
|
Joins("left join bundle_order_records bor ON bor.uuid = bb.order_uuid").
|
||||||
Where("cast_work.work_category = 3").
|
Where("cwa.submit_time >= ?", req.Start+" 00:00:00").
|
||||||
Where("cast_work.submit_time >= ?", req.Start+" 00:00:00").
|
Where("cwa.submit_time <= ?", req.End+" 23:59:59").
|
||||||
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
Where("cwa.deleted_at = 0 and bor.deleted_at IS NULL and bb.deleted_at IS NULL").
|
||||||
Where("cast_work.deleted_at = 0 and bor.deleted_at IS NULL and bb.deleted_at IS NULL").
|
|
||||||
Where("bor.bundle_uuid = ?", req.BundleUuid)
|
Where("bor.bundle_uuid = ?", req.BundleUuid)
|
||||||
err = query.Count(&newDataAnalysisUsed).Error
|
err = query.Count(&newDataAnalysisUsed).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//数据分析套餐总已上传数
|
||||||
var totalUploadedBundleDataAnalysisCount int64
|
var totalUploadedBundleDataAnalysisCount int64
|
||||||
queryBundleDataAnalysis := app.ModuleClients.BundleDB.Model(&model.CastWork{}).
|
queryBundleDataAnalysis := app.ModuleClients.BundleDB.Table("cast_work_analysis as cwa").
|
||||||
Joins("left join cast_work_extra cwe on cwe.work_uuid = cast_work.uuid").
|
Joins("left join cast_work_analysis_extra cwae on cwae.analysis_uuid = cwa.uuid AND cwae.deleted_at = 0").
|
||||||
Joins("left join cast_cost_log ccl on ccl.work_uuid = cast_work.uuid AND ccl.deleted_at = 0").
|
Joins("left join cast_cost_analysis_log ccal on ccal.analysis_uuid = cwa.uuid AND ccal.deleted_at = 0").
|
||||||
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
Where("cwa.submit_time <= ?", req.End+" 23:59:59").
|
||||||
Where("cast_work.work_category = 3"). // 数据分析类型
|
Where("cwae.cost_type = 1"). // 套餐类型
|
||||||
Where("cwe.cost_type = 1"). // 套餐类型
|
Where("cwa.deleted_at = 0")
|
||||||
Where("cast_work.deleted_at = 0")
|
|
||||||
if req.BundleUuid != "" {
|
if req.BundleUuid != "" {
|
||||||
queryBundleDataAnalysis = queryBundleDataAnalysis.Where("ccl.bundle_uuid = ?", req.BundleUuid)
|
queryBundleDataAnalysis = queryBundleDataAnalysis.Where("ccal.bundle_uuid = ?", req.BundleUuid)
|
||||||
}
|
}
|
||||||
err = queryBundleDataAnalysis.Count(&totalUploadedBundleDataAnalysisCount).Error
|
err = queryBundleDataAnalysis.Count(&totalUploadedBundleDataAnalysisCount).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
//数据分析增值总已上传数
|
||||||
var totalUploadedIncreaseDataAnalysisCount int64
|
var totalUploadedIncreaseDataAnalysisCount int64
|
||||||
queryIncreaseDataAnalysis := app.ModuleClients.BundleDB.Model(&model.CastWork{}).
|
queryIncreaseDataAnalysis := app.ModuleClients.BundleDB.Table("cast_work_analysis as cwa").
|
||||||
Joins("left join cast_work_extra cwe on cwe.work_uuid = cast_work.uuid AND cwe.deleted_at = 0").
|
Joins("left join cast_work_analysis_extra cwae on cwae.analysis_uuid = cwa.uuid AND cwae.deleted_at = 0").
|
||||||
Joins("left join cast_cost_log ccl on ccl.work_uuid = cast_work.uuid AND ccl.deleted_at = 0").
|
Joins("left join cast_cost_analysis_log ccal on ccal.analysis_uuid = cwa.uuid AND ccal.deleted_at = 0").
|
||||||
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
Where("cwa.submit_time <= ?", req.End+" 23:59:59").
|
||||||
Where("cast_work.work_category = 3"). // 数据分析类型
|
Where("cwae.cost_type in ?", []int{2, 3}). // 增值类型
|
||||||
Where("cwe.cost_type in ?", []int{2, 3}). // 增值类型
|
Where("cwa.deleted_at = 0")
|
||||||
Where("cast_work.deleted_at = 0")
|
|
||||||
if req.BundleUuid != "" {
|
if req.BundleUuid != "" {
|
||||||
queryIncreaseDataAnalysis = queryIncreaseDataAnalysis.Where("ccl.bundle_uuid = ?", req.BundleUuid)
|
queryIncreaseDataAnalysis = queryIncreaseDataAnalysis.Where("ccal.bundle_uuid = ?", req.BundleUuid)
|
||||||
}
|
}
|
||||||
err = queryIncreaseDataAnalysis.Count(&totalUploadedIncreaseDataAnalysisCount).Error
|
err = queryIncreaseDataAnalysis.Count(&totalUploadedIncreaseDataAnalysisCount).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//==================竞品数====================
|
||||||
|
var newConpetitiveUsed int64
|
||||||
|
type ConpetitiveResult struct {
|
||||||
|
ConpetitiveUsed int64 `gorm:"column:conpetitive_used"`
|
||||||
|
UnUsedConpetitive int64 `gorm:"column:un_used_conpetitive"`
|
||||||
|
}
|
||||||
|
var conpetitiveCountInfo ConpetitiveResult
|
||||||
|
query = app.ModuleClients.BundleDB.Table("cast_competitive_report as ccr").
|
||||||
|
Select(`
|
||||||
|
SUM(CASE WHEN cccrl.uuid IS NOT NULL AND cccrl.deleted_at = 0 THEN 1 ELSE 0 END) AS conpetitive_used,
|
||||||
|
SUM(CASE WHEN cccrl.uuid IS NULL THEN 1 ELSE 0 END) AS un_used_conpetitive
|
||||||
|
`).
|
||||||
|
Joins("left join cast_cost_competitive_report_log cccrl on cccrl.report_uuid = ccr.uuid").
|
||||||
|
Where("ccr.submit_time >= ?", req.Start+" 00:00:00").
|
||||||
|
Where("ccr.submit_time <= ?", req.End+" 23:59:59").
|
||||||
|
Where("ccr.deleted_at = 0")
|
||||||
|
if req.BundleUuid != "" {
|
||||||
|
query = query.Where("cccrl.bundle_uuid = ?", req.BundleUuid)
|
||||||
|
}
|
||||||
|
err = query.Scan(&conpetitiveCountInfo).Error
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if req.BundleUuid == "" {
|
||||||
|
newConpetitiveUsed = conpetitiveCountInfo.ConpetitiveUsed + conpetitiveCountInfo.UnUsedConpetitive
|
||||||
|
} else {
|
||||||
|
query = app.ModuleClients.BundleDB.Table("cast_competitive_report as ccr").
|
||||||
|
Joins("left join bundle_balance bb ON CAST(bb.user_id AS CHAR) COLLATE utf8mb4_general_ci = ccr.artist_id COLLATE utf8mb4_general_ci AND ccr.submit_time >= bb.start_at AND ccr.submit_time <= bb.expired_at and bb.month = DATE_FORMAT(ccr.submit_time, '%Y-%m')").
|
||||||
|
Joins("left join bundle_order_records bor ON bor.uuid = bb.order_uuid").
|
||||||
|
Where("ccr.submit_time >= ?", req.Start+" 00:00:00").
|
||||||
|
Where("ccr.submit_time <= ?", req.End+" 23:59:59").
|
||||||
|
Where("ccr.deleted_at = 0 and bor.deleted_at IS NULL and bb.deleted_at IS NULL").
|
||||||
|
Where("bor.bundle_uuid = ?", req.BundleUuid)
|
||||||
|
err = query.Count(&newConpetitiveUsed).Error
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//竞品数套餐总已上传数
|
||||||
|
var totalUploadedBundleConpetitiveCount int64
|
||||||
|
queryBundleConpetitive := app.ModuleClients.BundleDB.Table("cast_competitive_report as ccr").
|
||||||
|
Joins("left join cast_cost_competitive_report_log cccrl on cccrl.report_uuid = ccr.uuid AND cccrl.deleted_at = 0").
|
||||||
|
Joins("left join cast_competitive_report_extra ccrpe on ccrpe.report_uuid = ccr.uuid AND ccrpe.deleted_at = 0").
|
||||||
|
Where("ccr.submit_time <= ?", req.End+" 23:59:59").
|
||||||
|
Where("ccrpe.cost_type = 1"). // 套餐类型
|
||||||
|
Where("ccr.deleted_at = 0")
|
||||||
|
if req.BundleUuid != "" {
|
||||||
|
queryBundleConpetitive = queryBundleConpetitive.Where("cccrl.bundle_uuid = ?", req.BundleUuid)
|
||||||
|
}
|
||||||
|
err = queryBundleConpetitive.Count(&totalUploadedBundleConpetitiveCount).Error
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
//竞品数增值总已上传数
|
||||||
|
var totalUploadedIncreaseConpetitiveCount int64
|
||||||
|
queryIncreaseConpetitive := app.ModuleClients.BundleDB.Table("cast_competitive_report as ccr").
|
||||||
|
Joins("left join cast_cost_competitive_report_log cccrl on cccrl.report_uuid = ccr.uuid AND cccrl.deleted_at = 0").
|
||||||
|
Joins("left join cast_competitive_report_extra ccrpe on ccrpe.report_uuid = ccr.uuid AND ccrpe.deleted_at = 0").
|
||||||
|
Where("ccr.submit_time <= ?", req.End+" 23:59:59").
|
||||||
|
Where("ccrpe.cost_type in ?", []int{2, 3}). // 增值类型
|
||||||
|
Where("ccr.deleted_at = 0")
|
||||||
|
if req.BundleUuid != "" {
|
||||||
|
queryIncreaseConpetitive = queryIncreaseConpetitive.Where("cccrl.bundle_uuid = ?", req.BundleUuid)
|
||||||
|
}
|
||||||
|
err = queryIncreaseConpetitive.Count(&totalUploadedIncreaseConpetitiveCount).Error
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
//获取手动增加套餐额度
|
//获取手动增加套餐额度
|
||||||
manualIncreaseBalance, err := manualIncreaseBundleBalance(req.Start+" 00:00:00", req.End+" 23:59:59", req.BundleUuid)
|
manualIncreaseBalance, err := manualIncreaseBundleBalance(req.Start+" 00:00:00", req.End+" 23:59:59", req.BundleUuid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -587,6 +681,8 @@ func MetricsBusiness(req *bundle.MetricsBusinessReq) (result *bundle.MetricsBusi
|
|||||||
result.NewUploadedImageCount = newImageUsed
|
result.NewUploadedImageCount = newImageUsed
|
||||||
//----------数据分析---------
|
//----------数据分析---------
|
||||||
result.NewUploadedDataAnalysisCount = newDataAnalysisUsed
|
result.NewUploadedDataAnalysisCount = newDataAnalysisUsed
|
||||||
|
//----------竞品数---------
|
||||||
|
result.NewUploadedCompetitiveCount = newConpetitiveUsed
|
||||||
|
|
||||||
// ==============数据分析暂时没数据============
|
// ==============数据分析暂时没数据============
|
||||||
|
|
||||||
@ -617,7 +713,9 @@ func MetricsBusiness(req *bundle.MetricsBusinessReq) (result *bundle.MetricsBusi
|
|||||||
//数据分析
|
//数据分析
|
||||||
result.NewPendingUploadDataAnalysisCount = int64(BundleRelease.DataAnalysis) + int64(BundleAutoRelease.DataAnalysis) + int64(IncreaseRelease.DataAnalysis) + int64(IncreaseAutoRelease.DataAnalysis) + int64(manualIncreaseBalance.TotalDataAnalysisAdditional)
|
result.NewPendingUploadDataAnalysisCount = int64(BundleRelease.DataAnalysis) + int64(BundleAutoRelease.DataAnalysis) + int64(IncreaseRelease.DataAnalysis) + int64(IncreaseAutoRelease.DataAnalysis) + int64(manualIncreaseBalance.TotalDataAnalysisAdditional)
|
||||||
result.TotalPendingUploadDataAnalysisCount = int64(endBundleRelease.DataAnalysis) + int64(endIncreaseRelease.DataAnalysis) - int64(totalUploadedBundleDataAnalysisCount) - int64(totalUploadedIncreaseDataAnalysisCount) + int64(totalManualIncreaseBalance.TotalDataAnalysisAdditional)
|
result.TotalPendingUploadDataAnalysisCount = int64(endBundleRelease.DataAnalysis) + int64(endIncreaseRelease.DataAnalysis) - int64(totalUploadedBundleDataAnalysisCount) - int64(totalUploadedIncreaseDataAnalysisCount) + int64(totalManualIncreaseBalance.TotalDataAnalysisAdditional)
|
||||||
|
//竞品数
|
||||||
|
result.NewPendingUploadCompetitiveCount = int64(BundleRelease.Competitive) + int64(BundleAutoRelease.Competitive) + int64(IncreaseRelease.Competitive) + int64(IncreaseAutoRelease.Competitive) + int64(manualIncreaseBalance.TotalCompetitiveAdditional)
|
||||||
|
result.TotalPendingUploadCompetitiveCount = int64(endBundleRelease.Competitive) + int64(endIncreaseRelease.Competitive) - int64(totalUploadedBundleConpetitiveCount) - int64(totalUploadedIncreaseConpetitiveCount) + int64(totalManualIncreaseBalance.TotalCompetitiveAdditional)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -634,6 +732,7 @@ type BalanceInfo struct {
|
|||||||
Video int
|
Video int
|
||||||
Image int
|
Image int
|
||||||
DataAnalysis int
|
DataAnalysis int
|
||||||
|
Competitive int
|
||||||
}
|
}
|
||||||
|
|
||||||
func MetricsOperatingCreate(req *bundle.MetricsOperatingCreateReq) (result *bundle.MetricsOperatingCreateResp, err error) {
|
func MetricsOperatingCreate(req *bundle.MetricsOperatingCreateReq) (result *bundle.MetricsOperatingCreateResp, err error) {
|
||||||
@ -645,6 +744,7 @@ func MetricsOperatingCreate(req *bundle.MetricsOperatingCreateReq) (result *bund
|
|||||||
Where("cast_work.submit_time >= ?", req.Start+" 00:00:00").
|
Where("cast_work.submit_time >= ?", req.Start+" 00:00:00").
|
||||||
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
||||||
Where("work_category = 2"). // 视频类型
|
Where("work_category = 2"). // 视频类型
|
||||||
|
Where("cast_work.origin_uuid = ''").
|
||||||
// Where("cwe.cost_type = 1"). // 套餐类型
|
// Where("cwe.cost_type = 1"). // 套餐类型
|
||||||
Where("deleted_at = 0").
|
Where("deleted_at = 0").
|
||||||
Count(&newUploadedBundleVideoCount)
|
Count(&newUploadedBundleVideoCount)
|
||||||
@ -665,6 +765,7 @@ func MetricsOperatingCreate(req *bundle.MetricsOperatingCreateReq) (result *bund
|
|||||||
// Joins("left join cast_work_extra cwe on cwe.work_uuid = cast_work.uuid").
|
// Joins("left join cast_work_extra cwe on cwe.work_uuid = cast_work.uuid").
|
||||||
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
||||||
Where("work_category = 2"). // 视频类型
|
Where("work_category = 2"). // 视频类型
|
||||||
|
Where("cast_work.origin_uuid = ''").
|
||||||
// Where("cwe.cost_type = 1"). // 套餐类型
|
// Where("cwe.cost_type = 1"). // 套餐类型
|
||||||
Where("deleted_at = 0").
|
Where("deleted_at = 0").
|
||||||
Count(&totalUploadedVideoCount)
|
Count(&totalUploadedVideoCount)
|
||||||
@ -676,6 +777,8 @@ func MetricsOperatingCreate(req *bundle.MetricsOperatingCreateReq) (result *bund
|
|||||||
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
||||||
Where("work_category = 2"). // 视频类型
|
Where("work_category = 2"). // 视频类型
|
||||||
Where("cwe.cost_type = 1"). // 套餐类型
|
Where("cwe.cost_type = 1"). // 套餐类型
|
||||||
|
Where("cast_work.status != 8").
|
||||||
|
Where("cast_work.origin_uuid = ''").
|
||||||
Where("cast_work.deleted_at = 0 and cwe.deleted_at = 0").
|
Where("cast_work.deleted_at = 0 and cwe.deleted_at = 0").
|
||||||
Count(&totalUploadedBundleVideoCount)
|
Count(&totalUploadedBundleVideoCount)
|
||||||
|
|
||||||
@ -685,6 +788,8 @@ func MetricsOperatingCreate(req *bundle.MetricsOperatingCreateReq) (result *bund
|
|||||||
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
||||||
Where("work_category = 2"). // 视频类型
|
Where("work_category = 2"). // 视频类型
|
||||||
Where("cwe.cost_type in ?", []int{2, 3}). // 增值类型或扩展类型
|
Where("cwe.cost_type in ?", []int{2, 3}). // 增值类型或扩展类型
|
||||||
|
Where("cast_work.status != 8").
|
||||||
|
Where("cast_work.origin_uuid = ''").
|
||||||
Where("cast_work.deleted_at = 0 and cwe.deleted_at = 0").
|
Where("cast_work.deleted_at = 0 and cwe.deleted_at = 0").
|
||||||
Count(&totalUploadedIncreaseVideoCount)
|
Count(&totalUploadedIncreaseVideoCount)
|
||||||
|
|
||||||
@ -711,6 +816,7 @@ func MetricsOperatingCreate(req *bundle.MetricsOperatingCreateReq) (result *bund
|
|||||||
Where("cast_work.submit_time >= ?", req.Start+" 00:00:00").
|
Where("cast_work.submit_time >= ?", req.Start+" 00:00:00").
|
||||||
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
||||||
Where("work_category = 1"). // 图文类型
|
Where("work_category = 1"). // 图文类型
|
||||||
|
Where("cast_work.origin_uuid = ''").
|
||||||
// Where("cwe.cost_type = 1"). // 套餐类型
|
// Where("cwe.cost_type = 1"). // 套餐类型
|
||||||
Where("deleted_at = 0").
|
Where("deleted_at = 0").
|
||||||
Count(&newUploadedBundleImageCount)
|
Count(&newUploadedBundleImageCount)
|
||||||
@ -731,6 +837,8 @@ func MetricsOperatingCreate(req *bundle.MetricsOperatingCreateReq) (result *bund
|
|||||||
// Joins("left join cast_work_extra cwe on cwe.work_uuid = cast_work.uuid").
|
// Joins("left join cast_work_extra cwe on cwe.work_uuid = cast_work.uuid").
|
||||||
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
||||||
Where("work_category = 1"). // 图文类型
|
Where("work_category = 1"). // 图文类型
|
||||||
|
Where("cast_work.origin_uuid = ''").
|
||||||
|
Where("cast_work.status != 8").
|
||||||
// Where("cwe.cost_type = 2"). // 套餐类型
|
// Where("cwe.cost_type = 2"). // 套餐类型
|
||||||
Where("deleted_at = 0").
|
Where("deleted_at = 0").
|
||||||
Count(&totalUploadedImageCount)
|
Count(&totalUploadedImageCount)
|
||||||
@ -742,6 +850,8 @@ func MetricsOperatingCreate(req *bundle.MetricsOperatingCreateReq) (result *bund
|
|||||||
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
||||||
Where("work_category = 1"). // 图文类型
|
Where("work_category = 1"). // 图文类型
|
||||||
Where("cwe.cost_type = 1"). // 套餐类型
|
Where("cwe.cost_type = 1"). // 套餐类型
|
||||||
|
Where("cast_work.status != 8").
|
||||||
|
Where("cast_work.origin_uuid = ''").
|
||||||
Where("cast_work.deleted_at = 0 and cwe.deleted_at = 0").
|
Where("cast_work.deleted_at = 0 and cwe.deleted_at = 0").
|
||||||
Count(&totalUploadedBundleImageCount)
|
Count(&totalUploadedBundleImageCount)
|
||||||
|
|
||||||
@ -751,45 +861,74 @@ func MetricsOperatingCreate(req *bundle.MetricsOperatingCreateReq) (result *bund
|
|||||||
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
||||||
Where("work_category = 1"). // 图文类型
|
Where("work_category = 1"). // 图文类型
|
||||||
Where("cwe.cost_type in ?", []int{2, 3}). // 增值类型
|
Where("cwe.cost_type in ?", []int{2, 3}). // 增值类型
|
||||||
|
Where("cast_work.origin_uuid = ''").
|
||||||
Where("cast_work.deleted_at = 0 and cwe.deleted_at = 0").
|
Where("cast_work.deleted_at = 0 and cwe.deleted_at = 0").
|
||||||
Count(&totalUploadedIncreaseImageCount)
|
Count(&totalUploadedIncreaseImageCount)
|
||||||
|
|
||||||
//====================数据分析=======================
|
//====================数据分析=======================
|
||||||
var newUploadedBundleDataAnalysisCount int64
|
var newUploadedBundleDataAnalysisCount int64
|
||||||
app.ModuleClients.BundleDB.Model(&model.CastWork{}).
|
app.ModuleClients.BundleDB.Table("cast_work_analysis as cwa").
|
||||||
Where("cast_work.submit_time >= ?", req.Start+" 00:00:00").
|
Where("cwa.submit_time >= ?", req.Start+" 00:00:00").
|
||||||
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
Where("cwa.submit_time <= ?", req.End+" 23:59:59").
|
||||||
Where("work_category = 3"). // 数据分析类型
|
Where("cwa.deleted_at = 0").
|
||||||
Where("deleted_at = 0").
|
|
||||||
Count(&newUploadedBundleDataAnalysisCount)
|
Count(&newUploadedBundleDataAnalysisCount)
|
||||||
result.NewUploadedBundleDataAnalysisCount = newUploadedBundleDataAnalysisCount
|
result.NewUploadedBundleDataAnalysisCount = newUploadedBundleDataAnalysisCount
|
||||||
|
|
||||||
var totalUploadedDataAnalysisCount int64
|
var totalUploadedDataAnalysisCount int64
|
||||||
app.ModuleClients.BundleDB.Model(&model.CastWork{}).
|
app.ModuleClients.BundleDB.Table("cast_work_analysis as cwa").
|
||||||
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
Where("cwa.submit_time <= ?", req.End+" 23:59:59").
|
||||||
Where("work_category = 3"). // 数据分析类型
|
Where("cwa.deleted_at = 0").
|
||||||
Where("deleted_at = 0").
|
|
||||||
Count(&totalUploadedDataAnalysisCount)
|
Count(&totalUploadedDataAnalysisCount)
|
||||||
result.TotalUploadedBundleDataAnalysisCount = totalUploadedDataAnalysisCount
|
result.TotalUploadedBundleDataAnalysisCount = totalUploadedDataAnalysisCount
|
||||||
|
|
||||||
var totalUploadedBundleDataAnalysisCount int64
|
var totalUploadedBundleDataAnalysisCount int64
|
||||||
app.ModuleClients.BundleDB.Model(&model.CastWork{}).
|
app.ModuleClients.BundleDB.Table("cast_work_analysis as cwa").
|
||||||
Joins("left join cast_work_extra cwe on cwe.work_uuid = cast_work.uuid").
|
Joins("left join cast_work_analysis_extra cwae on cwae.analysis_uuid = cwa.uuid AND cwae.deleted_at = 0").
|
||||||
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
Where("cwa.submit_time <= ?", req.End+" 23:59:59").
|
||||||
Where("work_category = 3"). // 数据分析类型
|
Where("cwae.cost_type = 1"). // 套餐类型
|
||||||
Where("cwe.cost_type = 1"). // 套餐类型
|
Where("cwa.deleted_at = 0 and cwae.deleted_at = 0").
|
||||||
Where("cast_work.deleted_at = 0 and cwe.deleted_at = 0").
|
|
||||||
Count(&totalUploadedBundleDataAnalysisCount)
|
Count(&totalUploadedBundleDataAnalysisCount)
|
||||||
|
|
||||||
var totalUploadedIncreaseDataAnalysisCount int64
|
var totalUploadedIncreaseDataAnalysisCount int64
|
||||||
app.ModuleClients.BundleDB.Model(&model.CastWork{}).
|
app.ModuleClients.BundleDB.Table("cast_work_analysis as cwa").
|
||||||
Joins("left join cast_work_extra cwe on cwe.work_uuid = cast_work.uuid AND cwe.deleted_at = 0").
|
Joins("left join cast_work_analysis_extra cwae on cwae.analysis_uuid = cwa.uuid AND cwae.deleted_at = 0").
|
||||||
Where("cast_work.submit_time <= ?", req.End+" 23:59:59").
|
Where("cwa.submit_time <= ?", req.End+" 23:59:59").
|
||||||
Where("work_category = 3"). // 数据分析类型
|
Where("cwae.cost_type in ?", []int{2, 3}). // 增值类型
|
||||||
Where("cwe.cost_type in ?", []int{2, 3}). // 增值类型
|
Where("cwa.deleted_at = 0 and cwae.deleted_at = 0").
|
||||||
Where("cast_work.deleted_at = 0 and cwe.deleted_at = 0").
|
|
||||||
Count(&totalUploadedIncreaseDataAnalysisCount)
|
Count(&totalUploadedIncreaseDataAnalysisCount)
|
||||||
|
|
||||||
|
//====================竞品数=======================
|
||||||
|
var newUploadedBundleCompetitiveCount int64
|
||||||
|
app.ModuleClients.BundleDB.Table("cast_competitive_report as ccr").
|
||||||
|
Where("ccr.submit_time >= ?", req.Start+" 00:00:00").
|
||||||
|
Where("ccr.submit_time <= ?", req.End+" 23:59:59").
|
||||||
|
Where("ccr.deleted_at = 0").
|
||||||
|
Count(&newUploadedBundleCompetitiveCount)
|
||||||
|
result.NewUploadedBundleCompetitiveCount = newUploadedBundleCompetitiveCount
|
||||||
|
|
||||||
|
var totalUploadedCompetitiveCount int64
|
||||||
|
app.ModuleClients.BundleDB.Table("cast_competitive_report as ccr").
|
||||||
|
Where("ccr.submit_time <= ?", req.End+" 23:59:59").
|
||||||
|
Where("ccr.deleted_at = 0").
|
||||||
|
Count(&totalUploadedCompetitiveCount)
|
||||||
|
result.TotalUploadedBundleCompetitiveCount = totalUploadedCompetitiveCount
|
||||||
|
|
||||||
|
var totalUploadedBundleCompetitiveCount int64
|
||||||
|
app.ModuleClients.BundleDB.Table("cast_competitive_report as ccr").
|
||||||
|
Joins("left join cast_competitive_report_extra ccre on ccre.report_uuid = ccr.uuid AND ccre.deleted_at = 0").
|
||||||
|
Where("ccr.submit_time <= ?", req.End+" 23:59:59").
|
||||||
|
Where("ccre.cost_type = 1"). // 套餐类型
|
||||||
|
Where("ccr.deleted_at = 0 and ccre.deleted_at = 0").
|
||||||
|
Count(&totalUploadedBundleCompetitiveCount)
|
||||||
|
|
||||||
|
var totalUploadedIncreaseCompetitiveCount int64
|
||||||
|
app.ModuleClients.BundleDB.Table("cast_competitive_report as ccr").
|
||||||
|
Joins("left join cast_competitive_report_extra ccre on ccre.report_uuid = ccr.uuid AND ccre.deleted_at = 0").
|
||||||
|
Where("ccr.submit_time <= ?", req.End+" 23:59:59").
|
||||||
|
Where("ccre.cost_type in ?", []int{2, 3}). // 增值类型
|
||||||
|
Where("ccr.deleted_at = 0 and ccre.deleted_at = 0").
|
||||||
|
Count(&totalUploadedIncreaseCompetitiveCount)
|
||||||
|
|
||||||
endMonth := timeParse(req.End + " 23:59:59").Format("2006-01")
|
endMonth := timeParse(req.End + " 23:59:59").Format("2006-01")
|
||||||
startMonth := timeParse(req.Start + " 00:00:00").Format("2006-01")
|
startMonth := timeParse(req.Start + " 00:00:00").Format("2006-01")
|
||||||
|
|
||||||
@ -829,14 +968,18 @@ func MetricsOperatingCreate(req *bundle.MetricsOperatingCreateReq) (result *bund
|
|||||||
result.NewPendingUploadIncreaseDataAnalysisCount = int64(IncreaseRelease.DataAnalysis) + int64(IncreaseAutoRelease.DataAnalysis) + int64(manualIncreaseBalance.TotalDataAnalysisAdditional)
|
result.NewPendingUploadIncreaseDataAnalysisCount = int64(IncreaseRelease.DataAnalysis) + int64(IncreaseAutoRelease.DataAnalysis) + int64(manualIncreaseBalance.TotalDataAnalysisAdditional)
|
||||||
result.TotalPendingUploadBundleDataAnalysisCount = int64(endBundleRelease.DataAnalysis) - int64(totalUploadedBundleDataAnalysisCount)
|
result.TotalPendingUploadBundleDataAnalysisCount = int64(endBundleRelease.DataAnalysis) - int64(totalUploadedBundleDataAnalysisCount)
|
||||||
result.TotalPendingUploadIncreaseDataAnalysisCount = int64(endIncreaseRelease.DataAnalysis) - int64(totalUploadedIncreaseDataAnalysisCount) + int64(totalManualIncreaseBalance.TotalDataAnalysisAdditional)
|
result.TotalPendingUploadIncreaseDataAnalysisCount = int64(endIncreaseRelease.DataAnalysis) - int64(totalUploadedIncreaseDataAnalysisCount) + int64(totalManualIncreaseBalance.TotalDataAnalysisAdditional)
|
||||||
|
//竞品数
|
||||||
|
result.NewPendingUploadBundleCompetitiveCount = int64(BundleRelease.Competitive) + int64(BundleAutoRelease.Competitive)
|
||||||
|
result.NewPendingUploadIncreaseCompetitiveCount = int64(IncreaseRelease.Competitive) + int64(IncreaseAutoRelease.Competitive) + int64(manualIncreaseBalance.TotalCompetitiveAdditional)
|
||||||
|
result.TotalPendingUploadBundleCompetitiveCount = int64(endBundleRelease.Competitive) - int64(totalUploadedBundleCompetitiveCount)
|
||||||
|
result.TotalPendingUploadIncreaseCompetitiveCount = int64(endIncreaseRelease.Competitive) - int64(totalUploadedIncreaseCompetitiveCount) + int64(totalManualIncreaseBalance.TotalCompetitiveAdditional)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 手动扩套餐总数统计
|
// 手动扩套餐总数统计
|
||||||
func manualIncreaseBundleBalance(startTime string, endTime string, bundleUUID string) (data model.ManualIncreaseBundleBalance, err error) {
|
func manualIncreaseBundleBalance(startTime string, endTime string, bundleUUID string) (data model.ManualIncreaseBundleBalance, err error) {
|
||||||
quary := app.ModuleClients.BundleDB.Model(&model.BundleExtensionRecords{}).
|
quary := app.ModuleClients.BundleDB.Model(&model.BundleExtensionRecords{}).
|
||||||
Select("SUM(account_additional) as total_account_additional, SUM(video_additional) as total_video_additional, SUM(images_additional) as total_image_additional, SUM(data_additional) as total_data_analysis_additional").
|
Select("SUM(account_additional) as total_account_additional, SUM(video_additional) as total_video_additional, SUM(images_additional) as total_image_additional, SUM(data_additional) as total_data_analysis_additional, SUM(competitive_additional) as total_competitive_additional").
|
||||||
Where("bundle_extension_records.type = 1").
|
Where("bundle_extension_records.type = 1").
|
||||||
Where("bundle_extension_records.deleted_at is null")
|
Where("bundle_extension_records.deleted_at is null")
|
||||||
if startTime != "" {
|
if startTime != "" {
|
||||||
@ -879,7 +1022,12 @@ func balanceInfoWithShop(startMonth string, endMonth string, startTime string, e
|
|||||||
bb.bundle_data_analysis_number +
|
bb.bundle_data_analysis_number +
|
||||||
bb.monthly_bundle_limit_data_analysis_number +
|
bb.monthly_bundle_limit_data_analysis_number +
|
||||||
bb.monthly_bundle_limit_expired_data_analysis_number
|
bb.monthly_bundle_limit_expired_data_analysis_number
|
||||||
) AS data_analysis
|
) AS data_analysis,
|
||||||
|
(
|
||||||
|
bb.bundle_competitive_number +
|
||||||
|
bb.monthly_bundle_limit_competitive_number +
|
||||||
|
bb.monthly_bundle_limit_expired_competitive_number
|
||||||
|
) AS competitive
|
||||||
`). // 不限制类型的总数 + 限制不过期类型的当月可用 + 限制过期类型的当月可用 = 新增待上传数量
|
`). // 不限制类型的总数 + 限制不过期类型的当月可用 + 限制过期类型的当月可用 = 新增待上传数量
|
||||||
Joins("LEFT JOIN bundle_order_records bor ON bor.uuid = bb.order_uuid").
|
Joins("LEFT JOIN bundle_order_records bor ON bor.uuid = bb.order_uuid").
|
||||||
Joins(`INNER JOIN (
|
Joins(`INNER JOIN (
|
||||||
@ -908,7 +1056,8 @@ func balanceInfoWithShop(startMonth string, endMonth string, startTime string, e
|
|||||||
SUM(statistic.account) AS account,
|
SUM(statistic.account) AS account,
|
||||||
SUM(statistic.video) AS video,
|
SUM(statistic.video) AS video,
|
||||||
SUM(statistic.image) AS image,
|
SUM(statistic.image) AS image,
|
||||||
SUM(statistic.data_analysis) AS data_analysis
|
SUM(statistic.data_analysis) AS data_analysis,
|
||||||
|
SUM(statistic.competitive) AS competitive
|
||||||
`).
|
`).
|
||||||
Scan(&data)
|
Scan(&data)
|
||||||
return
|
return
|
||||||
@ -934,7 +1083,12 @@ func IncreasealanceInfoWithShop(startMonth string, endMonth string, startTime st
|
|||||||
bb.increase_data_analysis_number +
|
bb.increase_data_analysis_number +
|
||||||
bb.monthly_increase_limit_data_analysis_number +
|
bb.monthly_increase_limit_data_analysis_number +
|
||||||
bb.monthly_increase_limit_expired_data_analysis_number
|
bb.monthly_increase_limit_expired_data_analysis_number
|
||||||
) AS data_analysis
|
) AS data_analysis,
|
||||||
|
(
|
||||||
|
bb.increase_competitive_number +
|
||||||
|
bb.monthly_increase_limit_competitive_number +
|
||||||
|
bb.monthly_increase_limit_expired_competitive_number
|
||||||
|
) AS competitive
|
||||||
`). // 不限制类型的总数 + 限制不过期类型的当月可用 + 限制过期类型的当月可用 = 新增待上传数量
|
`). // 不限制类型的总数 + 限制不过期类型的当月可用 + 限制过期类型的当月可用 = 新增待上传数量
|
||||||
Joins("LEFT JOIN bundle_order_records bor ON bor.uuid = bb.order_uuid").
|
Joins("LEFT JOIN bundle_order_records bor ON bor.uuid = bb.order_uuid").
|
||||||
Joins(`INNER JOIN (
|
Joins(`INNER JOIN (
|
||||||
@ -962,7 +1116,8 @@ func IncreasealanceInfoWithShop(startMonth string, endMonth string, startTime st
|
|||||||
SUM(statistic.account) AS account,
|
SUM(statistic.account) AS account,
|
||||||
SUM(statistic.video) AS video,
|
SUM(statistic.video) AS video,
|
||||||
SUM(statistic.image) AS image,
|
SUM(statistic.image) AS image,
|
||||||
SUM(statistic.data_analysis) AS data_analysis
|
SUM(statistic.data_analysis) AS data_analysis,
|
||||||
|
SUM(statistic.competitive) AS competitive
|
||||||
`).
|
`).
|
||||||
Scan(&data)
|
Scan(&data)
|
||||||
return
|
return
|
||||||
@ -976,6 +1131,7 @@ func getBalanceInfo(month string, bundleUUID string) (data BalanceInfo) { // 获
|
|||||||
data.Video = bundle.Video + increase.Video
|
data.Video = bundle.Video + increase.Video
|
||||||
data.Image = bundle.Image + increase.Image
|
data.Image = bundle.Image + increase.Image
|
||||||
data.DataAnalysis = bundle.DataAnalysis + increase.DataAnalysis
|
data.DataAnalysis = bundle.DataAnalysis + increase.DataAnalysis
|
||||||
|
data.Competitive = bundle.Competitive + increase.Competitive
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1013,7 +1169,17 @@ func getBundleBalanceInfo(month string, bundleUUID string, endTime string) (data
|
|||||||
bb.bundle_limit_data_analysis_expired_consumption_number -
|
bb.bundle_limit_data_analysis_expired_consumption_number -
|
||||||
bb.monthly_bundle_limit_expired_data_analysis_consumption_number -
|
bb.monthly_bundle_limit_expired_data_analysis_consumption_number -
|
||||||
bb.monthly_bundle_limit_data_analysis_consumption_number
|
bb.monthly_bundle_limit_data_analysis_consumption_number
|
||||||
) AS data_analysis
|
) AS data_analysis,
|
||||||
|
(
|
||||||
|
bb.bundle_competitive_number +
|
||||||
|
bb.monthly_bundle_limit_competitive_number +
|
||||||
|
bb.monthly_bundle_limit_expired_competitive_number +
|
||||||
|
bb.invalid_bundle_competitive_number +
|
||||||
|
bb.bundle_limit_competitive_consumption_number +
|
||||||
|
bb.bundle_limit_competitive_expired_consumption_number -
|
||||||
|
bb.monthly_bundle_limit_expired_competitive_consumption_number -
|
||||||
|
bb.monthly_bundle_limit_competitive_consumption_number
|
||||||
|
) AS competitive
|
||||||
`). // 不限制类型的总数 + 限制不过期类型的当月可用 + 限制过期类型的当月可用 + 限制不过期类型的总共已用 + 限制过期类型的总共已用 + 已过期的数量 = 总发放数
|
`). // 不限制类型的总数 + 限制不过期类型的当月可用 + 限制过期类型的当月可用 + 限制不过期类型的总共已用 + 限制过期类型的总共已用 + 已过期的数量 = 总发放数
|
||||||
Joins("LEFT JOIN bundle_order_records bor ON bor.uuid = bb.order_uuid").
|
Joins("LEFT JOIN bundle_order_records bor ON bor.uuid = bb.order_uuid").
|
||||||
Where("bor.deleted_at is null and bor.status=2").
|
Where("bor.deleted_at is null and bor.status=2").
|
||||||
@ -1048,7 +1214,8 @@ func getBundleBalanceInfo(month string, bundleUUID string, endTime string) (data
|
|||||||
SUM(statistic.account) AS account,
|
SUM(statistic.account) AS account,
|
||||||
SUM(statistic.video) AS video,
|
SUM(statistic.video) AS video,
|
||||||
SUM(statistic.image) AS image,
|
SUM(statistic.image) AS image,
|
||||||
SUM(statistic.data_analysis) AS data_analysis
|
SUM(statistic.data_analysis) AS data_analysis,
|
||||||
|
SUM(statistic.competitive) AS competitive
|
||||||
`).
|
`).
|
||||||
Scan(&data)
|
Scan(&data)
|
||||||
return
|
return
|
||||||
@ -1088,7 +1255,17 @@ func getIncreaseBalanceInfo(month string, bundleUUID string, endTime string) (da
|
|||||||
bb.increase_limit_data_analysis_expired_consumption_number -
|
bb.increase_limit_data_analysis_expired_consumption_number -
|
||||||
bb.monthly_increase_limit_expired_data_analysis_consumption_number -
|
bb.monthly_increase_limit_expired_data_analysis_consumption_number -
|
||||||
bb.monthly_increase_limit_data_analysis_consumption_number
|
bb.monthly_increase_limit_data_analysis_consumption_number
|
||||||
) AS data_analysis
|
) AS data_analysis,
|
||||||
|
(
|
||||||
|
bb.increase_competitive_number +
|
||||||
|
bb.monthly_increase_limit_competitive_number +
|
||||||
|
bb.monthly_increase_limit_expired_competitive_number +
|
||||||
|
bb.invalid_increase_competitive_number +
|
||||||
|
bb.increase_limit_competitive_consumption_number +
|
||||||
|
bb.increase_limit_competitive_expired_consumption_number -
|
||||||
|
bb.monthly_increase_limit_expired_competitive_consumption_number -
|
||||||
|
bb.monthly_increase_limit_competitive_consumption_number
|
||||||
|
) AS competitive
|
||||||
`). // 不限制类型的总数 + 限制不过期类型的当月可用 + 限制过期类型的当月可用 + 限制不过期类型的总共已用 + 限制过期类型的总共已用 + 已过期的数量 = 总发放数
|
`). // 不限制类型的总数 + 限制不过期类型的当月可用 + 限制过期类型的当月可用 + 限制不过期类型的总共已用 + 限制过期类型的总共已用 + 已过期的数量 = 总发放数
|
||||||
Joins("LEFT JOIN bundle_order_records bor ON bor.uuid = bb.order_uuid").
|
Joins("LEFT JOIN bundle_order_records bor ON bor.uuid = bb.order_uuid").
|
||||||
Joins(`INNER JOIN (
|
Joins(`INNER JOIN (
|
||||||
@ -1123,7 +1300,8 @@ func getIncreaseBalanceInfo(month string, bundleUUID string, endTime string) (da
|
|||||||
SUM(statistic.account) AS account,
|
SUM(statistic.account) AS account,
|
||||||
SUM(statistic.video) AS video,
|
SUM(statistic.video) AS video,
|
||||||
SUM(statistic.image) AS image,
|
SUM(statistic.image) AS image,
|
||||||
SUM(statistic.data_analysis) AS data_analysis
|
SUM(statistic.data_analysis) AS data_analysis,
|
||||||
|
SUM(statistic.competitive) AS competitive
|
||||||
`).
|
`).
|
||||||
Scan(&data)
|
Scan(&data)
|
||||||
return
|
return
|
||||||
@ -1148,7 +1326,7 @@ func MetricsOperatingStatus(req *bundle.MetricsOperatingStatusReq) (data *bundle
|
|||||||
app.ModuleClients.BundleDB.Model(model.CastWork{}).
|
app.ModuleClients.BundleDB.Model(model.CastWork{}).
|
||||||
Joins("left join cast_work_log cwl on cwl.work_uuid = cast_work.uuid").
|
Joins("left join cast_work_log cwl on cwl.work_uuid = cast_work.uuid").
|
||||||
Joins("left join cast_cost_log ccl on ccl.work_uuid = cast_work.uuid").
|
Joins("left join cast_cost_log ccl on ccl.work_uuid = cast_work.uuid").
|
||||||
Where("cast_work.status = 9 and cwl.work_category = 2 and cwl.work_status = 9 and ccl.operator_name != '系统自动确定' and ccl.operator_id != ? ", "0").
|
Where("cast_work.status = 9 and cwl.work_category = 2 and cwl.work_status = 9 and ccl.operator_name != '系统自动确定'").
|
||||||
Where("cast_work.submit_time <= ?", req.Date+" 23:59:59").
|
Where("cast_work.submit_time <= ?", req.Date+" 23:59:59").
|
||||||
Where("cwl.deleted_at = 0 and ccl.deleted_at = 0 and cast_work.deleted_at = 0").
|
Where("cwl.deleted_at = 0 and ccl.deleted_at = 0 and cast_work.deleted_at = 0").
|
||||||
Count(&data.ArtistConfirmVideoCount)
|
Count(&data.ArtistConfirmVideoCount)
|
||||||
@ -1173,7 +1351,7 @@ func MetricsOperatingStatus(req *bundle.MetricsOperatingStatusReq) (data *bundle
|
|||||||
app.ModuleClients.BundleDB.Model(model.CastWork{}).
|
app.ModuleClients.BundleDB.Model(model.CastWork{}).
|
||||||
Joins("left join cast_work_log cwl on cwl.work_uuid = cast_work.uuid").
|
Joins("left join cast_work_log cwl on cwl.work_uuid = cast_work.uuid").
|
||||||
Joins("left join cast_cost_log ccl on ccl.work_uuid = cast_work.uuid").
|
Joins("left join cast_cost_log ccl on ccl.work_uuid = cast_work.uuid").
|
||||||
Where("cast_work.status = 9 and cwl.work_category = 1 and cwl.work_status = 9 and ccl.operator_name != '系统自动确定' and ccl.operator_id != ?", "0").
|
Where("cast_work.status = 9 and cwl.work_category = 1 and cwl.work_status = 9 and ccl.operator_name != '系统自动确定'").
|
||||||
Where("cast_work.submit_time <= ?", req.Date+" 23:59:59").
|
Where("cast_work.submit_time <= ?", req.Date+" 23:59:59").
|
||||||
Where("cwl.deleted_at = 0 and ccl.deleted_at = 0 and cast_work.deleted_at = 0").
|
Where("cwl.deleted_at = 0 and ccl.deleted_at = 0 and cast_work.deleted_at = 0").
|
||||||
Count(&data.ArtistConfirmImageCount)
|
Count(&data.ArtistConfirmImageCount)
|
||||||
@ -1184,7 +1362,58 @@ func MetricsOperatingStatus(req *bundle.MetricsOperatingStatusReq) (data *bundle
|
|||||||
Where("cast_work.submit_time <= ?", req.Date+" 23:59:59").
|
Where("cast_work.submit_time <= ?", req.Date+" 23:59:59").
|
||||||
Where("cwl.deleted_at = 0 and ccl.deleted_at = 0 and cast_work.deleted_at = 0").
|
Where("cwl.deleted_at = 0 and ccl.deleted_at = 0 and cast_work.deleted_at = 0").
|
||||||
Count(&data.AutoConfirmImageCount)
|
Count(&data.AutoConfirmImageCount)
|
||||||
//======================数据分析暂时未做======================
|
//======================数据分析======================
|
||||||
|
var analysisStatistic = func(status int8) (i int64) {
|
||||||
|
app.ModuleClients.BundleDB.Table("cast_work_analysis").Where("work_analysis_status = ?", status).Where("deleted_at = 0 and submit_time <= ?", req.Date+" 23:59:59").Count(&i)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
data.ReviewingDataAnalysisCount = analysisStatistic(2)
|
||||||
|
data.RejectDataAnalysisCount = analysisStatistic(3)
|
||||||
|
data.WaitConfirmDataAnalysisCount = analysisStatistic(4)
|
||||||
|
data.PendingUploadDataAnalysisCount = analysisStatistic(6)
|
||||||
|
data.UploadSuccessDataAnalysisCount = analysisStatistic(7)
|
||||||
|
data.UploadFailedDataAnalysisCount = analysisStatistic(5)
|
||||||
|
|
||||||
|
app.ModuleClients.BundleDB.Table("cast_work_analysis").
|
||||||
|
Joins("left join cast_cost_analysis_log ccal on ccal.analysis_uuid = cast_work_analysis.uuid AND ccal.deleted_at = 0").
|
||||||
|
Where("cast_work_analysis.work_analysis_status in ?", []int{6, 7}).
|
||||||
|
Where("cast_work_analysis.deleted_at = 0").
|
||||||
|
Where("ccal.operator_name != '系统自动确定'").
|
||||||
|
Where("cast_work_analysis.submit_time <= ?", req.Date+" 23:59:59").
|
||||||
|
Count(&data.ArtistConfirmDataAnalysisCount)
|
||||||
|
app.ModuleClients.BundleDB.Table("cast_work_analysis").
|
||||||
|
Joins("left join cast_cost_analysis_log ccal on ccal.analysis_uuid = cast_work_analysis.uuid AND ccal.deleted_at = 0").
|
||||||
|
Where("cast_work_analysis.work_analysis_status in ?", []int{6, 7}).
|
||||||
|
Where("cast_work_analysis.deleted_at = 0").
|
||||||
|
Where("ccal.operator_name = '系统自动确定'").
|
||||||
|
Where("cast_work_analysis.submit_time <= ?", req.Date+" 23:59:59").
|
||||||
|
Count(&data.AutoConfirmDataAnalysisCount)
|
||||||
|
//================竞品数==================
|
||||||
|
var competitiveStatistic = func(status int8) (i int64) {
|
||||||
|
app.ModuleClients.BundleDB.Table("cast_competitive_report as ccr").Where("ccr.work_report_status = ?", status).Where("deleted_at = 0 and submit_time <= ?", req.Date+" 23:59:59").Count(&i)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
data.ReviewingCompetitiveCount = competitiveStatistic(2)
|
||||||
|
data.RejectCompetitiveCount = competitiveStatistic(3)
|
||||||
|
data.WaitConfirmCompetitiveCount = competitiveStatistic(4)
|
||||||
|
data.PendingUploadCompetitiveCount = competitiveStatistic(6)
|
||||||
|
data.UploadSuccessCompetitiveCount = competitiveStatistic(7)
|
||||||
|
data.UploadFailedCompetitiveCount = competitiveStatistic(5)
|
||||||
|
|
||||||
|
app.ModuleClients.BundleDB.Table("cast_competitive_report as ccr").
|
||||||
|
Joins("left join cast_cost_competitive_report_log cccrl on cccrl.report_uuid = ccr.uuid AND cccrl.deleted_at = 0").
|
||||||
|
Where("ccr.work_report_status in ?", []int{6, 7}).
|
||||||
|
Where("ccr.submit_time <= ?", req.Date+" 23:59:59").
|
||||||
|
Where("cccrl.operator_name != '系统自动确定'").
|
||||||
|
Where("ccr.deleted_at = 0").
|
||||||
|
Count(&data.ArtistConfirmCompetitiveCount)
|
||||||
|
app.ModuleClients.BundleDB.Table("cast_competitive_report as ccr").
|
||||||
|
Joins("left join cast_cost_competitive_report_log cccrl on cccrl.report_uuid = ccr.uuid AND cccrl.deleted_at = 0").
|
||||||
|
Where("ccr.work_report_status in ?", []int{6, 7}).
|
||||||
|
Where("ccr.submit_time <= ?", req.Date+" 23:59:59").
|
||||||
|
Where("cccrl.operator_name = '系统自动确定'").
|
||||||
|
Where("ccr.deleted_at = 0").
|
||||||
|
Count(&data.AutoConfirmCompetitiveCount)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1279,22 +1508,38 @@ func MetricsArtistAccountExport(req *bundle.MetricsArtistAccountExportReq) (*bun
|
|||||||
var start time.Time
|
var start time.Time
|
||||||
var end time.Time
|
var end time.Time
|
||||||
var err error
|
var err error
|
||||||
if req.Month != "" {
|
|
||||||
t, err := time.Parse("2006-01", req.Month)
|
subQuery := app.ModuleClients.BundleDB.Table("cast_media_account").
|
||||||
|
Select("artist_uuid,any_value(artist_name) as artist_name,any_value(created_at) as created_at").
|
||||||
|
Group("artist_uuid").
|
||||||
|
Where("deleted_at = 0 and expired != 2")
|
||||||
|
//如果选择了月份
|
||||||
|
if len(req.Month) > 0 {
|
||||||
|
// 构建多个月份的时间范围条件(使用 OR 连接)
|
||||||
|
var conditions []string
|
||||||
|
var args []interface{}
|
||||||
|
for _, month := range req.Month {
|
||||||
|
t, err := time.Parse("2006-01", month)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
start = datetime.BeginOfMonth(t)
|
start = datetime.BeginOfMonth(t)
|
||||||
end = datetime.EndOfMonth(t)
|
end = datetime.EndOfMonth(t)
|
||||||
|
// 为每个月添加时间范围条件
|
||||||
|
conditions = append(conditions, "(created_at >= ? AND created_at <= ?)")
|
||||||
|
args = append(args, start.Unix(), end.Unix())
|
||||||
|
}
|
||||||
|
// 使用 OR 连接所有月份条件
|
||||||
|
if len(conditions) > 0 {
|
||||||
|
subQuery = subQuery.Where(strings.Join(conditions, " OR "), args...)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
start = time.Date(1970, 1, 1, 0, 0, 0, 0, time.UTC) // Unix 时间戳起始时间
|
start = time.Date(1970, 1, 1, 0, 0, 0, 0, time.UTC) // Unix 时间戳起始时间
|
||||||
end = time.Date(2099, 12, 31, 23, 59, 59, 0, time.UTC) // 设置一个很远的未来日期
|
end = time.Date(2099, 12, 31, 23, 59, 59, 0, time.UTC) // 设置一个很远的未来日期
|
||||||
|
subQuery = subQuery.Where("created_at >= ?", start.Unix()).
|
||||||
|
Where("created_at <= ?", end.Unix())
|
||||||
}
|
}
|
||||||
subQuery := app.ModuleClients.BundleDB.Table("cast_media_account").
|
|
||||||
Select("artist_uuid,any_value(artist_name) as artist_name,any_value(created_at) as created_at").
|
|
||||||
Group("artist_uuid").
|
|
||||||
Where("created_at >= ?", start.Unix()).Where("created_at <= ?", end.Unix()).
|
|
||||||
Where("deleted_at = 0")
|
|
||||||
query := app.ModuleClients.BundleDB.Table("( ? ) cma", subQuery).
|
query := app.ModuleClients.BundleDB.Table("( ? ) cma", subQuery).
|
||||||
Select(`tiktok.platform_user_id as tiktok_account,
|
Select(`tiktok.platform_user_id as tiktok_account,
|
||||||
tiktok.platform_user_name as tiktok_nickname,
|
tiktok.platform_user_name as tiktok_nickname,
|
||||||
@ -1305,20 +1550,27 @@ func MetricsArtistAccountExport(req *bundle.MetricsArtistAccountExportReq) (*bun
|
|||||||
ins.platform_user_id as instagram_account,
|
ins.platform_user_id as instagram_account,
|
||||||
ins.platform_user_name as instagram_nickname,
|
ins.platform_user_name as instagram_nickname,
|
||||||
ins_auth.auth_status as ins_auth_status,
|
ins_auth.auth_status as ins_auth_status,
|
||||||
|
youtube.platform_user_id as youtube_account,
|
||||||
|
youtube.platform_user_name as youtube_nickname,
|
||||||
|
youtube_auth.auth_status as youtube_auth_status,
|
||||||
|
bluesky.platform_user_id as bluesky_account,
|
||||||
|
bluesky.platform_user_name as bluesky_nickname,
|
||||||
|
bluesky_auth.auth_status as bluesky_auth_status,
|
||||||
cma.artist_name,
|
cma.artist_name,
|
||||||
bor.customer_num as user_num
|
bor.customer_num as user_num
|
||||||
`).
|
`).
|
||||||
Joins(`left join (SELECT * FROM cast_media_account where platform_id = 1 and deleted_at = 0) tiktok on tiktok.artist_uuid = cma.artist_uuid`).
|
Joins(`left join (SELECT * FROM cast_media_account where platform_id = 1 and deleted_at = 0 and expired != 2) tiktok on tiktok.artist_uuid = cma.artist_uuid`).
|
||||||
Joins(`left join (Select * from cast_media_auth where platform_id = 1 and deleted_at = 0) tiktok_auth on tiktok_auth.user_id = tiktok.user_id`).
|
Joins(`left join (Select * from cast_media_auth where platform_id = 1 and deleted_at = 0 ) tiktok_auth on tiktok_auth.user_id = tiktok.user_id`).
|
||||||
Joins(`left join (SELECT * FROM cast_media_account where platform_id = 4 and deleted_at = 0) dm on dm.artist_uuid = cma.artist_uuid`).
|
Joins(`left join (SELECT * FROM cast_media_account where platform_id = 4 and deleted_at = 0 and expired != 2) dm on dm.artist_uuid = cma.artist_uuid`).
|
||||||
Joins(`left join (Select * from cast_media_auth where platform_id = 4 and deleted_at = 0) dm_auth on dm_auth.user_id = dm.user_id`).
|
Joins(`left join (Select * from cast_media_auth where platform_id = 4 and deleted_at = 0) dm_auth on dm_auth.user_id = dm.user_id`).
|
||||||
Joins(`left join (SELECT * FROM cast_media_account where platform_id = 3 and deleted_at = 0) ins on ins.artist_uuid = cma.artist_uuid`).
|
Joins(`left join (SELECT * FROM cast_media_account where platform_id = 3 and deleted_at = 0 and expired != 2) ins on ins.artist_uuid = cma.artist_uuid`).
|
||||||
Joins(`left join (Select * from cast_media_auth where platform_id = 3 and deleted_at = 0) ins_auth on ins_auth.user_id = ins.user_id`).
|
Joins(`left join (Select * from cast_media_auth where platform_id = 3 and deleted_at = 0) ins_auth on ins_auth.user_id = ins.user_id`).
|
||||||
|
Joins(`left join (Select * from cast_media_account where platform_id = 2 and deleted_at = 0 and expired != 2) youtube on youtube.artist_uuid = cma.artist_uuid`).
|
||||||
|
Joins(`left join (Select * from cast_media_auth where platform_id = 2 and deleted_at = 0) youtube_auth on youtube_auth.user_id = youtube.user_id`).
|
||||||
|
Joins(`left join (Select * from cast_media_account where platform_id = 5 and deleted_at = 0 and expired != 2) bluesky on bluesky.artist_uuid = cma.artist_uuid`).
|
||||||
|
Joins(`left join (Select * from cast_media_auth where platform_id = 5 and deleted_at = 0) bluesky_auth on bluesky_auth.user_id = bluesky.user_id`).
|
||||||
Joins(`left join bundle_order_records bor on bor.customer_id COLLATE utf8mb4_general_ci= cma.artist_uuid COLLATE utf8mb4_general_ci`).
|
Joins(`left join bundle_order_records bor on bor.customer_id COLLATE utf8mb4_general_ci= cma.artist_uuid COLLATE utf8mb4_general_ci`).
|
||||||
Where("bor.deleted_at is null")
|
Where("bor.deleted_at is null")
|
||||||
if req.Month != "" {
|
|
||||||
query = query.Where("cma.created_at >= ?", start.Unix()).Where("cma.created_at <= ?", end.Unix())
|
|
||||||
}
|
|
||||||
err = query.Find(&data.Data).Error
|
err = query.Find(&data.Data).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -1329,7 +1581,7 @@ func MetricsArtistAccountExport(req *bundle.MetricsArtistAccountExportReq) (*bun
|
|||||||
func MetricsVideoSubmitExport(req *bundle.MetricsVideoSubmitExportReq) (result *bundle.MetricsVideoSubmitExportResp, err error) {
|
func MetricsVideoSubmitExport(req *bundle.MetricsVideoSubmitExportReq) (result *bundle.MetricsVideoSubmitExportResp, err error) {
|
||||||
result = &bundle.MetricsVideoSubmitExportResp{}
|
result = &bundle.MetricsVideoSubmitExportResp{}
|
||||||
var query *gorm.DB
|
var query *gorm.DB
|
||||||
if req.Month == "" {
|
if len(req.Month) == 0 {
|
||||||
query = app.ModuleClients.BundleDB.Table("cast_work AS cw").
|
query = app.ModuleClients.BundleDB.Table("cast_work AS cw").
|
||||||
Select(`cw.artist_name ,
|
Select(`cw.artist_name ,
|
||||||
cw.title as video_title,
|
cw.title as video_title,
|
||||||
@ -1341,25 +1593,64 @@ func MetricsVideoSubmitExport(req *bundle.MetricsVideoSubmitExportReq) (result *
|
|||||||
Joins("left join (select created_at,work_uuid from cast_work_platform_info cwi where cwi.platform_id = 4) dm on dm.work_uuid = cw.uuid").
|
Joins("left join (select created_at,work_uuid from cast_work_platform_info cwi where cwi.platform_id = 4) dm on dm.work_uuid = cw.uuid").
|
||||||
Joins("left join (select created_at,work_uuid from cast_work_platform_info cwi where cwi.platform_id = 3) ins on ins.work_uuid = cw.uuid").
|
Joins("left join (select created_at,work_uuid from cast_work_platform_info cwi where cwi.platform_id = 3) ins on ins.work_uuid = cw.uuid").
|
||||||
Joins("left join bundle_order_records bor on bor.customer_id COLLATE utf8mb4_general_ci = cw.artist_uuid COLLATE utf8mb4_general_ci").
|
Joins("left join bundle_order_records bor on bor.customer_id COLLATE utf8mb4_general_ci = cw.artist_uuid COLLATE utf8mb4_general_ci").
|
||||||
Where("(tiktok.created_at is not null or dm.created_at is not null or ins.created_at is not null) and cw.deleted_at = 0 and bor.deleted_at is null").
|
Where("(tiktok.created_at is not null or dm.created_at is not null or ins.created_at is not null) and cw.deleted_at = 0 and bor.deleted_at is null and cw.origin_uuid = ''").
|
||||||
Order("cw.artist_name")
|
Order("cw.artist_name")
|
||||||
} else {
|
} else {
|
||||||
|
// 构建多个月份的时间范围参数
|
||||||
|
var timeRanges []struct {
|
||||||
|
Start int64
|
||||||
|
End int64
|
||||||
|
}
|
||||||
|
|
||||||
t, err := time.Parse("2006-01", req.Month)
|
for _, month := range req.Month {
|
||||||
|
t, err := time.Parse("2006-01", month)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
start := datetime.BeginOfMonth(t)
|
start := datetime.BeginOfMonth(t)
|
||||||
end := datetime.EndOfMonth(t)
|
end := datetime.EndOfMonth(t)
|
||||||
|
timeRanges = append(timeRanges, struct {
|
||||||
|
Start int64
|
||||||
|
End int64
|
||||||
|
}{Start: start.Unix(), End: end.Unix()})
|
||||||
|
}
|
||||||
|
// 构建时间筛选 SQL 条件的辅助函数
|
||||||
|
buildTimeFilterSQL := func(tableAlias string) (string, []interface{}) {
|
||||||
|
if len(timeRanges) == 0 {
|
||||||
|
return "", nil
|
||||||
|
}
|
||||||
|
var conditions []string
|
||||||
|
var args []interface{}
|
||||||
|
for _, tr := range timeRanges {
|
||||||
|
// 明确指定表别名,避免字段歧义
|
||||||
|
conditions = append(conditions, fmt.Sprintf("(%s.created_at >= ? AND %s.created_at <= ?)", tableAlias, tableAlias))
|
||||||
|
args = append(args, tr.Start, tr.End)
|
||||||
|
}
|
||||||
|
return "(" + strings.Join(conditions, " OR ") + ")", args
|
||||||
|
}
|
||||||
query = app.ModuleClients.BundleDB.Table("cast_work AS cw").
|
query = app.ModuleClients.BundleDB.Table("cast_work AS cw").
|
||||||
Select(`cw.artist_name, cw.title AS video_title, tiktok.created_at AS tiktok_upload_time, dm.created_at AS dm_upload_time, ins.created_at AS instagram_upload_time, bor.customer_num AS user_num`).
|
Select(`cw.artist_name, cw.title AS video_title, tiktok.created_at AS tiktok_upload_time, dm.created_at AS dm_upload_time, ins.created_at AS instagram_upload_time, bor.customer_num AS user_num`)
|
||||||
Joins(`LEFT JOIN cast_work_platform_info tiktok ON tiktok.work_uuid = cw.uuid AND tiktok.platform_id = 1 AND tiktok.created_at >= ? AND tiktok.created_at <= ?`, start.Unix(), end.Unix()).
|
|
||||||
Joins(`LEFT JOIN cast_work_platform_info dm ON dm.work_uuid = cw.uuid AND dm.platform_id = 4 AND dm.created_at >= ? AND dm.created_at <= ?`, start.Unix(), end.Unix()).
|
// 为每个平台添加时间筛选条件
|
||||||
Joins(`LEFT JOIN cast_work_platform_info ins ON ins.work_uuid = cw.uuid AND ins.platform_id = 3 AND ins.created_at >= ? AND ins.created_at <= ?`, start.Unix(), end.Unix()).
|
if len(timeRanges) > 0 {
|
||||||
Joins(`LEFT JOIN bundle_order_records bor ON bor.customer_id COLLATE utf8mb4_general_ci = cw.artist_uuid COLLATE utf8mb4_general_ci AND bor.deleted_at IS NULL`).
|
// TikTok JOIN
|
||||||
|
tiktokTimeSQL, tiktokArgs := buildTimeFilterSQL("tiktok")
|
||||||
|
joinSQL := `LEFT JOIN cast_work_platform_info tiktok ON tiktok.work_uuid = cw.uuid AND tiktok.platform_id = 1 AND ` + tiktokTimeSQL
|
||||||
|
query = query.Joins(joinSQL, tiktokArgs...)
|
||||||
|
|
||||||
|
// DM JOIN
|
||||||
|
dmTimeSQL, dmArgs := buildTimeFilterSQL("dm")
|
||||||
|
joinSQL = `LEFT JOIN cast_work_platform_info dm ON dm.work_uuid = cw.uuid AND dm.platform_id = 4 AND ` + dmTimeSQL
|
||||||
|
query = query.Joins(joinSQL, dmArgs...)
|
||||||
|
|
||||||
|
// Instagram JOIN
|
||||||
|
insTimeSQL, insArgs := buildTimeFilterSQL("ins")
|
||||||
|
joinSQL = `LEFT JOIN cast_work_platform_info ins ON ins.work_uuid = cw.uuid AND ins.platform_id = 3 AND ` + insTimeSQL
|
||||||
|
query = query.Joins(joinSQL, insArgs...)
|
||||||
|
}
|
||||||
|
query = query.Joins(`LEFT JOIN bundle_order_records bor ON bor.customer_id COLLATE utf8mb4_general_ci = cw.artist_uuid COLLATE utf8mb4_general_ci AND bor.deleted_at IS NULL`).
|
||||||
Where(`cw.deleted_at = 0 AND (tiktok.created_at IS NOT NULL OR dm.created_at IS NOT NULL OR ins.created_at IS NOT NULL)`).
|
Where(`cw.deleted_at = 0 AND (tiktok.created_at IS NOT NULL OR dm.created_at IS NOT NULL OR ins.created_at IS NOT NULL)`).
|
||||||
Order("cw.artist_name")
|
Order("cw.artist_name")
|
||||||
|
|
||||||
}
|
}
|
||||||
err = query.Find(&result.Data).Error
|
err = query.Find(&result.Data).Error
|
||||||
return
|
return
|
||||||
@ -1372,10 +1663,12 @@ func getRangeMonthlyRelease(startTime time.Time, endTime time.Time, bundleUuid s
|
|||||||
bundleBalanceInfo.Video += b.Video
|
bundleBalanceInfo.Video += b.Video
|
||||||
bundleBalanceInfo.Image += b.Image
|
bundleBalanceInfo.Image += b.Image
|
||||||
bundleBalanceInfo.DataAnalysis += b.DataAnalysis
|
bundleBalanceInfo.DataAnalysis += b.DataAnalysis
|
||||||
|
bundleBalanceInfo.Competitive += b.Competitive
|
||||||
// increaseBalanceInfo.Account += i.Account
|
// increaseBalanceInfo.Account += i.Account
|
||||||
increaseBalanceInfo.Video += i.Video
|
increaseBalanceInfo.Video += i.Video
|
||||||
increaseBalanceInfo.Image += i.Image
|
increaseBalanceInfo.Image += i.Image
|
||||||
increaseBalanceInfo.DataAnalysis += i.DataAnalysis
|
increaseBalanceInfo.DataAnalysis += i.DataAnalysis
|
||||||
|
increaseBalanceInfo.Competitive += i.Competitive
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -1419,6 +1712,8 @@ func getMonthlyRelease(month string, bundleUuid string) (bundleBalanceInfo Balan
|
|||||||
increaseBalanceInfo.Image += (cal(item, item.IncreaseLimitImageNumber, item.MonthlyLimitImageQuotaNumber, t) + cal(item, item.IncreaseLimitImageExpiredNumber, item.MonthlyLimitImageQuotaNumber, t))
|
increaseBalanceInfo.Image += (cal(item, item.IncreaseLimitImageNumber, item.MonthlyLimitImageQuotaNumber, t) + cal(item, item.IncreaseLimitImageExpiredNumber, item.MonthlyLimitImageQuotaNumber, t))
|
||||||
bundleBalanceInfo.DataAnalysis += (cal(item, item.BundleLimitDataAnalysisNumber, item.MonthlyLimitDataAnalysisQuotaNumber, t) + cal(item, item.BundleLimitDataAnalysisExpiredNumber, item.MonthlyLimitDataAnalysisQuotaNumber, t))
|
bundleBalanceInfo.DataAnalysis += (cal(item, item.BundleLimitDataAnalysisNumber, item.MonthlyLimitDataAnalysisQuotaNumber, t) + cal(item, item.BundleLimitDataAnalysisExpiredNumber, item.MonthlyLimitDataAnalysisQuotaNumber, t))
|
||||||
increaseBalanceInfo.DataAnalysis += (cal(item, item.IncreaseLimitDataAnalysisNumber, item.MonthlyLimitDataAnalysisQuotaNumber, t) + cal(item, item.IncreaseLimitDataAnalysisExpiredNumber, item.MonthlyLimitDataAnalysisQuotaNumber, t))
|
increaseBalanceInfo.DataAnalysis += (cal(item, item.IncreaseLimitDataAnalysisNumber, item.MonthlyLimitDataAnalysisQuotaNumber, t) + cal(item, item.IncreaseLimitDataAnalysisExpiredNumber, item.MonthlyLimitDataAnalysisQuotaNumber, t))
|
||||||
|
bundleBalanceInfo.Competitive += (qua(item, item.BundleLimitCompetitiveNumber, item.MonthlyLimitCompetitiveQuotaNumber, t) + qua(item, item.BundleLimitCompetitiveExpiredNumber, item.MonthlyLimitCompetitiveQuotaNumber, t))
|
||||||
|
increaseBalanceInfo.Competitive += (qua(item, item.IncreaseLimitCompetitiveNumber, item.MonthlyLimitCompetitiveQuotaNumber, t) + qua(item, item.IncreaseLimitCompetitiveExpiredNumber, item.MonthlyLimitCompetitiveQuotaNumber, t))
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -1445,3 +1740,67 @@ func cal(data model.BundleBalance, total, limit int, date time.Time) int {
|
|||||||
}
|
}
|
||||||
return min(limit, remaining)
|
return min(limit, remaining)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 计算每个季度发放的数目
|
||||||
|
func qua(data model.BundleBalance, total, limit int, date time.Time) int {
|
||||||
|
var released int // 已释放的次数
|
||||||
|
if data.StartAt.Month() == date.Month() && data.StartAt.Year() == date.Year() {
|
||||||
|
} else {
|
||||||
|
released += limit
|
||||||
|
}
|
||||||
|
interval := max((date.Year()*12+int(date.Month())-(data.StartAt.Year()*12+int(data.StartAt.Month())))/3, 1) // 释放了多少个季度
|
||||||
|
released += max(interval-1, 0) * limit // 已经释放的数量
|
||||||
|
remaining := max(total-released, 0) // 还剩余多少次没有发放
|
||||||
|
if data.StartAt.Month() == date.Month() && data.StartAt.Year() == date.Year() { // 本月为第一个月购买
|
||||||
|
return min(limit, remaining)
|
||||||
|
}
|
||||||
|
monthDiff := date.Year()*12 + int(date.Month()) - (data.StartAt.Year()*12 + int(data.StartAt.Month()))
|
||||||
|
if monthDiff%3 == 0 && data.ExpiredAt.Month() != date.Month() {
|
||||||
|
return min(limit, remaining)
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func ExportWorkCastInfo(req *bundle.ExportWorkCastInfoReq) (*bundle.ExportWorkCastInfoResp, error) {
|
||||||
|
result := &bundle.ExportWorkCastInfoResp{}
|
||||||
|
query := app.ModuleClients.BundleDB.Raw(`
|
||||||
|
SELECT
|
||||||
|
bor.customer_name,
|
||||||
|
bor.customer_num,
|
||||||
|
bor.bundle_name,
|
||||||
|
bor.signed_time,
|
||||||
|
cw.title,
|
||||||
|
cwe.cost_type,
|
||||||
|
cw.work_category,
|
||||||
|
cw.submit_time,
|
||||||
|
cwl_wating.update_time AS waiting_time,
|
||||||
|
cwl_confirm.update_time AS confirm_time
|
||||||
|
FROM bundle_balance bb
|
||||||
|
LEFT JOIN bundle_order_records bor
|
||||||
|
ON bor.uuid = bb.order_uuid AND bor.deleted_at IS NULL
|
||||||
|
LEFT JOIN cast_work cw
|
||||||
|
ON cw.artist_uuid = bb.user_id AND cw.deleted_at = 0
|
||||||
|
LEFT JOIN cast_work_extra cwe
|
||||||
|
ON cwe.work_uuid = cw.uuid AND cwe.deleted_at = 0
|
||||||
|
LEFT JOIN cast_work_log cwl_confirm
|
||||||
|
ON cwl_confirm.work_uuid = cw.uuid
|
||||||
|
AND cwl_confirm.work_status = 9
|
||||||
|
AND cwl_confirm.deleted_at = 0
|
||||||
|
LEFT JOIN cast_work_log cwl_wating
|
||||||
|
ON cwl_wating.work_uuid = cw.uuid
|
||||||
|
AND cwl_wating.work_status = 4
|
||||||
|
AND cwl_wating.deleted_at = 0
|
||||||
|
WHERE bb.deleted_at IS NULL
|
||||||
|
AND bb.month = '2026-01'
|
||||||
|
AND bor.deleted_at IS NULL
|
||||||
|
AND cw.title IS NOT NULL
|
||||||
|
AND cw.submit_time < ?
|
||||||
|
AND cw.submit_time > ?
|
||||||
|
ORDER BY cw.uuid;
|
||||||
|
`, req.EndTime, req.StartTime)
|
||||||
|
err := query.Scan(&result.Data).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return result, err
|
||||||
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/shopspring/decimal"
|
||||||
"micro-bundle/internal/model"
|
"micro-bundle/internal/model"
|
||||||
"micro-bundle/pb/bundle"
|
"micro-bundle/pb/bundle"
|
||||||
"micro-bundle/pkg/app"
|
"micro-bundle/pkg/app"
|
||||||
@ -127,6 +128,26 @@ 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{}).
|
err = app.ModuleClients.BundleDB.Model(&model.BundleOrderValueAdd{}).
|
||||||
@ -359,6 +380,7 @@ func OrderRecordDetail(req *bundle.OrderRecordsDetailRequest) (res *bundle.Order
|
|||||||
ValueAddBundleAmount: orderRecord.ValueAddBundleAmount,
|
ValueAddBundleAmount: orderRecord.ValueAddBundleAmount,
|
||||||
TotalAmount: orderRecord.TotalAmount,
|
TotalAmount: orderRecord.TotalAmount,
|
||||||
ExpirationTime: orderRecord.ExpirationTime,
|
ExpirationTime: orderRecord.ExpirationTime,
|
||||||
|
ReSignature: int32(orderRecord.ReSignature),
|
||||||
}
|
}
|
||||||
res.AddInfos = make([]*bundle.AddInfo, 0)
|
res.AddInfos = make([]*bundle.AddInfo, 0)
|
||||||
res.AddInfos = addInfos
|
res.AddInfos = addInfos
|
||||||
@ -517,6 +539,7 @@ func OrderRecordsListV2(req *bundle.OrderRecordsRequestV2) (res *bundle.OrderRec
|
|||||||
Amount: record.Amount,
|
Amount: record.Amount,
|
||||||
CustomerId: customerID,
|
CustomerId: customerID,
|
||||||
PayTime: record.PayTime,
|
PayTime: record.PayTime,
|
||||||
|
InviterId: record.InviterID,
|
||||||
}
|
}
|
||||||
|
|
||||||
// 聚合子订单
|
// 聚合子订单
|
||||||
@ -806,6 +829,19 @@ func UpdateReconciliationStatusBySerialNumber(req *bundle.UpdateStatusAndPayTime
|
|||||||
PayStatus: int(req.PaymentStatus),
|
PayStatus: int(req.PaymentStatus),
|
||||||
SerialNumber: req.SerialNumber,
|
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 {
|
if err := app.ModuleClients.BundleDB.Model(&existing).Updates(updates).Error; err != nil {
|
||||||
return nil, fmt.Errorf("更新对账单失败: %v", err)
|
return nil, fmt.Errorf("更新对账单失败: %v", err)
|
||||||
}
|
}
|
||||||
@ -849,6 +885,7 @@ func ListUnfinishedInfos(req *bundle.AutoCreateUserAndOrderRequest) (res *bundle
|
|||||||
unfinishedInfo.OrderPayCurrency = info.OrderPayCurrency
|
unfinishedInfo.OrderPayCurrency = info.OrderPayCurrency
|
||||||
unfinishedInfo.OrderAccountCurrency = info.OrderAccountCurrency
|
unfinishedInfo.OrderAccountCurrency = info.OrderAccountCurrency
|
||||||
unfinishedInfo.PayTime = info.PayTime.Format("2006-01-02 15:04:05")
|
unfinishedInfo.PayTime = info.PayTime.Format("2006-01-02 15:04:05")
|
||||||
|
unfinishedInfo.CardNum = info.CardNum
|
||||||
res.UnfinishedInfos = append(res.UnfinishedInfos, unfinishedInfo)
|
res.UnfinishedInfos = append(res.UnfinishedInfos, unfinishedInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -874,3 +911,71 @@ func SoftDeleteUnfinishedInfo(req *bundle.SoftDeleteUnfinishedInfoRequest) (res
|
|||||||
|
|
||||||
return res, nil
|
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
|
||||||
|
}
|
||||||
|
|||||||
@ -1,570 +0,0 @@
|
|||||||
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
231
internal/dto/task.go
Normal file
231
internal/dto/task.go
Normal file
@ -0,0 +1,231 @@
|
|||||||
|
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,9 +11,12 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"micro-bundle/pkg/msg"
|
||||||
|
|
||||||
"dubbo.apache.org/dubbo-go/v3/common/logger"
|
"dubbo.apache.org/dubbo-go/v3/common/logger"
|
||||||
"github.com/jinzhu/copier"
|
"github.com/jinzhu/copier"
|
||||||
"github.com/samber/lo"
|
"github.com/samber/lo"
|
||||||
|
"github.com/shopspring/decimal"
|
||||||
)
|
)
|
||||||
|
|
||||||
func BundleExtend(req *bundle.BundleExtendRequest) (*bundle.BundleExtendResponse, error) {
|
func BundleExtend(req *bundle.BundleExtendRequest) (*bundle.BundleExtendResponse, error) {
|
||||||
@ -39,6 +42,7 @@ func BundleExtend(req *bundle.BundleExtendRequest) (*bundle.BundleExtendResponse
|
|||||||
ImageNumber: int(req.ImagesAdditional),
|
ImageNumber: int(req.ImagesAdditional),
|
||||||
DataAnalysisNumber: int(req.DataAdditional),
|
DataAnalysisNumber: int(req.DataAdditional),
|
||||||
AccountNumber: int(req.AccountAdditional),
|
AccountNumber: int(req.AccountAdditional),
|
||||||
|
CompetitiveNumber: int(req.CompetitiveAdditional),
|
||||||
DurationNumber: durationNumber,
|
DurationNumber: durationNumber,
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return nil, errors.New("用户没有余量信息")
|
return nil, errors.New("用户没有余量信息")
|
||||||
@ -144,6 +148,21 @@ func GetBundleBalanceList(req *bundle.GetBundleBalanceListReq) (*bundle.GetBundl
|
|||||||
MonthlyIncreaseDataAnalysisNumber: int32(m.IncreaseDataAnalysisNumber) - int32(m.IncreaseDataAnalysisConsumptionNumber) + int32(m.MonthlyIncreaseLimitDataAnalysisNumber) + int32(m.MonthlyIncreaseLimitExpiredDataAnalysisNumber),
|
MonthlyIncreaseDataAnalysisNumber: int32(m.IncreaseDataAnalysisNumber) - int32(m.IncreaseDataAnalysisConsumptionNumber) + int32(m.MonthlyIncreaseLimitDataAnalysisNumber) + int32(m.MonthlyIncreaseLimitExpiredDataAnalysisNumber),
|
||||||
MonthlyInvalidBundleDataAnalysisNumber: int32(m.MonthlyInvalidBundleDataAnalysisNumber),
|
MonthlyInvalidBundleDataAnalysisNumber: int32(m.MonthlyInvalidBundleDataAnalysisNumber),
|
||||||
MonthlyInvalidIncreaseDataAnalysisNumber: int32(m.MonthlyInvalidIncreaseDataAnalysisNumber),
|
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),
|
MonthlyNewManualAccountNumber: int32(m.MonthlyNewAccountNumber),
|
||||||
MonthlyNewManualVideoNumber: int32(m.MonthlyNewManualVideoNumber),
|
MonthlyNewManualVideoNumber: int32(m.MonthlyNewManualVideoNumber),
|
||||||
@ -171,6 +190,8 @@ func GetBundleBalanceList(req *bundle.GetBundleBalanceListReq) (*bundle.GetBundl
|
|||||||
result.MonthlyNewIncreaseImageNumber += int32(m.IncreaseImageNumber)
|
result.MonthlyNewIncreaseImageNumber += int32(m.IncreaseImageNumber)
|
||||||
result.MonthlyNewBundleDataAnalysisNumber += int32(m.BundleDataAnalysisNumber)
|
result.MonthlyNewBundleDataAnalysisNumber += int32(m.BundleDataAnalysisNumber)
|
||||||
result.MonthlyNewIncreaseDataAnalysisNumber += int32(m.IncreaseDataAnalysisNumber)
|
result.MonthlyNewIncreaseDataAnalysisNumber += int32(m.IncreaseDataAnalysisNumber)
|
||||||
|
result.MonthlyNewBundleCompetitiveNumber += int32(m.BundleCompetitiveNumber)
|
||||||
|
result.MonthlyNewIncreaseCompetitiveNumber += int32(m.IncreaseCompetitiveNumber)
|
||||||
}
|
}
|
||||||
if result.Activate != 2 { // 除了等于0的情况
|
if result.Activate != 2 { // 除了等于0的情况
|
||||||
result.Activate = 1
|
result.Activate = 1
|
||||||
@ -194,9 +215,16 @@ func GetBundleBalanceByUserId(req *bundle.GetBundleBalanceByUserIdReq) (*bundle.
|
|||||||
if data.Activate != 2 {
|
if data.Activate != 2 {
|
||||||
return nil, errors.New("套餐未激活")
|
return nil, errors.New("套餐未激活")
|
||||||
}
|
}
|
||||||
|
var IsExpired int32
|
||||||
|
if data.ExpiredAt.Before(time.Now()) {
|
||||||
|
IsExpired = msg.IsExpired //已过期
|
||||||
|
} else {
|
||||||
|
IsExpired = msg.NotExpired //未过期
|
||||||
|
}
|
||||||
result := &bundle.GetBundleBalanceByUserIdResp{
|
result := &bundle.GetBundleBalanceByUserIdResp{
|
||||||
OrderUUID: data.OrderUUID,
|
OrderUUID: data.OrderUUID,
|
||||||
BundleName: data.BundleName,
|
BundleName: data.BundleName,
|
||||||
|
BundleStatus: IsExpired,
|
||||||
PayTime: data.StartAt.UnixMilli(),
|
PayTime: data.StartAt.UnixMilli(),
|
||||||
ExpiredTime: data.ExpiredAt.UnixMilli(),
|
ExpiredTime: data.ExpiredAt.UnixMilli(),
|
||||||
PaymentAmount: data.PaymentAmount,
|
PaymentAmount: data.PaymentAmount,
|
||||||
@ -220,6 +248,11 @@ func GetBundleBalanceByUserId(req *bundle.GetBundleBalanceByUserIdReq) (*bundle.
|
|||||||
DataAnalysisExtendConsumptionNumber: int32(data.MonthlyBundleLimitDataAnalysisConsumptionNumber) + int32(data.MonthlyIncreaseLimitDataAnalysisConsumptionNumber) + int32(data.MonthlyBundleLimitExpiredDataAnalysisConsumptionNumber) + int32(data.MonthlyIncreaseLimitExpiredDataAnalysisConsumptionNumber) + int32(data.ManualDataAnalysisConsumptionNumber) + int32(data.IncreaseDataAnalysisConsumptionNumber) + int32(data.BundleDataAnalysisConsumptionNumber),
|
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),
|
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),
|
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),
|
||||||
}
|
}
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
@ -231,6 +264,7 @@ func AddBundleBalance(req *bundle.AddBundleBalanceReq) (*bundle.AddBundleBalance
|
|||||||
ImageNumber: int(req.ImageConsumptionNumber),
|
ImageNumber: int(req.ImageConsumptionNumber),
|
||||||
VideoNumber: int(req.VideoConsumptionNumber),
|
VideoNumber: int(req.VideoConsumptionNumber),
|
||||||
DataAnalysisNumber: int(req.DataAnalysisConsumptionNumber),
|
DataAnalysisNumber: int(req.DataAnalysisConsumptionNumber),
|
||||||
|
CompetitiveNumber: int(req.CompetitiveConsumptionNumber),
|
||||||
}
|
}
|
||||||
uesdType, err := dao.AddBundleBalanceByUserId(data)
|
uesdType, err := dao.AddBundleBalanceByUserId(data)
|
||||||
return &bundle.AddBundleBalanceResp{
|
return &bundle.AddBundleBalanceResp{
|
||||||
@ -273,7 +307,7 @@ func CreateBundleBalance(req *bundle.CreateBundleBalanceReq) (*bundle.CreateBund
|
|||||||
data.ExpiredAt = time.Now()
|
data.ExpiredAt = time.Now()
|
||||||
userId, err := strconv.Atoi(addValues[0].CustomerID)
|
userId, err := strconv.Atoi(addValues[0].CustomerID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, errors.New("获取用户ID失败")
|
||||||
}
|
}
|
||||||
data.Month = time.Now().Format("2006-01")
|
data.Month = time.Now().Format("2006-01")
|
||||||
data.UserId = userId
|
data.UserId = userId
|
||||||
@ -349,7 +383,6 @@ func CreateBundleBalance(req *bundle.CreateBundleBalanceReq) (*bundle.CreateBund
|
|||||||
data.IncreaseLimitDataAnalysisNumber += int(v.Num)
|
data.IncreaseLimitDataAnalysisNumber += int(v.Num)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
data.IncreaseDataAnalysisNumber += int(v.Num)
|
data.IncreaseDataAnalysisNumber += int(v.Num)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -368,6 +401,30 @@ func CreateBundleBalance(req *bundle.CreateBundleBalanceReq) (*bundle.CreateBund
|
|||||||
case "年":
|
case "年":
|
||||||
data.ExpiredAt = data.ExpiredAt.Add(time.Hour * 24 * 365 * time.Duration(v.Num))
|
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()
|
now := time.Now()
|
||||||
@ -386,6 +443,11 @@ func CreateBundleBalance(req *bundle.CreateBundleBalanceReq) (*bundle.CreateBund
|
|||||||
data.MonthlyBundleLimitDataAnalysisNumber = cal(data, data.BundleLimitDataAnalysisNumber, data.MonthlyLimitDataAnalysisQuotaNumber, now)
|
data.MonthlyBundleLimitDataAnalysisNumber = cal(data, data.BundleLimitDataAnalysisNumber, data.MonthlyLimitDataAnalysisQuotaNumber, now)
|
||||||
data.MonthlyIncreaseLimitDataAnalysisNumber = cal(data, data.IncreaseLimitDataAnalysisNumber, 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)
|
err = dao.CreateBundleBalance(data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error(err)
|
logger.Error(err)
|
||||||
@ -492,11 +554,11 @@ func BundleBalanceExport(req *bundle.BundleBalanceExportReq) (*bundle.BundleBala
|
|||||||
PageSize: 99999,
|
PageSize: 99999,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, errors.New("余量列表数据失败")
|
||||||
}
|
}
|
||||||
prefixData, err := dao.BalanceExportPrefix()
|
prefixData, err := dao.BalanceExportPrefix()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, errors.New("获取前缀数据失败")
|
||||||
}
|
}
|
||||||
|
|
||||||
var prefixMap = map[int32]model.BundleExportDto{}
|
var prefixMap = map[int32]model.BundleExportDto{}
|
||||||
@ -522,6 +584,8 @@ func BundleBalanceExport(req *bundle.BundleBalanceExportReq) (*bundle.BundleBala
|
|||||||
item.MonthlyIncreaseImageConsumptionNumber = v.MonthIncreaseImageConsumptionNumber
|
item.MonthlyIncreaseImageConsumptionNumber = v.MonthIncreaseImageConsumptionNumber
|
||||||
item.MonthlyBundleDataAnalysisConsumptionNumber = v.MonthBundleDataAnalysisConsumptionNumber
|
item.MonthlyBundleDataAnalysisConsumptionNumber = v.MonthBundleDataAnalysisConsumptionNumber
|
||||||
item.MonthlyIncreaseDataAnalysisConsumptionNumber = v.MonthIncreaseDataAnalysisConsumptionNumber
|
item.MonthlyIncreaseDataAnalysisConsumptionNumber = v.MonthIncreaseDataAnalysisConsumptionNumber
|
||||||
|
item.MonthlyBundleCompetitiveConsumptionNumber = v.MonthBundleCompetitiveConsumptionNumber
|
||||||
|
item.MonthlyIncreaseCompetitiveConsumptionNumber = v.MonthIncreaseCompetitiveConsumptionNumber
|
||||||
item.Currency = "USD"
|
item.Currency = "USD"
|
||||||
f, _ := strconv.ParseFloat(prefixItem.Fee, 64)
|
f, _ := strconv.ParseFloat(prefixItem.Fee, 64)
|
||||||
item.Fee = fmt.Sprintf("%.2f", f)
|
item.Fee = fmt.Sprintf("%.2f", f)
|
||||||
@ -535,6 +599,14 @@ func BundleBalanceExport(req *bundle.BundleBalanceExportReq) (*bundle.BundleBala
|
|||||||
} else {
|
} else {
|
||||||
item.IncreaseVideoUnitPrice = float32(math.Round(float64(item.IncreaseAmount/float32(v.IncreaseVideoNumber))*100) / 100)
|
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)
|
items = append(items, item)
|
||||||
}
|
}
|
||||||
return &bundle.BundleBalanceExportResp{Total: int64(len(items)), Data: items}, nil
|
return &bundle.BundleBalanceExportResp{Total: int64(len(items)), Data: items}, nil
|
||||||
@ -619,15 +691,31 @@ func buildDefaultBalanceLayout() string {
|
|||||||
{"当月可用增值数据数", "monthlyIncreaseDataAnalysisNumber", 2},
|
{"当月可用增值数据数", "monthlyIncreaseDataAnalysisNumber", 2},
|
||||||
{"当月作废套餐数据数", "monthlyInvalidBundleDataAnalysisNumber", 2},
|
{"当月作废套餐数据数", "monthlyInvalidBundleDataAnalysisNumber", 2},
|
||||||
{"当月作废增值数据数", "monthlyInvalidIncreaseDataAnalysisNumber", 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},
|
{"当月新增手动扩展账号数", "monthlyNewManualAccountNumber", 2},
|
||||||
{"当月新增手动扩展视频数", "monthlyNewManualVideoNumber", 2},
|
{"当月新增手动扩展视频数", "monthlyNewManualVideoNumber", 2},
|
||||||
{"当月新增手动扩展图文数", "monthlyNewManualImageNumber", 2},
|
{"当月新增手动扩展图文数", "monthlyNewManualImageNumber", 2},
|
||||||
{"当月新增手动扩展数据数", "monthlyNewManualDataAnalysisNumber", 2},
|
{"当月新增手动扩展数据数", "monthlyNewManualDataAnalysisNumber", 2},
|
||||||
|
{"当月新增手动扩展竞品数", "monthlyNewManualCompetitiveNumber", 2},
|
||||||
{"当月新增手动扩展时长(日)", "monthlyNewDurationNumber", 2},
|
{"当月新增手动扩展时长(日)", "monthlyNewDurationNumber", 2},
|
||||||
{"当月已用手动扩展账号数", "monthlyManualAccountConsumptionNumber", 2},
|
{"当月已用手动扩展账号数", "monthlyManualAccountConsumptionNumber", 2},
|
||||||
{"当月已用手动扩展视频数", "monthlyManualVideoConsumptionNumber", 2},
|
{"当月已用手动扩展视频数", "monthlyManualVideoConsumptionNumber", 2},
|
||||||
{"当月已用手动扩展图文数", "monthlyManualImageConsumptionNumber", 2},
|
{"当月已用手动扩展图文数", "monthlyManualImageConsumptionNumber", 2},
|
||||||
{"当月已用手动扩展数据数", "monthlyManualDataAnalysisConsumptionNumber", 2},
|
{"当月已用手动扩展数据数", "monthlyManualDataAnalysisConsumptionNumber", 2},
|
||||||
|
{"当月已用手动扩展竞品数", "monthlyManualCompetitiveConsumptionNumber", 2},
|
||||||
}
|
}
|
||||||
jsonMap := []map[string]any{}
|
jsonMap := []map[string]any{}
|
||||||
for _, v := range data {
|
for _, v := range data {
|
||||||
|
|||||||
@ -73,7 +73,7 @@ func SaveBundle(req *bundle.BundleProfile) (res *bundle.SaveResponse, err error)
|
|||||||
Content: req.Content,
|
Content: req.Content,
|
||||||
Price: req.Price,
|
Price: req.Price,
|
||||||
PriceType: req.PriceType,
|
PriceType: req.PriceType,
|
||||||
Contract: "https://e-cdn.fontree.cn/fonchain-main/prod/file/saas/contract/template-25032801.pdf",
|
Contract: "https://e-cdn.fontree.cn/fonchain-main/prod/file/contract/saas/template-25122501.pdf",
|
||||||
ImgOption: int8(req.ImgOption),
|
ImgOption: int8(req.ImgOption),
|
||||||
BgImg1: req.BgImg1,
|
BgImg1: req.BgImg1,
|
||||||
BgImg2: req.BgImg2,
|
BgImg2: req.BgImg2,
|
||||||
@ -698,3 +698,13 @@ func BundleListH5V2(req *bundle.BundleListRequest) (res *bundle.BundleListRespon
|
|||||||
}
|
}
|
||||||
return res, nil
|
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,3 +26,7 @@ func MetricsArtistAccountExport(req *bundle.MetricsArtistAccountExportReq) (*bun
|
|||||||
func MetricsVideoSubmitExport(req *bundle.MetricsVideoSubmitExportReq) (*bundle.MetricsVideoSubmitExportResp, error) {
|
func MetricsVideoSubmitExport(req *bundle.MetricsVideoSubmitExportReq) (*bundle.MetricsVideoSubmitExportResp, error) {
|
||||||
return dao.MetricsVideoSubmitExport(req)
|
return dao.MetricsVideoSubmitExport(req)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ExportWorkCastInfo(req *bundle.ExportWorkCastInfoReq) (*bundle.ExportWorkCastInfoResp, error) {
|
||||||
|
return dao.ExportWorkCastInfo(req)
|
||||||
|
}
|
||||||
|
|||||||
@ -68,6 +68,8 @@ func CreateOrderRecord(req *bundle.OrderCreateRecord) (res *bundle.CommonRespons
|
|||||||
ExpirationTime: req.ExpirationTime,
|
ExpirationTime: req.ExpirationTime,
|
||||||
Language: req.Language,
|
Language: req.Language,
|
||||||
BundleOrderValueAdd: addRecords,
|
BundleOrderValueAdd: addRecords,
|
||||||
|
PlatformIds: req.PlatformIds,
|
||||||
|
InviterID: req.InviterId,
|
||||||
}
|
}
|
||||||
res, err = dao.CreateOrderRecord(orderRecord)
|
res, err = dao.CreateOrderRecord(orderRecord)
|
||||||
return
|
return
|
||||||
@ -182,3 +184,8 @@ func SoftDeleteUnfinishedInfo(req *bundle.SoftDeleteUnfinishedInfoRequest) (res
|
|||||||
res, err = dao.SoftDeleteUnfinishedInfo(req)
|
res, err = dao.SoftDeleteUnfinishedInfo(req)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
func ReSignTheContract(req *bundle.ReSignTheContractRequest) (res *bundle.CommonResponse, err error) {
|
||||||
|
res = new(bundle.CommonResponse)
|
||||||
|
res, err = dao.ReSignTheContract(req)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|||||||
@ -3,19 +3,18 @@ package logic
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"micro-bundle/internal/dao"
|
"micro-bundle/internal/dao"
|
||||||
|
"micro-bundle/internal/dto"
|
||||||
"micro-bundle/pb/bundle"
|
"micro-bundle/pb/bundle"
|
||||||
commonErr "micro-bundle/pkg/err"
|
commonErr "micro-bundle/pkg/err"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetValidArtistList 查询套餐状态为有效中的艺人列表
|
// GetValidArtistList 查询套餐状态为有效中的艺人列表
|
||||||
// 调用dao层获取艺人详细信息
|
func GetValidArtistList() ([]dto.ValidArtistInfo, error) {
|
||||||
func GetValidArtistList() ([]dao.ValidArtistInfo, error) {
|
|
||||||
return dao.GetValidArtistList()
|
return dao.GetValidArtistList()
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetValidArtistIDs 查询套餐没有过期的艺人ID列表(保持向后兼容)
|
// GetValidArtistIDs 查询套餐没有过期的艺人ID列表(保持向后兼容)
|
||||||
// 根据BundleOrderRecords表查询过期时间大于当前时间且状态为已支付的艺人
|
|
||||||
func GetValidArtistIDs() ([]string, error) {
|
func GetValidArtistIDs() ([]string, error) {
|
||||||
artistList, err := GetValidArtistList()
|
artistList, err := GetValidArtistList()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -34,8 +33,6 @@ func GetValidArtistIDs() ([]string, error) {
|
|||||||
|
|
||||||
// todo 目前暂时不做检验,后续需要做判断
|
// todo 目前暂时不做检验,后续需要做判断
|
||||||
// GetValidEmployeeIDs 查询可以被指派任务的员工ID列表
|
// GetValidEmployeeIDs 查询可以被指派任务的员工ID列表
|
||||||
// 这里可以根据实际业务需求实现,比如查询员工表、权限表等
|
|
||||||
// 目前先返回一个示例实现,实际项目中需要根据具体的员工管理逻辑来实现
|
|
||||||
func GetValidEmployeeIDs() ([]string, error) {
|
func GetValidEmployeeIDs() ([]string, error) {
|
||||||
var employeeIDs []string
|
var employeeIDs []string
|
||||||
|
|
||||||
@ -63,40 +60,18 @@ func ValidateEmployee(employeeNum string) (bool, error) {
|
|||||||
return false, nil
|
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 查询艺人上传与额度统计列表
|
// GetArtistUploadStatsList 查询艺人上传与额度统计列表
|
||||||
func GetArtistUploadStatsList(req *dao.TaskQueryRequest) ([]*dao.ArtistUploadStatsItem, int64, error) {
|
func GetArtistUploadStatsList(req *dto.TaskQueryRequest) ([]*dto.ArtistUploadStatsItem, int64, error) {
|
||||||
return dao.GetArtistUploadStatsList(req)
|
return dao.GetArtistUploadStatsList(req)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetPendingUploadBreakdownBySubNums(subNums []string, page int, pageSize int) ([]*dao.ArtistPendingUploadBreakdownItem, int64, error) {
|
|
||||||
return dao.GetPendingUploadBreakdownBySubNums(subNums, page, pageSize)
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetPendingAssignBySubNums 查询指定艺人的可指派数量
|
// GetPendingAssignBySubNums 查询指定艺人的可指派数量
|
||||||
func GetPendingAssignBySubNums(subNums []string, page int, pageSize int) ([]*dao.ArtistPendingAssignItem, int64, error) {
|
func GetPendingAssignBySubNums(subNums []string, page int, pageSize int) ([]*dto.ArtistPendingAssignItem, int64, error) {
|
||||||
return dao.GetPendingAssignBySubNums(subNums, page, pageSize)
|
return dao.GetPendingAssignBySubNums(subNums, page, pageSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
// AssignTask 指派某位员工完成某个艺人的任务
|
// AssignTask 指派某位员工完成某个艺人的任务
|
||||||
func AssignTask(req *dao.TaskAssignRequest) error {
|
func AssignTask(req *dto.TaskAssignRequest) error {
|
||||||
// 1. 验证员工是否可以被指派任务
|
// 1. 验证员工是否可以被指派任务
|
||||||
isValid, err := ValidateEmployee(req.TaskAssigneeNum)
|
isValid, err := ValidateEmployee(req.TaskAssigneeNum)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -124,7 +99,7 @@ func AssignTask(req *dao.TaskAssignRequest) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// BatchAssignTask 批量指派
|
// BatchAssignTask 批量指派
|
||||||
func BatchAssignTask(items []*dao.BatchAssignItem) error {
|
func BatchAssignTask(items []*dto.BatchAssignItem) error {
|
||||||
if len(items) == 0 {
|
if len(items) == 0 {
|
||||||
return commonErr.ReturnError(nil, "参数错误", "批量指派项不能为空")
|
return commonErr.ReturnError(nil, "参数错误", "批量指派项不能为空")
|
||||||
}
|
}
|
||||||
@ -160,42 +135,6 @@ func BatchAssignTask(items []*dao.BatchAssignItem) error {
|
|||||||
return dao.BatchAssignTasks(items)
|
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 查询最近被指派记录
|
// GetRecentAssignRecords 查询最近被指派记录
|
||||||
func GetRecentAssignRecords(limit int) ([]*bundle.RecentAssigneeItem, error) {
|
func GetRecentAssignRecords(limit int) ([]*bundle.RecentAssigneeItem, error) {
|
||||||
records, err := dao.GetRecentAssignRecords(limit)
|
records, err := dao.GetRecentAssignRecords(limit)
|
||||||
@ -214,7 +153,7 @@ func GetRecentAssignRecords(limit int) ([]*bundle.RecentAssigneeItem, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetEmployeeAssignedTasks 根据登录人信息查询被指派给该员工的艺人任务
|
// GetEmployeeAssignedTasks 根据登录人信息查询被指派给该员工的艺人任务
|
||||||
func GetEmployeeAssignedTasks(req *dao.EmployeeTaskQueryRequest) ([]*dao.TaskAssignRecordsResponse, int64, error) {
|
func GetEmployeeAssignedTasks(req *dto.EmployeeTaskQueryRequest) ([]*dto.TaskAssignRecordsResponse, int64, error) {
|
||||||
// 1. 调用DAO层查询被指派给该员工的艺人任务
|
// 1. 调用DAO层查询被指派给该员工的艺人任务
|
||||||
record, total, err := dao.GetEmployeeAssignedTasks(req)
|
record, total, err := dao.GetEmployeeAssignedTasks(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -223,9 +162,9 @@ func GetEmployeeAssignedTasks(req *dao.EmployeeTaskQueryRequest) ([]*dao.TaskAss
|
|||||||
|
|
||||||
// 如果查询的 status = 2 的话,待发数量就为指派时,指派的数量
|
// 如果查询的 status = 2 的话,待发数量就为指派时,指派的数量
|
||||||
if req.Status == 2 {
|
if req.Status == 2 {
|
||||||
var recordResponse []*dao.TaskAssignRecordsResponse
|
var recordResponse []*dto.TaskAssignRecordsResponse
|
||||||
for _, record := range record {
|
for _, record := range record {
|
||||||
recordResponse = append(recordResponse, &dao.TaskAssignRecordsResponse{
|
recordResponse = append(recordResponse, &dto.TaskAssignRecordsResponse{
|
||||||
AssignRecordsUUID: record.AssignRecordsUUID,
|
AssignRecordsUUID: record.AssignRecordsUUID,
|
||||||
SubNum: record.SubNum,
|
SubNum: record.SubNum,
|
||||||
TelNum: record.TelNum,
|
TelNum: record.TelNum,
|
||||||
@ -252,9 +191,9 @@ func GetEmployeeAssignedTasks(req *dao.EmployeeTaskQueryRequest) ([]*dao.TaskAss
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 2. 转换为响应结构体
|
// 2. 转换为响应结构体
|
||||||
var recordResponse []*dao.TaskAssignRecordsResponse
|
var recordResponse []*dto.TaskAssignRecordsResponse
|
||||||
for _, record := range record {
|
for _, record := range record {
|
||||||
recordResponse = append(recordResponse, &dao.TaskAssignRecordsResponse{
|
recordResponse = append(recordResponse, &dto.TaskAssignRecordsResponse{
|
||||||
AssignRecordsUUID: record.AssignRecordsUUID,
|
AssignRecordsUUID: record.AssignRecordsUUID,
|
||||||
SubNum: record.SubNum,
|
SubNum: record.SubNum,
|
||||||
TelNum: record.TelNum,
|
TelNum: record.TelNum,
|
||||||
@ -290,7 +229,6 @@ func TerminateTaskByUUID(assignRecordsUUID string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// BatchTerminateTaskByUUIDs 批量根据指派记录UUID终止任务(实际状态置为已中止)
|
// BatchTerminateTaskByUUIDs 批量根据指派记录UUID终止任务(实际状态置为已中止)
|
||||||
// 返回成功数量、失败数量、失败UUID列表和错误(仅当整体参数错误时返回错误)
|
|
||||||
func BatchTerminateTaskByUUIDs(assignRecordsUUIDs []string) (int, int, []string, error) {
|
func BatchTerminateTaskByUUIDs(assignRecordsUUIDs []string) (int, int, []string, error) {
|
||||||
if len(assignRecordsUUIDs) == 0 {
|
if len(assignRecordsUUIDs) == 0 {
|
||||||
return 0, 0, nil, commonErr.ReturnError(nil, "参数错误", "AssignRecordsUUIDs 不能为空")
|
return 0, 0, nil, commonErr.ReturnError(nil, "参数错误", "AssignRecordsUUIDs 不能为空")
|
||||||
@ -357,7 +295,7 @@ func CompleteTaskManually(assignRecordsUUID string, taskAssigneeNum string) erro
|
|||||||
}
|
}
|
||||||
|
|
||||||
// UpdateTaskProgress 员工实际完成任务状态更新
|
// UpdateTaskProgress 员工实际完成任务状态更新
|
||||||
func UpdateTaskProgress(req *dao.CompleteTaskRequest) error {
|
func UpdateTaskProgress(req *dto.CompleteTaskRequest) error {
|
||||||
if req.UUID == "" {
|
if req.UUID == "" {
|
||||||
return commonErr.ReturnError(nil, "作品UUID不能为空", "UUID不能为空")
|
return commonErr.ReturnError(nil, "作品UUID不能为空", "UUID不能为空")
|
||||||
}
|
}
|
||||||
@ -365,16 +303,16 @@ func UpdateTaskProgress(req *dao.CompleteTaskRequest) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetTaskAssignRecordsList 多条件查询操作记录表
|
// GetTaskAssignRecordsList 多条件查询操作记录表
|
||||||
func GetTaskAssignRecordsList(req *dao.TaskAssignRecordsQueryRequest) ([]*dao.TaskAssignRecordsResponse, int64, *dao.TaskAssignRecordsSummary, error) {
|
func GetTaskAssignRecordsList(req *dto.TaskAssignRecordsQueryRequest) ([]*dto.TaskAssignRecordsResponse, int64, *dto.TaskAssignRecordsSummary, error) {
|
||||||
record, total, summary, err := dao.GetTaskAssignRecordsList(req)
|
record, total, summary, err := dao.GetTaskAssignRecordsList(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, 0, nil, err
|
return nil, 0, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 转换为响应结构体
|
// 2. 转换为响应结构体
|
||||||
var recordResponse []*dao.TaskAssignRecordsResponse
|
var recordResponse []*dto.TaskAssignRecordsResponse
|
||||||
for _, record := range record {
|
for _, record := range record {
|
||||||
recordResponse = append(recordResponse, &dao.TaskAssignRecordsResponse{
|
recordResponse = append(recordResponse, &dto.TaskAssignRecordsResponse{
|
||||||
AssignRecordsUUID: record.AssignRecordsUUID,
|
AssignRecordsUUID: record.AssignRecordsUUID,
|
||||||
SubNum: record.SubNum,
|
SubNum: record.SubNum,
|
||||||
TelNum: record.TelNum,
|
TelNum: record.TelNum,
|
||||||
@ -404,65 +342,6 @@ func GetTaskAssignRecordsList(req *dao.TaskAssignRecordsQueryRequest) ([]*dao.Ta
|
|||||||
return recordResponse, total, summary, nil
|
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查询实际完成状态
|
// GetTaskActualStatusByUUID 根据指派记录UUID查询实际完成状态
|
||||||
func GetTaskActualStatusByUUID(assignRecordsUUID string) (int, error) {
|
func GetTaskActualStatusByUUID(assignRecordsUUID string) (int, error) {
|
||||||
if strings.TrimSpace(assignRecordsUUID) == "" {
|
if strings.TrimSpace(assignRecordsUUID) == "" {
|
||||||
@ -546,3 +425,19 @@ func AddHiddenTaskAssignee(taskAssignee string, taskAssigneeNum string) error {
|
|||||||
}
|
}
|
||||||
return dao.AddHiddenTaskAssignee(taskAssignee, taskAssigneeNum)
|
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,6 +97,7 @@ type BundleExtensionRecords struct {
|
|||||||
OperatorName string `gorm:"column:operator_name;type:varchar(256)" json:"operatorName"`
|
OperatorName string `gorm:"column:operator_name;type:varchar(256)" json:"operatorName"`
|
||||||
OperatorPhoneNumber string `gorm:"column:operator_phone_number;type:varchar(256)" json:"operatorPhoneNumber"`
|
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"`
|
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 表名称
|
// TableName 表名称
|
||||||
@ -111,6 +112,7 @@ type BundleExtendRecordItemPo struct {
|
|||||||
ImagesAdditional int
|
ImagesAdditional int
|
||||||
DataAdditional int
|
DataAdditional int
|
||||||
VideoAdditional int
|
VideoAdditional int
|
||||||
|
CompetitiveAdditional int
|
||||||
AvailableDurationAdditional uint `gorm:"column:available_duration_additional;type:int(11) unsigned;comment:可用时长增加" json:"available_duration_additional"`
|
AvailableDurationAdditional uint `gorm:"column:available_duration_additional;type:int(11) unsigned;comment:可用时长增加" json:"available_duration_additional"`
|
||||||
Type int
|
Type int
|
||||||
Remark string
|
Remark string
|
||||||
@ -290,6 +292,39 @@ type BundleBalance struct {
|
|||||||
|
|
||||||
MonthlyNewDurationNumber int `gorm:"column:monthly_new_duration_number;comment:当月新增手动扩展时长(天)"`
|
MonthlyNewDurationNumber int `gorm:"column:monthly_new_duration_number;comment:当月新增手动扩展时长(天)"`
|
||||||
ExpansionPacksNumber int `gorm:"column:expansion_packs_number;not null;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 表名称
|
// TableName 表名称
|
||||||
@ -314,12 +349,14 @@ type BundleBalanceUsePo struct {
|
|||||||
VideoNumber int
|
VideoNumber int
|
||||||
ImageNumber int
|
ImageNumber int
|
||||||
DataAnalysisNumber int
|
DataAnalysisNumber int
|
||||||
|
CompetitiveNumber int
|
||||||
}
|
}
|
||||||
type BundleBalanceExtendPo struct {
|
type BundleBalanceExtendPo struct {
|
||||||
UserId int
|
UserId int
|
||||||
AccountNumber int
|
AccountNumber int
|
||||||
VideoNumber int
|
VideoNumber int
|
||||||
ImageNumber int
|
ImageNumber int
|
||||||
|
CompetitiveNumber int
|
||||||
DataAnalysisNumber int
|
DataAnalysisNumber int
|
||||||
DurationNumber int
|
DurationNumber int
|
||||||
}
|
}
|
||||||
@ -377,6 +414,7 @@ type ManualIncreaseBundleBalance struct {
|
|||||||
TotalVideoAdditional int `gorm:"column:total_video_additional"`
|
TotalVideoAdditional int `gorm:"column:total_video_additional"`
|
||||||
TotalImageAdditional int `gorm:"column:total_image_additional"`
|
TotalImageAdditional int `gorm:"column:total_image_additional"`
|
||||||
TotalDataAnalysisAdditional int `gorm:"column:total_data_analysis_additional"`
|
TotalDataAnalysisAdditional int `gorm:"column:total_data_analysis_additional"`
|
||||||
|
TotalCompetitiveAdditional int `gorm:"column:total_competitive_additional"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// 套餐购买导出
|
// 套餐购买导出
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"database/sql/driver"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
|
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
@ -41,6 +43,9 @@ type BundleOrderRecords struct {
|
|||||||
BundleCommonJson json.RawMessage `json:"bundle_common_json" gorm:"column:bundle_common_json;type:json;serializer:json;comment:套餐信息"`
|
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"`
|
Language string `gorm:"column:language;comment:语言" json:"language"`
|
||||||
BundleOrderValueAdd []BundleOrderValueAdd `gorm:"foreignKey:OrderUUID;references:UUID" json:"bundleOrderValueAdd"`
|
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 {
|
type BundleOrderValueAdd struct {
|
||||||
gorm.Model
|
gorm.Model
|
||||||
@ -72,6 +77,30 @@ type BundleOrderValueAdd struct {
|
|||||||
QuotaValue int32 `json:"quotaValue" gorm:"column:quota_value;type:int;comment:额度值"`
|
QuotaValue int32 `json:"quotaValue" gorm:"column:quota_value;type:int;comment:额度值"`
|
||||||
IsExpired bool `json:"isExpired" gorm:"column:is_expired;default:false;comment:是否过期作废 false:不作废 true:作废"`
|
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 (
|
const (
|
||||||
|
|||||||
@ -1,8 +1,9 @@
|
|||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"gorm.io/gorm"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
// 用来自动导入 来创建用户和订单的 数据
|
// 用来自动导入 来创建用户和订单的 数据
|
||||||
@ -19,6 +20,7 @@ type FieePaymentAuto struct {
|
|||||||
UserIdCardFrontUrl string `json:"userIdCardFrontUrl" gorm:"column:user_id_card_front_url;type:varchar(1024);comment:用户身份证正面"`
|
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:用户身份证反面"`
|
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:证件有效期"`
|
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:订单编号"`
|
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"`
|
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"`
|
OrderSettlementAmount string `gorm:"column:order_settlement_amount;type:decimal(20,2);comment:订单结算金额" json:"orderSettlementAmount"`
|
||||||
|
|||||||
@ -12,6 +12,7 @@ var OrderByDataAnalysis = map[string]string{
|
|||||||
"increase_data_analysis_total": "increase_data_total",
|
"increase_data_analysis_total": "increase_data_total",
|
||||||
"released_data_analysis_total": "released_data_total",
|
"released_data_analysis_total": "released_data_total",
|
||||||
"pending_data_analysis_count": "pending_data_count",
|
"pending_data_analysis_count": "pending_data_count",
|
||||||
|
"sub_num": "customer_num",
|
||||||
}
|
}
|
||||||
|
|
||||||
var OrderByPending = map[string]string{
|
var OrderByPending = map[string]string{
|
||||||
@ -241,41 +242,6 @@ func (TaskSyncStatus) TableName() string { return "task_sync_status" }
|
|||||||
// InitialSyncKey 一次性同步的唯一标识键
|
// InitialSyncKey 一次性同步的唯一标识键
|
||||||
const InitialSyncKey = "bundle_to_task_balance_initial_sync"
|
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 {
|
type TaskAssigneeHidden struct {
|
||||||
// 让id自增
|
// 让id自增
|
||||||
@ -291,3 +257,36 @@ type TaskAssigneeHidden struct {
|
|||||||
func (TaskAssigneeHidden) TableName() string {
|
func (TaskAssigneeHidden) TableName() string {
|
||||||
return "task_assignee_hidden"
|
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"
|
||||||
|
}
|
||||||
|
|||||||
259
pb/bundle.proto
259
pb/bundle.proto
@ -14,15 +14,11 @@ service Bundle {
|
|||||||
rpc HandShelf(HandShelfRequest) returns(CommonResponse) {} //更新套餐上下架状态
|
rpc HandShelf(HandShelfRequest) returns(CommonResponse) {} //更新套餐上下架状态
|
||||||
rpc SaveBundle(BundleProfile)returns (SaveResponse) {}
|
rpc SaveBundle(BundleProfile)returns (SaveResponse) {}
|
||||||
|
|
||||||
|
|
||||||
rpc BundleListV2(BundleListRequest) returns(BundleListResponse) {}
|
rpc BundleListV2(BundleListRequest) returns(BundleListResponse) {}
|
||||||
rpc BundleDetailV2(BundleDetailRequest) returns(BundleDetailResponseV2) {}
|
rpc BundleDetailV2(BundleDetailRequest) returns(BundleDetailResponseV2) {}
|
||||||
rpc BundleListH5V2(BundleListRequest) returns(BundleListResponse) {}
|
rpc BundleListH5V2(BundleListRequest) returns(BundleListResponse) {}
|
||||||
rpc BundleLangDetailV2(BundleDetailRequest) returns(BundleProfileLang) {}
|
rpc BundleLangDetailV2(BundleDetailRequest) returns(BundleProfileLang) {}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
rpc BundleList(BundleListRequest) returns (BundleListResponse) {}
|
rpc BundleList(BundleListRequest) returns (BundleListResponse) {}
|
||||||
rpc BundleDetail(BundleDetailRequest) returns (BundleDetailResponse) {}
|
rpc BundleDetail(BundleDetailRequest) returns (BundleDetailResponse) {}
|
||||||
|
|
||||||
@ -37,6 +33,7 @@ service Bundle {
|
|||||||
rpc OrderRecordsListV2(OrderRecordsRequestV2) returns (OrderRecordsResponseV2) {}
|
rpc OrderRecordsListV2(OrderRecordsRequestV2) returns (OrderRecordsResponseV2) {}
|
||||||
rpc OrderListByOrderNo(OrderInfoByOrderNoRequest) returns (OrderInfoByOrderNoResp) {}
|
rpc OrderListByOrderNo(OrderInfoByOrderNoRequest) returns (OrderInfoByOrderNoResp) {}
|
||||||
rpc OnlyAddValueListByOrderNo(OnlyAddValueListByOrderNoRequest) returns (OnlyAddValueListByOrderNoResp) {} // 根据orderNo只查增值服务
|
rpc OnlyAddValueListByOrderNo(OnlyAddValueListByOrderNoRequest) returns (OnlyAddValueListByOrderNoResp) {} // 根据orderNo只查增值服务
|
||||||
|
rpc ReSignTheContract(ReSignTheContractRequest) returns (CommonResponse) {}
|
||||||
|
|
||||||
//增值套餐
|
//增值套餐
|
||||||
rpc CreateValueAddBundle(CreateValueAddBundleRequest) returns (CreateValueAddBundleResponse) {}
|
rpc CreateValueAddBundle(CreateValueAddBundleRequest) returns (CreateValueAddBundleResponse) {}
|
||||||
@ -105,6 +102,7 @@ service Bundle {
|
|||||||
rpc GetPendingAssign(PendingAssignRequest) returns (PendingAssignResponse) {} // 查询艺人可指派数量
|
rpc GetPendingAssign(PendingAssignRequest) returns (PendingAssignResponse) {} // 查询艺人可指派数量
|
||||||
rpc RevertTaskCompletionByUUIDItem(RevertTaskCompletionByUUIDItemRequest) returns (ComResponse) {}
|
rpc RevertTaskCompletionByUUIDItem(RevertTaskCompletionByUUIDItemRequest) returns (ComResponse) {}
|
||||||
rpc AddHiddenTaskAssignee(AddHiddenTaskAssigneeRequest) returns (ComResponse) {}
|
rpc AddHiddenTaskAssignee(AddHiddenTaskAssigneeRequest) returns (ComResponse) {}
|
||||||
|
rpc CreateTaskWorkLog(CreateTaskWorkLogRequest) returns (CommonResponse) {} // 创建任务日志记录
|
||||||
|
|
||||||
//数据指标
|
//数据指标
|
||||||
rpc MetricsBusiness(MetricsBusinessReq) returns (MetricsBusinessResp) {}
|
rpc MetricsBusiness(MetricsBusinessReq) returns (MetricsBusinessResp) {}
|
||||||
@ -113,7 +111,28 @@ service Bundle {
|
|||||||
rpc MetricsBundlePurchaseExport(MetricsBundlePurchaseExportReq) returns (MetricsBundlePurchaseExportResp) {}
|
rpc MetricsBundlePurchaseExport(MetricsBundlePurchaseExportReq) returns (MetricsBundlePurchaseExportResp) {}
|
||||||
rpc MetricsArtistAccountExport(MetricsArtistAccountExportReq) returns (MetricsArtistAccountExportResp) {}
|
rpc MetricsArtistAccountExport(MetricsArtistAccountExportReq) returns (MetricsArtistAccountExportResp) {}
|
||||||
rpc MetricsVideoSubmitExport(MetricsVideoSubmitExportReq) returns (MetricsVideoSubmitExportResp) {}
|
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{
|
message DeleteValueAddServiceRequest{
|
||||||
string orderNo = 1;
|
string orderNo = 1;
|
||||||
@ -197,6 +216,8 @@ message OrderCreateRecord{
|
|||||||
int32 payType = 19 [json_name = "payType"];
|
int32 payType = 19 [json_name = "payType"];
|
||||||
repeated OrderCreateAddRecord addRecords = 20 [json_name = "addRecords"]; //增值服务
|
repeated OrderCreateAddRecord addRecords = 20 [json_name = "addRecords"]; //增值服务
|
||||||
string orderNo = 21 [json_name = "orderNo"];
|
string orderNo = 21 [json_name = "orderNo"];
|
||||||
|
repeated uint32 platformIds = 22; // 发布平台ID集合 (json 格式字符串)
|
||||||
|
uint64 inviterId = 23; // 邀请人ID
|
||||||
}
|
}
|
||||||
message OrderCreateAddRecord{
|
message OrderCreateAddRecord{
|
||||||
int32 serviceType = 1 [json_name = "serviceType"];
|
int32 serviceType = 1 [json_name = "serviceType"];
|
||||||
@ -249,6 +270,9 @@ message OrderBundleRecordInfo{
|
|||||||
int64 customerId = 9;
|
int64 customerId = 9;
|
||||||
string payTime = 10;
|
string payTime = 10;
|
||||||
string subNum = 11;
|
string subNum = 11;
|
||||||
|
uint64 inviterId = 12;
|
||||||
|
string inviterCode = 13;
|
||||||
|
string inviterName = 14;
|
||||||
}
|
}
|
||||||
message OrderAddBundleRecordInfo{
|
message OrderAddBundleRecordInfo{
|
||||||
string orderAddNo = 1;
|
string orderAddNo = 1;
|
||||||
@ -429,6 +453,7 @@ message OrderRecord {
|
|||||||
string expirationTime = 37 [json_name = "expirationTime"];
|
string expirationTime = 37 [json_name = "expirationTime"];
|
||||||
string snapshot = 38 [json_name = "snapshot"];
|
string snapshot = 38 [json_name = "snapshot"];
|
||||||
repeated AddInfo addInfos = 39 [json_name = "addInfos"];
|
repeated AddInfo addInfos = 39 [json_name = "addInfos"];
|
||||||
|
int32 reSignature = 40 [json_name = "reSignature"];
|
||||||
}
|
}
|
||||||
message AddInfo{
|
message AddInfo{
|
||||||
string orderNo = 1 [json_name = "orderNo"];
|
string orderNo = 1 [json_name = "orderNo"];
|
||||||
@ -578,7 +603,7 @@ message ValueAddService {
|
|||||||
message ValueAddServiceLang {
|
message ValueAddServiceLang {
|
||||||
string uuid = 1 [json_name = "uuid"];
|
string uuid = 1 [json_name = "uuid"];
|
||||||
string serviceName = 2 [json_name = "serviceName"]; //服务名称
|
string serviceName = 2 [json_name = "serviceName"]; //服务名称
|
||||||
int32 serviceType = 3 [json_name = "serviceType"]; //服务类型 1:数据分析 2:图文 3:数据报表 4:账号数 5:可用时长
|
int32 serviceType = 3 [json_name = "serviceType"]; //服务类型 1:数据分析 2:图文 3:数据报表 4:账号数 5:可用时长 6:竞品数
|
||||||
int32 priceMode = 4 [json_name = "priceMode"]; //套餐价格类型 1:单价 2:总价
|
int32 priceMode = 4 [json_name = "priceMode"]; //套餐价格类型 1:单价 2:总价
|
||||||
string originalPrice = 5 [json_name = "originalPrice"];//原单价
|
string originalPrice = 5 [json_name = "originalPrice"];//原单价
|
||||||
string unit = 6 [json_name = "unit"];//单位 1:个 2:条 3:天 4:月 5:年 6:自然月 7:自然季度 8:半年 9:自然年
|
string unit = 6 [json_name = "unit"];//单位 1:个 2:条 3:天 4:月 5:年 6:自然月 7:自然季度 8:半年 9:自然年
|
||||||
@ -645,17 +670,18 @@ message BatchGetValueAddServiceLangResponse{
|
|||||||
message BundleExtendRequest{
|
message BundleExtendRequest{
|
||||||
int64 userId = 1;
|
int64 userId = 1;
|
||||||
uint32 accountAdditional = 2;
|
uint32 accountAdditional = 2;
|
||||||
uint32 videoAdditional = 3;
|
uint32 videoAdditional = 3;//视频
|
||||||
uint32 imagesAdditional = 4;
|
uint32 imagesAdditional = 4; //图文
|
||||||
uint32 dataAdditional = 5;
|
uint32 dataAdditional = 5;//数据分析
|
||||||
uint32 availableDurationAdditional = 6;
|
uint32 competitiveAdditional = 6;//竞品数
|
||||||
uint32 timeUnit = 7; // 1 日 2 月 3年
|
uint32 availableDurationAdditional = 7;
|
||||||
string remark = 8;
|
uint32 timeUnit = 8; // 1 日 2 月 3年
|
||||||
string associatedorderNumber = 9;
|
string remark = 9;
|
||||||
uint64 operatorId = 10;
|
string associatedorderNumber = 10;
|
||||||
string operatorName = 11;
|
uint64 operatorId = 11;
|
||||||
string operatorPhoneNumber = 12;
|
string operatorName = 12;
|
||||||
int32 type = 13;
|
string operatorPhoneNumber = 13;
|
||||||
|
int32 type = 14;
|
||||||
}
|
}
|
||||||
|
|
||||||
message BundleExtendResponse{
|
message BundleExtendResponse{
|
||||||
@ -705,7 +731,7 @@ message GetBundleBalanceListReq{
|
|||||||
int64 expiredTimeEnd = 8;
|
int64 expiredTimeEnd = 8;
|
||||||
int32 page = 9;
|
int32 page = 9;
|
||||||
int32 pageSize = 10;
|
int32 pageSize = 10;
|
||||||
string month = 11;
|
repeated string month = 11;
|
||||||
int32 statusType = 12;
|
int32 statusType = 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -788,24 +814,44 @@ message BundleBalanceItem {
|
|||||||
int32 monthlyInvalidBundleDataAnalysisNumber = 57; // 当月作废套餐数据数
|
int32 monthlyInvalidBundleDataAnalysisNumber = 57; // 当月作废套餐数据数
|
||||||
int32 monthlyInvalidIncreaseDataAnalysisNumber = 58; // 当月作废增值数据数
|
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 = 59; // 当月新增手动扩展账号数
|
int32 monthlyNewManualAccountNumber = 73; // 当月新增手动扩展账号数
|
||||||
int32 monthlyNewManualVideoNumber = 60; // 当月新增手动扩展视频数
|
int32 monthlyNewManualVideoNumber = 74; // 当月新增手动扩展视频数
|
||||||
int32 monthlyNewManualImageNumber = 61; // 当月新增手动扩展图文数
|
int32 monthlyNewManualImageNumber = 75; // 当月新增手动扩展图文数
|
||||||
int32 monthlyNewManualDataAnalysisNumber = 62; // 当月新增手动扩展数据数
|
int32 monthlyNewManualDataAnalysisNumber = 76; // 当月新增手动扩展数据数
|
||||||
int32 monthlyNewDurationNumber = 63; // 当月新增手动扩展时长(日)
|
int32 monthlyNewManualCompetitiveNumber = 77; // 当月新增手动扩展竞品数
|
||||||
int32 monthlyManualAccountConsumptionNumber = 64; // 当月已用手动扩展账号数
|
int32 monthlyNewDurationNumber = 78; // 当月新增手动扩展时长(日)
|
||||||
int32 monthlyManualVideoConsumptionNumber = 65; // 当月已用手动扩展视频数
|
int32 monthlyManualAccountConsumptionNumber = 79; // 当月已用手动扩展账号数
|
||||||
int32 monthlyManualImageConsumptionNumber = 66; // 当月已用手动扩展图文数
|
int32 monthlyManualVideoConsumptionNumber = 80; // 当月已用手动扩展视频数
|
||||||
int32 monthlyManualDataAnalysisConsumptionNumber = 67; // 当月已用手动扩展数据数
|
int32 monthlyManualImageConsumptionNumber = 81; // 当月已用手动扩展图文数
|
||||||
int32 manualAccountConsumptionNumber = 68; // 已用手动扩展账号数
|
int32 monthlyManualDataAnalysisConsumptionNumber = 82; // 当月已用手动扩展数据数
|
||||||
int32 manualVideoConsumptionNumber = 69; // 已用手动扩展视频数
|
int32 monthlyManualCompetitiveConsumptionNumber = 83; // 当月已用手动扩展竞品数
|
||||||
int32 manualImageConsumptionNumber = 70; // 已用手动扩展图文数
|
int32 manualAccountConsumptionNumber = 84; // 已用手动扩展账号数
|
||||||
int32 manualDataAnalysisConsumptionNumber = 71; // 已用手动扩展数据数
|
int32 manualVideoConsumptionNumber = 85; // 已用手动扩展视频数
|
||||||
int32 manualAccountNumber = 72; // 可用手动扩展账号数
|
int32 manualImageConsumptionNumber = 86; // 已用手动扩展图文数
|
||||||
int32 manualVideoNumber = 73; // 可用手动扩展视频数
|
int32 manualDataAnalysisConsumptionNumber = 87; // 已用手动扩展数据数
|
||||||
int32 manualImageNumber = 74; // 可用手动扩展图文数
|
int32 manualCompetitiveConsumptionNumber = 88; // 已用手动扩展竞品数
|
||||||
int32 manualDataAnalysisNumber = 75; // 可用手动扩展数据数
|
int32 manualAccountNumber = 89; // 可用手动扩展账号数
|
||||||
|
int32 manualVideoNumber = 90; // 可用手动扩展视频数
|
||||||
|
int32 manualImageNumber = 91; // 可用手动扩展图文数
|
||||||
|
int32 manualDataAnalysisNumber = 92; // 可用手动扩展数据数
|
||||||
|
int32 manualCompetitiveNumber = 93; // 可用手动扩展竞品数
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -879,21 +925,43 @@ message BundleBalanceExportItem {
|
|||||||
int32 monthlyInvalidBundleDataAnalysisNumber = 57; // 当月作废套餐数据分析数
|
int32 monthlyInvalidBundleDataAnalysisNumber = 57; // 当月作废套餐数据分析数
|
||||||
int32 monthlyInvalidIncreaseDataAnalysisNumber = 58; // 当月作废增值数据分析数
|
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 = 59; // 当月手动扩展账号新增数
|
int32 monthlyNewManualAccountNumber = 73; // 当月手动扩展账号新增数
|
||||||
int32 monthlyNewManualVideoNumber = 60; // 当月手动扩展视频新增数
|
int32 monthlyNewManualVideoNumber = 74; // 当月手动扩展视频新增数
|
||||||
int32 monthlyNewManualImageNumber = 61; // 当月手动扩展图文新增数
|
int32 monthlyNewManualImageNumber = 75; // 当月手动扩展图文新增数
|
||||||
int32 monthlyNewManualDataAnalysisNumber = 62; // 当月手动扩展数据分析新增数
|
int32 monthlyNewManualDataAnalysisNumber = 76; // 当月手动扩展数据分析新增数
|
||||||
int32 monthlyNewDurationNumber = 63; // 当月新增手动扩展时长(天)
|
int32 monthlyNewManualCompetitiveNumber = 77; // 当月新增手动扩展竞品数
|
||||||
int32 monthlyManualAccountConsumptionNumber = 64; // 当月手动扩展账号使用数
|
int32 monthlyNewDurationNumber = 78; // 当月新增手动扩展时长(天)
|
||||||
int32 monthlyManualVideoConsumptionNumber = 65; // 当月手动扩展视频使用数
|
int32 monthlyManualAccountConsumptionNumber = 79; // 当月手动扩展账号使用数
|
||||||
int32 monthlyManualImageConsumptionNumber = 66; // 当月手动扩展图文使用数
|
int32 monthlyManualVideoConsumptionNumber = 80; // 当月手动扩展视频使用数
|
||||||
int32 monthlyManualDataAnalysisConsumptionNumber = 67; // 当月手动扩展数据分析使用数
|
int32 monthlyManualImageConsumptionNumber = 81; // 当月手动扩展图文使用数
|
||||||
|
int32 monthlyManualDataAnalysisConsumptionNumber = 82; // 当月手动扩展数据分析使用数
|
||||||
|
int32 monthlyManualCompetitiveConsumptionNumber = 83; // 当月手动扩展竞品使用数
|
||||||
|
|
||||||
|
//视频当月消耗金额
|
||||||
|
string monthlyBundleVideoConsumptionPrice = 84;//当月套餐消耗总金额
|
||||||
|
string monthlyIncreaseVideoConsumptionPrice = 85;//当月增值消耗总金额
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
message BundleBalanceExportReq{
|
message BundleBalanceExportReq{
|
||||||
string month = 1;
|
repeated string month = 1;
|
||||||
string userName = 2;
|
string userName = 2;
|
||||||
uint64 expiredTimeStart = 3;
|
uint64 expiredTimeStart = 3;
|
||||||
uint64 expiredTimeEnd = 4;
|
uint64 expiredTimeEnd = 4;
|
||||||
@ -941,7 +1009,9 @@ message AddBundleBalanceReq{
|
|||||||
int32 imageConsumptionNumber = 9;
|
int32 imageConsumptionNumber = 9;
|
||||||
int32 dataAnalysisNumber = 10;
|
int32 dataAnalysisNumber = 10;
|
||||||
int32 dataAnalysisConsumptionNumber = 11;
|
int32 dataAnalysisConsumptionNumber = 11;
|
||||||
int32 expansionPacksNumber = 12;
|
int32 competitiveNumber = 12;
|
||||||
|
int32 competitiveConsumptionNumber = 13;
|
||||||
|
int32 expansionPacksNumber = 14;
|
||||||
}
|
}
|
||||||
|
|
||||||
message AddBundleBalanceResp{
|
message AddBundleBalanceResp{
|
||||||
@ -1046,7 +1116,7 @@ message GetBundleBalanceByUserIdResp{
|
|||||||
string orderUUID = 1;
|
string orderUUID = 1;
|
||||||
string bundleUuid = 2; // 套餐ID uuid
|
string bundleUuid = 2; // 套餐ID uuid
|
||||||
string bundleName = 3; // 套餐名称
|
string bundleName = 3; // 套餐名称
|
||||||
string bundleStatus = 4; // 套餐名称
|
int32 bundleStatus = 4; // 套餐状态是否过期 1 是 0 否
|
||||||
int64 payTime = 5;
|
int64 payTime = 5;
|
||||||
int64 expiredTime = 6;
|
int64 expiredTime = 6;
|
||||||
string paymentAmount = 7;
|
string paymentAmount = 7;
|
||||||
@ -1070,7 +1140,12 @@ message GetBundleBalanceByUserIdResp{
|
|||||||
int32 dataAnalysisExtendConsumptionNumber = 25;
|
int32 dataAnalysisExtendConsumptionNumber = 25;
|
||||||
int32 dataAnalysisAdditional = 26;
|
int32 dataAnalysisAdditional = 26;
|
||||||
int32 dataAnalysisConsumptionNumber = 27;
|
int32 dataAnalysisConsumptionNumber = 27;
|
||||||
int32 expansionPacksNumber = 28;
|
int32 competitiveNumber = 28;
|
||||||
|
int32 competitiveExtendNumber = 29;
|
||||||
|
int32 competitiveExtendConsumptionNumber = 30;
|
||||||
|
int32 competitiveAdditional = 31;
|
||||||
|
int32 competitiveConsumptionNumber = 32;
|
||||||
|
int32 expansionPacksNumber = 33;
|
||||||
}
|
}
|
||||||
|
|
||||||
message OnlyAddValueListByOrderNoRequest{
|
message OnlyAddValueListByOrderNoRequest{
|
||||||
@ -1145,6 +1220,7 @@ message UnfinishedInfo {
|
|||||||
string orderPayCurrency = 17;
|
string orderPayCurrency = 17;
|
||||||
string orderAccountCurrency = 18;
|
string orderAccountCurrency = 18;
|
||||||
string payTime = 19;
|
string payTime = 19;
|
||||||
|
string cardNum = 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
message SoftDeleteUnfinishedInfoRequest {
|
message SoftDeleteUnfinishedInfoRequest {
|
||||||
@ -1557,6 +1633,23 @@ message GetPendingTaskLayoutResp{ string data = 1; }
|
|||||||
message SetPendingTaskLayoutReq{ string data = 1; }
|
message SetPendingTaskLayoutReq{ string data = 1; }
|
||||||
message SetPendingTaskLayoutResp{}
|
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{
|
message MetricsBusinessReq{
|
||||||
string bundleUuid = 1;
|
string bundleUuid = 1;
|
||||||
string start = 2;
|
string start = 2;
|
||||||
@ -1571,11 +1664,11 @@ message MetricsBusinessResp {
|
|||||||
string finalPaymentAmount = 4; // 合计结算金额
|
string finalPaymentAmount = 4; // 合计结算金额
|
||||||
string totalFeePaymentAmount = 5; // 合计手续费
|
string totalFeePaymentAmount = 5; // 合计手续费
|
||||||
|
|
||||||
float newBundlePaymentAmount = 6; // 新增套餐购买金额
|
string newBundlePaymentAmount = 6; // 新增套餐购买金额
|
||||||
float newIncreasePaymentAmount = 7; // 新增增值服务金额
|
string newIncreasePaymentAmount = 7; // 新增增值服务金额
|
||||||
float newPaymentAmount = 8; // 新增支付金额
|
string newPaymentAmount = 8; // 新增支付金额
|
||||||
float newFinalPaymentAmount = 9; // 新增结算金额
|
string newFinalPaymentAmount = 9; // 新增结算金额
|
||||||
float newFeePaymentAmount = 10; // 新增手续费
|
string newFeePaymentAmount = 10; // 新增手续费
|
||||||
|
|
||||||
// ====== 套餐统计 ======
|
// ====== 套餐统计 ======
|
||||||
int64 newBundleCount = 11; // 新购买套餐数
|
int64 newBundleCount = 11; // 新购买套餐数
|
||||||
@ -1610,6 +1703,11 @@ message MetricsBusinessResp {
|
|||||||
int64 newUploadedDataAnalysisCount = 30; // 新增已上传的数据分析数
|
int64 newUploadedDataAnalysisCount = 30; // 新增已上传的数据分析数
|
||||||
int64 newPendingUploadDataAnalysisCount = 31; // 新增待上传的数据分析数
|
int64 newPendingUploadDataAnalysisCount = 31; // 新增待上传的数据分析数
|
||||||
int64 totalPendingUploadDataAnalysisCount = 32; // 总待上传的数据分析数
|
int64 totalPendingUploadDataAnalysisCount = 32; // 总待上传的数据分析数
|
||||||
|
|
||||||
|
// ====== 竞品数统计 ======
|
||||||
|
int64 newUploadedCompetitiveCount = 33; // 新增已上传的竞品数
|
||||||
|
int64 newPendingUploadCompetitiveCount = 34; // 新增待上传的竞品数
|
||||||
|
int64 totalPendingUploadCompetitiveCount = 35; // 总待上传的竞品数
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1654,6 +1752,16 @@ message MetricsOperatingCreateResp {
|
|||||||
int64 newUploadedIncreaseDataAnalysisCount = 26; // 新增已做增值数据数
|
int64 newUploadedIncreaseDataAnalysisCount = 26; // 新增已做增值数据数
|
||||||
int64 totalUploadedBundleDataAnalysisCount = 27; // 总已做套餐数据数截止
|
int64 totalUploadedBundleDataAnalysisCount = 27; // 总已做套餐数据数截止
|
||||||
int64 totalUploadedIncreaseDataAnalysisCount = 28; // 总已做增值数据数截止
|
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{
|
message MetricsOperatingStatusReq{
|
||||||
@ -1691,8 +1799,19 @@ message MetricsOperatingStatusResp {
|
|||||||
int64 autoConfirmDataAnalysisCount = 23;// 系统已自动确认数据数
|
int64 autoConfirmDataAnalysisCount = 23;// 系统已自动确认数据数
|
||||||
int64 pendingUploadDataAnalysisCount = 24;// 待发布数据数
|
int64 pendingUploadDataAnalysisCount = 24;// 待发布数据数
|
||||||
int64 uploadSuccessDataAnalysisCount = 25;// 发布成功数据数
|
int64 uploadSuccessDataAnalysisCount = 25;// 发布成功数据数
|
||||||
|
int64 uploadFailedDataAnalysisCount = 26;// 发布异常数据数
|
||||||
|
|
||||||
int64 abnormalAccountAcount = 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; // 触发预警的账号数
|
||||||
}
|
}
|
||||||
|
|
||||||
message MetricsBundlePurchaseExportReq{
|
message MetricsBundlePurchaseExportReq{
|
||||||
@ -1721,7 +1840,7 @@ message MetricsBundlePurchaseItem{
|
|||||||
}
|
}
|
||||||
|
|
||||||
message MetricsArtistAccountExportReq{
|
message MetricsArtistAccountExportReq{
|
||||||
string month = 1;
|
repeated string month = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message MetricsArtistAccountExportResp{
|
message MetricsArtistAccountExportResp{
|
||||||
@ -1734,20 +1853,24 @@ message MetricsArtistAccountExportItem{
|
|||||||
string dmAccount = 3;
|
string dmAccount = 3;
|
||||||
string dmNickname = 4;
|
string dmNickname = 4;
|
||||||
int32 dmAuthStatus = 5;
|
int32 dmAuthStatus = 5;
|
||||||
// string youtubeAccount = 3; 现在没有YouTube了
|
|
||||||
// string youtubeNickname = 4;
|
|
||||||
string instagramAccount = 6;
|
string instagramAccount = 6;
|
||||||
string instagramNickname = 7;
|
string instagramNickname = 7;
|
||||||
int32 insAuthStatus = 8;
|
int32 insAuthStatus = 8;
|
||||||
string tiktokAccount = 9;
|
string tiktokAccount = 9;
|
||||||
string tiktokNickname = 10;
|
string tiktokNickname = 10;
|
||||||
int32 tiktokAuthStatus = 11;
|
int32 tiktokAuthStatus = 11;
|
||||||
|
string youtubeAccount = 12;
|
||||||
|
string youtubeNickname = 13;
|
||||||
|
int32 youtubeAuthStatus = 14;
|
||||||
|
string blueskyAccount = 15;
|
||||||
|
string blueskyNickname = 16;
|
||||||
|
int32 blueskyAuthStatus = 17;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
message MetricsVideoSubmitExportReq{
|
message MetricsVideoSubmitExportReq{
|
||||||
string month = 1;
|
repeated string month = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message MetricsVideoSubmitExportResp{
|
message MetricsVideoSubmitExportResp{
|
||||||
@ -1767,3 +1890,25 @@ message MetricsVideoSubmitExportItem {
|
|||||||
message MetricsBalanceDetailExportReq{
|
message MetricsBalanceDetailExportReq{
|
||||||
string month = 1;
|
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;
|
||||||
|
}
|
||||||
10544
pb/bundle/bundle.pb.go
10544
pb/bundle/bundle.pb.go
File diff suppressed because it is too large
Load Diff
@ -17,6 +17,32 @@ var _ = proto.Marshal
|
|||||||
var _ = fmt.Errorf
|
var _ = fmt.Errorf
|
||||||
var _ = math.Inf
|
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 {
|
func (this *DeleteValueAddServiceRequest) Validate() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -714,6 +740,9 @@ func (this *SetPendingTaskLayoutReq) Validate() error {
|
|||||||
func (this *SetPendingTaskLayoutResp) Validate() error {
|
func (this *SetPendingTaskLayoutResp) Validate() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
func (this *CreateTaskWorkLogRequest) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
func (this *MetricsBusinessReq) Validate() error {
|
func (this *MetricsBusinessReq) Validate() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -783,3 +812,19 @@ func (this *MetricsVideoSubmitExportItem) Validate() error {
|
|||||||
func (this *MetricsBalanceDetailExportReq) Validate() error {
|
func (this *MetricsBalanceDetailExportReq) Validate() error {
|
||||||
return nil
|
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
|
||||||
|
}
|
||||||
|
|||||||
@ -50,6 +50,7 @@ type BundleClient interface {
|
|||||||
OrderRecordsListV2(ctx context.Context, in *OrderRecordsRequestV2, opts ...grpc_go.CallOption) (*OrderRecordsResponseV2, common.ErrorWithAttachment)
|
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)
|
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)
|
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)
|
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)
|
ValueAddBundleList(ctx context.Context, in *ValueAddBundleListRequest, opts ...grpc_go.CallOption) (*ValueAddBundleListResponse, common.ErrorWithAttachment)
|
||||||
@ -109,6 +110,7 @@ type BundleClient interface {
|
|||||||
GetPendingAssign(ctx context.Context, in *PendingAssignRequest, opts ...grpc_go.CallOption) (*PendingAssignResponse, common.ErrorWithAttachment)
|
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)
|
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)
|
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)
|
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)
|
MetricsOperatingCreate(ctx context.Context, in *MetricsOperatingCreateReq, opts ...grpc_go.CallOption) (*MetricsOperatingCreateResp, common.ErrorWithAttachment)
|
||||||
@ -116,6 +118,9 @@ type BundleClient interface {
|
|||||||
MetricsBundlePurchaseExport(ctx context.Context, in *MetricsBundlePurchaseExportReq, opts ...grpc_go.CallOption) (*MetricsBundlePurchaseExportResp, common.ErrorWithAttachment)
|
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)
|
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)
|
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 {
|
type bundleClient struct {
|
||||||
@ -145,6 +150,7 @@ type BundleClientImpl struct {
|
|||||||
OrderRecordsListV2 func(ctx context.Context, in *OrderRecordsRequestV2) (*OrderRecordsResponseV2, error)
|
OrderRecordsListV2 func(ctx context.Context, in *OrderRecordsRequestV2) (*OrderRecordsResponseV2, error)
|
||||||
OrderListByOrderNo func(ctx context.Context, in *OrderInfoByOrderNoRequest) (*OrderInfoByOrderNoResp, error)
|
OrderListByOrderNo func(ctx context.Context, in *OrderInfoByOrderNoRequest) (*OrderInfoByOrderNoResp, error)
|
||||||
OnlyAddValueListByOrderNo func(ctx context.Context, in *OnlyAddValueListByOrderNoRequest) (*OnlyAddValueListByOrderNoResp, 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)
|
CreateValueAddBundle func(ctx context.Context, in *CreateValueAddBundleRequest) (*CreateValueAddBundleResponse, error)
|
||||||
ValueAddBundleList func(ctx context.Context, in *ValueAddBundleListRequest) (*ValueAddBundleListResponse, error)
|
ValueAddBundleList func(ctx context.Context, in *ValueAddBundleListRequest) (*ValueAddBundleListResponse, error)
|
||||||
ValueAddBundleDetail func(ctx context.Context, in *ValueAddBundleDetailRequest) (*ValueAddBundleDetailResponse, error)
|
ValueAddBundleDetail func(ctx context.Context, in *ValueAddBundleDetailRequest) (*ValueAddBundleDetailResponse, error)
|
||||||
@ -197,12 +203,15 @@ type BundleClientImpl struct {
|
|||||||
GetPendingAssign func(ctx context.Context, in *PendingAssignRequest) (*PendingAssignResponse, error)
|
GetPendingAssign func(ctx context.Context, in *PendingAssignRequest) (*PendingAssignResponse, error)
|
||||||
RevertTaskCompletionByUUIDItem func(ctx context.Context, in *RevertTaskCompletionByUUIDItemRequest) (*ComResponse, error)
|
RevertTaskCompletionByUUIDItem func(ctx context.Context, in *RevertTaskCompletionByUUIDItemRequest) (*ComResponse, error)
|
||||||
AddHiddenTaskAssignee func(ctx context.Context, in *AddHiddenTaskAssigneeRequest) (*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)
|
MetricsBusiness func(ctx context.Context, in *MetricsBusinessReq) (*MetricsBusinessResp, error)
|
||||||
MetricsOperatingCreate func(ctx context.Context, in *MetricsOperatingCreateReq) (*MetricsOperatingCreateResp, error)
|
MetricsOperatingCreate func(ctx context.Context, in *MetricsOperatingCreateReq) (*MetricsOperatingCreateResp, error)
|
||||||
MetricsOperatingStatus func(ctx context.Context, in *MetricsOperatingStatusReq) (*MetricsOperatingStatusResp, error)
|
MetricsOperatingStatus func(ctx context.Context, in *MetricsOperatingStatusReq) (*MetricsOperatingStatusResp, error)
|
||||||
MetricsBundlePurchaseExport func(ctx context.Context, in *MetricsBundlePurchaseExportReq) (*MetricsBundlePurchaseExportResp, error)
|
MetricsBundlePurchaseExport func(ctx context.Context, in *MetricsBundlePurchaseExportReq) (*MetricsBundlePurchaseExportResp, error)
|
||||||
MetricsArtistAccountExport func(ctx context.Context, in *MetricsArtistAccountExportReq) (*MetricsArtistAccountExportResp, error)
|
MetricsArtistAccountExport func(ctx context.Context, in *MetricsArtistAccountExportReq) (*MetricsArtistAccountExportResp, error)
|
||||||
MetricsVideoSubmitExport func(ctx context.Context, in *MetricsVideoSubmitExportReq) (*MetricsVideoSubmitExportResp, 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 {
|
func (c *BundleClientImpl) GetDubboStub(cc *triple.TripleConn) BundleClient {
|
||||||
@ -349,6 +358,12 @@ func (c *bundleClient) OnlyAddValueListByOrderNo(ctx context.Context, in *OnlyAd
|
|||||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/OnlyAddValueListByOrderNo", in, out)
|
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) {
|
func (c *bundleClient) CreateValueAddBundle(ctx context.Context, in *CreateValueAddBundleRequest, opts ...grpc_go.CallOption) (*CreateValueAddBundleResponse, common.ErrorWithAttachment) {
|
||||||
out := new(CreateValueAddBundleResponse)
|
out := new(CreateValueAddBundleResponse)
|
||||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||||
@ -661,6 +676,12 @@ func (c *bundleClient) AddHiddenTaskAssignee(ctx context.Context, in *AddHiddenT
|
|||||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/AddHiddenTaskAssignee", in, out)
|
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) {
|
func (c *bundleClient) MetricsBusiness(ctx context.Context, in *MetricsBusinessReq, opts ...grpc_go.CallOption) (*MetricsBusinessResp, common.ErrorWithAttachment) {
|
||||||
out := new(MetricsBusinessResp)
|
out := new(MetricsBusinessResp)
|
||||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||||
@ -697,6 +718,18 @@ func (c *bundleClient) MetricsVideoSubmitExport(ctx context.Context, in *Metrics
|
|||||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/MetricsVideoSubmitExport", in, out)
|
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.
|
// BundleServer is the server API for Bundle service.
|
||||||
// All implementations must embed UnimplementedBundleServer
|
// All implementations must embed UnimplementedBundleServer
|
||||||
// for forward compatibility
|
// for forward compatibility
|
||||||
@ -723,6 +756,7 @@ type BundleServer interface {
|
|||||||
OrderRecordsListV2(context.Context, *OrderRecordsRequestV2) (*OrderRecordsResponseV2, error)
|
OrderRecordsListV2(context.Context, *OrderRecordsRequestV2) (*OrderRecordsResponseV2, error)
|
||||||
OrderListByOrderNo(context.Context, *OrderInfoByOrderNoRequest) (*OrderInfoByOrderNoResp, error)
|
OrderListByOrderNo(context.Context, *OrderInfoByOrderNoRequest) (*OrderInfoByOrderNoResp, error)
|
||||||
OnlyAddValueListByOrderNo(context.Context, *OnlyAddValueListByOrderNoRequest) (*OnlyAddValueListByOrderNoResp, error)
|
OnlyAddValueListByOrderNo(context.Context, *OnlyAddValueListByOrderNoRequest) (*OnlyAddValueListByOrderNoResp, error)
|
||||||
|
ReSignTheContract(context.Context, *ReSignTheContractRequest) (*CommonResponse, error)
|
||||||
// 增值套餐
|
// 增值套餐
|
||||||
CreateValueAddBundle(context.Context, *CreateValueAddBundleRequest) (*CreateValueAddBundleResponse, error)
|
CreateValueAddBundle(context.Context, *CreateValueAddBundleRequest) (*CreateValueAddBundleResponse, error)
|
||||||
ValueAddBundleList(context.Context, *ValueAddBundleListRequest) (*ValueAddBundleListResponse, error)
|
ValueAddBundleList(context.Context, *ValueAddBundleListRequest) (*ValueAddBundleListResponse, error)
|
||||||
@ -782,6 +816,7 @@ type BundleServer interface {
|
|||||||
GetPendingAssign(context.Context, *PendingAssignRequest) (*PendingAssignResponse, error)
|
GetPendingAssign(context.Context, *PendingAssignRequest) (*PendingAssignResponse, error)
|
||||||
RevertTaskCompletionByUUIDItem(context.Context, *RevertTaskCompletionByUUIDItemRequest) (*ComResponse, error)
|
RevertTaskCompletionByUUIDItem(context.Context, *RevertTaskCompletionByUUIDItemRequest) (*ComResponse, error)
|
||||||
AddHiddenTaskAssignee(context.Context, *AddHiddenTaskAssigneeRequest) (*ComResponse, error)
|
AddHiddenTaskAssignee(context.Context, *AddHiddenTaskAssigneeRequest) (*ComResponse, error)
|
||||||
|
CreateTaskWorkLog(context.Context, *CreateTaskWorkLogRequest) (*CommonResponse, error)
|
||||||
// 数据指标
|
// 数据指标
|
||||||
MetricsBusiness(context.Context, *MetricsBusinessReq) (*MetricsBusinessResp, error)
|
MetricsBusiness(context.Context, *MetricsBusinessReq) (*MetricsBusinessResp, error)
|
||||||
MetricsOperatingCreate(context.Context, *MetricsOperatingCreateReq) (*MetricsOperatingCreateResp, error)
|
MetricsOperatingCreate(context.Context, *MetricsOperatingCreateReq) (*MetricsOperatingCreateResp, error)
|
||||||
@ -789,6 +824,9 @@ type BundleServer interface {
|
|||||||
MetricsBundlePurchaseExport(context.Context, *MetricsBundlePurchaseExportReq) (*MetricsBundlePurchaseExportResp, error)
|
MetricsBundlePurchaseExport(context.Context, *MetricsBundlePurchaseExportReq) (*MetricsBundlePurchaseExportResp, error)
|
||||||
MetricsArtistAccountExport(context.Context, *MetricsArtistAccountExportReq) (*MetricsArtistAccountExportResp, error)
|
MetricsArtistAccountExport(context.Context, *MetricsArtistAccountExportReq) (*MetricsArtistAccountExportResp, error)
|
||||||
MetricsVideoSubmitExport(context.Context, *MetricsVideoSubmitExportReq) (*MetricsVideoSubmitExportResp, error)
|
MetricsVideoSubmitExport(context.Context, *MetricsVideoSubmitExportReq) (*MetricsVideoSubmitExportResp, error)
|
||||||
|
QueryTheOrderSnapshotInformation(context.Context, *QueryTheOrderSnapshotInformationReq) (*QueryTheOrderSnapshotInformationResp, error)
|
||||||
|
// 临时接口
|
||||||
|
ExportWorkCastInfo(context.Context, *ExportWorkCastInfoReq) (*ExportWorkCastInfoResp, error)
|
||||||
mustEmbedUnimplementedBundleServer()
|
mustEmbedUnimplementedBundleServer()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -863,6 +901,9 @@ func (UnimplementedBundleServer) OrderListByOrderNo(context.Context, *OrderInfoB
|
|||||||
func (UnimplementedBundleServer) OnlyAddValueListByOrderNo(context.Context, *OnlyAddValueListByOrderNoRequest) (*OnlyAddValueListByOrderNoResp, error) {
|
func (UnimplementedBundleServer) OnlyAddValueListByOrderNo(context.Context, *OnlyAddValueListByOrderNoRequest) (*OnlyAddValueListByOrderNoResp, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method OnlyAddValueListByOrderNo not implemented")
|
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) {
|
func (UnimplementedBundleServer) CreateValueAddBundle(context.Context, *CreateValueAddBundleRequest) (*CreateValueAddBundleResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method CreateValueAddBundle not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method CreateValueAddBundle not implemented")
|
||||||
}
|
}
|
||||||
@ -1019,6 +1060,9 @@ func (UnimplementedBundleServer) RevertTaskCompletionByUUIDItem(context.Context,
|
|||||||
func (UnimplementedBundleServer) AddHiddenTaskAssignee(context.Context, *AddHiddenTaskAssigneeRequest) (*ComResponse, error) {
|
func (UnimplementedBundleServer) AddHiddenTaskAssignee(context.Context, *AddHiddenTaskAssigneeRequest) (*ComResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method AddHiddenTaskAssignee not implemented")
|
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) {
|
func (UnimplementedBundleServer) MetricsBusiness(context.Context, *MetricsBusinessReq) (*MetricsBusinessResp, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method MetricsBusiness not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method MetricsBusiness not implemented")
|
||||||
}
|
}
|
||||||
@ -1037,6 +1081,12 @@ func (UnimplementedBundleServer) MetricsArtistAccountExport(context.Context, *Me
|
|||||||
func (UnimplementedBundleServer) MetricsVideoSubmitExport(context.Context, *MetricsVideoSubmitExportReq) (*MetricsVideoSubmitExportResp, error) {
|
func (UnimplementedBundleServer) MetricsVideoSubmitExport(context.Context, *MetricsVideoSubmitExportReq) (*MetricsVideoSubmitExportResp, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method MetricsVideoSubmitExport not implemented")
|
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) {
|
func (s *UnimplementedBundleServer) XXX_SetProxyImpl(impl protocol.Invoker) {
|
||||||
s.proxyImpl = impl
|
s.proxyImpl = impl
|
||||||
}
|
}
|
||||||
@ -1703,6 +1753,35 @@ func _Bundle_OnlyAddValueListByOrderNo_Handler(srv interface{}, ctx context.Cont
|
|||||||
return interceptor(ctx, in, info, handler)
|
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) {
|
func _Bundle_CreateValueAddBundle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||||
in := new(CreateValueAddBundleRequest)
|
in := new(CreateValueAddBundleRequest)
|
||||||
if err := dec(in); err != nil {
|
if err := dec(in); err != nil {
|
||||||
@ -3211,6 +3290,35 @@ func _Bundle_AddHiddenTaskAssignee_Handler(srv interface{}, ctx context.Context,
|
|||||||
return interceptor(ctx, in, info, handler)
|
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) {
|
func _Bundle_MetricsBusiness_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||||
in := new(MetricsBusinessReq)
|
in := new(MetricsBusinessReq)
|
||||||
if err := dec(in); err != nil {
|
if err := dec(in); err != nil {
|
||||||
@ -3385,6 +3493,64 @@ func _Bundle_MetricsVideoSubmitExport_Handler(srv interface{}, ctx context.Conte
|
|||||||
return interceptor(ctx, in, info, handler)
|
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.
|
// Bundle_ServiceDesc is the grpc_go.ServiceDesc for Bundle service.
|
||||||
// It's only intended for direct use with grpc_go.RegisterService,
|
// It's only intended for direct use with grpc_go.RegisterService,
|
||||||
// and not to be introspected or modified (even as a copy)
|
// and not to be introspected or modified (even as a copy)
|
||||||
@ -3480,6 +3646,10 @@ var Bundle_ServiceDesc = grpc_go.ServiceDesc{
|
|||||||
MethodName: "OnlyAddValueListByOrderNo",
|
MethodName: "OnlyAddValueListByOrderNo",
|
||||||
Handler: _Bundle_OnlyAddValueListByOrderNo_Handler,
|
Handler: _Bundle_OnlyAddValueListByOrderNo_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "ReSignTheContract",
|
||||||
|
Handler: _Bundle_ReSignTheContract_Handler,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
MethodName: "CreateValueAddBundle",
|
MethodName: "CreateValueAddBundle",
|
||||||
Handler: _Bundle_CreateValueAddBundle_Handler,
|
Handler: _Bundle_CreateValueAddBundle_Handler,
|
||||||
@ -3688,6 +3858,10 @@ var Bundle_ServiceDesc = grpc_go.ServiceDesc{
|
|||||||
MethodName: "AddHiddenTaskAssignee",
|
MethodName: "AddHiddenTaskAssignee",
|
||||||
Handler: _Bundle_AddHiddenTaskAssignee_Handler,
|
Handler: _Bundle_AddHiddenTaskAssignee_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "CreateTaskWorkLog",
|
||||||
|
Handler: _Bundle_CreateTaskWorkLog_Handler,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
MethodName: "MetricsBusiness",
|
MethodName: "MetricsBusiness",
|
||||||
Handler: _Bundle_MetricsBusiness_Handler,
|
Handler: _Bundle_MetricsBusiness_Handler,
|
||||||
@ -3712,6 +3886,14 @@ var Bundle_ServiceDesc = grpc_go.ServiceDesc{
|
|||||||
MethodName: "MetricsVideoSubmitExport",
|
MethodName: "MetricsVideoSubmitExport",
|
||||||
Handler: _Bundle_MetricsVideoSubmitExport_Handler,
|
Handler: _Bundle_MetricsVideoSubmitExport_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "QueryTheOrderSnapshotInformation",
|
||||||
|
Handler: _Bundle_QueryTheOrderSnapshotInformation_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "ExportWorkCastInfo",
|
||||||
|
Handler: _Bundle_ExportWorkCastInfo_Handler,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Streams: []grpc_go.StreamDesc{},
|
Streams: []grpc_go.StreamDesc{},
|
||||||
Metadata: "pb/bundle.proto",
|
Metadata: "pb/bundle.proto",
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
package cron
|
package cron
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"log"
|
"log"
|
||||||
"micro-bundle/internal/logic"
|
"micro-bundle/internal/logic"
|
||||||
|
|
||||||
@ -21,17 +20,6 @@ func InitCronJob() {
|
|||||||
panic(err)
|
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()
|
c.Start()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -47,7 +47,7 @@ func loadMysqlConn(conn string) *gorm.DB {
|
|||||||
// Bundle数据库的自动迁移
|
// Bundle数据库的自动迁移
|
||||||
err = db.AutoMigrate(
|
err = db.AutoMigrate(
|
||||||
&model.BundleProfile{},
|
&model.BundleProfile{},
|
||||||
// &model.BundleOrderRecords{},
|
//&model.BundleOrderRecords{},
|
||||||
&model.ValueAddBundleProfile{},
|
&model.ValueAddBundleProfile{},
|
||||||
//&model.ValueAddBundleRecord{}
|
//&model.ValueAddBundleRecord{}
|
||||||
&model.BundleProfileLang{},
|
&model.BundleProfileLang{},
|
||||||
@ -63,7 +63,16 @@ func loadMysqlConn(conn string) *gorm.DB {
|
|||||||
&model.BundleActivate{},
|
&model.BundleActivate{},
|
||||||
&model.BundleBalanceLayout{},
|
&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 {
|
if err != nil {
|
||||||
// return nil
|
// return nil
|
||||||
panic(err)
|
panic(err)
|
||||||
@ -106,12 +115,12 @@ func loadTaskBenchMysqlConn(conn string) *gorm.DB {
|
|||||||
&model.TaskManagement{},
|
&model.TaskManagement{},
|
||||||
&model.TaskAssignRecords{},
|
&model.TaskAssignRecords{},
|
||||||
// &model.TaskBalance{},
|
// &model.TaskBalance{},
|
||||||
&model.TaskLog{},
|
|
||||||
&model.TaskSyncStatus{},
|
&model.TaskSyncStatus{},
|
||||||
&model.TaskPendingLayout{},
|
&model.TaskPendingLayout{},
|
||||||
&model.TaskAssignUUIDItems{},
|
&model.TaskAssignUUIDItems{},
|
||||||
// 隐藏人员人记录表
|
// 隐藏人员人记录表
|
||||||
&model.TaskAssigneeHidden{},
|
&model.TaskAssigneeHidden{},
|
||||||
|
&model.TaskWorkLog{},
|
||||||
)
|
)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@ -120,3 +120,9 @@ const (
|
|||||||
AccountService = 4 //账号数
|
AccountService = 4 //账号数
|
||||||
AvailableTimeService = 5 //可用时长
|
AvailableTimeService = 5 //可用时长
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// 套餐状态
|
||||||
|
const (
|
||||||
|
IsExpired = 1 //已过期
|
||||||
|
NotExpired = 0 //未过期
|
||||||
|
)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user