diff --git a/internal/dao/taskDao.go b/internal/dao/taskDao.go index ce935c0..bdfdac9 100644 --- a/internal/dao/taskDao.go +++ b/internal/dao/taskDao.go @@ -232,17 +232,20 @@ func calculateIncreaseBalances(tb *model.TaskBalance) (video int, image int, dat // 视频增值余额 video = (tb.TaskIncreaseVideoNumber - tb.TaskIncreaseVideoConsumptionNumber) + (tb.TaskIncreaseLimitVideoNumber - tb.TaskIncreaseLimitVideoConsumptionNumber) + - (tb.TaskIncreaseLimitVideoExpiredNumber - tb.TaskIncreaseLimitVideoExpiredConsumptionNumber) + (tb.TaskIncreaseLimitVideoExpiredNumber - tb.TaskIncreaseLimitVideoExpiredConsumptionNumber) + + (tb.TaskManualVideoNumber - tb.TaskManualVideoConsumptionNumber) // 图文增值余额 image = (tb.TaskIncreaseImageNumber - tb.TaskIncreaseImageConsumptionNumber) + (tb.TaskIncreaseLimitImageNumber - tb.TaskIncreaseLimitImageConsumptionNumber) + - (tb.TaskIncreaseLimitImageExpiredNumber - tb.TaskIncreaseLimitImageExpiredConsumptionNumber) + (tb.TaskIncreaseLimitImageExpiredNumber - tb.TaskIncreaseLimitImageExpiredConsumptionNumber) + + (tb.TaskManualImageNumber - tb.TaskManualImageConsumptionNumber) // 数据分析增值余额 data = (tb.TaskIncreaseDataAnalysisNumber - tb.TaskIncreaseDataAnalysisConsumptionNumber) + (tb.TaskIncreaseLimitDataAnalysisNumber - tb.TaskIncreaseLimitDataAnalysisConsumptionNumber) + - (tb.TaskIncreaseLimitDataAnalysisExpiredNumber - tb.TaskIncreaseLimitDataAnalysisExpiredConsumptionNumber) + (tb.TaskIncreaseLimitDataAnalysisExpiredNumber - tb.TaskIncreaseLimitDataAnalysisExpiredConsumptionNumber) + + (tb.TaskManualDataAnalysisNumber - tb.TaskManualDataAnalysisConsumptionNumber) return } @@ -743,6 +746,16 @@ func UpdatePendingCount(req *UpdatePendingCountRequest) error { need -= alloc } } + // 非限制 - 套餐 + if need > 0 { + totalRemain := tb.TaskBundleVideoNumber - tb.TaskBundleVideoConsumptionNumber + alloc := minInt(need, totalRemain) + if alloc > 0 { + tb.TaskBundleVideoConsumptionNumber += alloc + tb.TaskMonthlyBundleVideoConsumptionNumber += alloc + need -= alloc + } + } // 限制不过期 - 增值(忽略当月限额,只看总余额) if need > 0 { totalRemain := tb.TaskIncreaseLimitVideoNumber - tb.TaskIncreaseLimitVideoConsumptionNumber @@ -754,16 +767,7 @@ func UpdatePendingCount(req *UpdatePendingCountRequest) error { need -= alloc } } - // 非限制 - 套餐 - if need > 0 { - totalRemain := tb.TaskBundleVideoNumber - tb.TaskBundleVideoConsumptionNumber - alloc := minInt(need, totalRemain) - if alloc > 0 { - tb.TaskBundleVideoConsumptionNumber += alloc - tb.TaskMonthlyBundleVideoConsumptionNumber += alloc - need -= alloc - } - } + // 非限制 - 增值 if need > 0 { totalRemain := tb.TaskIncreaseVideoNumber - tb.TaskIncreaseVideoConsumptionNumber @@ -826,6 +830,16 @@ func UpdatePendingCount(req *UpdatePendingCountRequest) error { need -= alloc } } + // 非限制 - 套餐 + if need > 0 { + totalRemain := tb.TaskBundleImageNumber - tb.TaskBundleImageConsumptionNumber + alloc := minInt(need, totalRemain) + if alloc > 0 { + tb.TaskBundleImageConsumptionNumber += alloc + tb.TaskMonthlyBundleImageConsumptionNumber += alloc + need -= alloc + } + } // 限制不过期 - 增值(忽略当月限额,只看总余额) if need > 0 { totalRemain := tb.TaskIncreaseLimitImageNumber - tb.TaskIncreaseLimitImageConsumptionNumber @@ -837,16 +851,6 @@ func UpdatePendingCount(req *UpdatePendingCountRequest) error { need -= alloc } } - // 非限制 - 套餐 - if need > 0 { - totalRemain := tb.TaskBundleImageNumber - tb.TaskBundleImageConsumptionNumber - alloc := minInt(need, totalRemain) - if alloc > 0 { - tb.TaskBundleImageConsumptionNumber += alloc - tb.TaskMonthlyBundleImageConsumptionNumber += alloc - need -= alloc - } - } // 非限制 - 增值 if need > 0 { totalRemain := tb.TaskIncreaseImageNumber - tb.TaskIncreaseImageConsumptionNumber @@ -909,6 +913,16 @@ func UpdatePendingCount(req *UpdatePendingCountRequest) error { need -= alloc } } + // 非限制 - 套餐 + if need > 0 { + totalRemain := tb.TaskBundleDataAnalysisNumber - tb.TaskBundleDataAnalysisConsumptionNumber + alloc := minInt(need, totalRemain) + if alloc > 0 { + tb.TaskBundleDataAnalysisConsumptionNumber += alloc + tb.TaskMonthlyBundleDataAnalysisConsumptionNumber += alloc + need -= alloc + } + } // 限制不过期 - 增值(忽略当月限额,只看总余额) if need > 0 { totalRemain := tb.TaskIncreaseLimitDataAnalysisNumber - tb.TaskIncreaseLimitDataAnalysisConsumptionNumber @@ -920,16 +934,6 @@ func UpdatePendingCount(req *UpdatePendingCountRequest) error { need -= alloc } } - // 非限制 - 套餐 - if need > 0 { - totalRemain := tb.TaskBundleDataAnalysisNumber - tb.TaskBundleDataAnalysisConsumptionNumber - alloc := minInt(need, totalRemain) - if alloc > 0 { - tb.TaskBundleDataAnalysisConsumptionNumber += alloc - tb.TaskMonthlyBundleDataAnalysisConsumptionNumber += alloc - need -= alloc - } - } // 非限制 - 增值 if need > 0 { totalRemain := tb.TaskIncreaseDataAnalysisNumber - tb.TaskIncreaseDataAnalysisConsumptionNumber @@ -1107,7 +1111,7 @@ func GetValidArtistList() ([]ValidArtistInfo, error) { bor.status, bor.uuid as order_uuid, (bb.bundle_account_number + bb.increase_account_number + bb.manual_account_number) as account_number, (bb.bundle_account_consumption_number + bb.increase_account_consumption_number + bb.manual_account_consumption_number) as account_consumption_number, - (bb.bundle_video_number + bb.increase_video_number) as video_number, + (bb.bundle_video_number + bb.increase_video_number + bb.manual_video_number) as video_number, (bb.bundle_video_consumption_number + bb.increase_video_consumption_number) as video_consumption_number, (bb.bundle_image_number + bb.increase_image_number + bb.manual_image_number) as image_number, (bb.bundle_image_consumption_number + bb.increase_image_consumption_number + bb.manual_image_consumption_number) as image_consumption_number, diff --git a/internal/logic/taskLogic.go b/internal/logic/taskLogic.go index 89e1d4d..cb96913 100644 --- a/internal/logic/taskLogic.go +++ b/internal/logic/taskLogic.go @@ -377,7 +377,8 @@ func calculatePendingFromTaskBalance(subNum string) (videoTotal, imageTotal, dat (taskBalance.TaskBundleLimitVideoNumber - taskBalance.TaskBundleLimitVideoConsumptionNumber) + (taskBalance.TaskIncreaseLimitVideoNumber - taskBalance.TaskIncreaseLimitVideoConsumptionNumber) + (taskBalance.TaskBundleLimitVideoExpiredNumber - taskBalance.TaskBundleLimitVideoExpiredConsumptionNumber) + - (taskBalance.TaskIncreaseLimitVideoExpiredNumber - taskBalance.TaskIncreaseLimitVideoExpiredConsumptionNumber) + (taskBalance.TaskIncreaseLimitVideoExpiredNumber - taskBalance.TaskIncreaseLimitVideoExpiredConsumptionNumber) + + (taskBalance.TaskManualVideoNumber - taskBalance.TaskManualVideoConsumptionNumber) if videoTotal < 0 { videoTotal = 0 } @@ -388,7 +389,8 @@ func calculatePendingFromTaskBalance(subNum string) (videoTotal, imageTotal, dat (taskBalance.TaskBundleLimitImageNumber - taskBalance.TaskBundleLimitImageConsumptionNumber) + (taskBalance.TaskIncreaseLimitImageNumber - taskBalance.TaskIncreaseLimitImageConsumptionNumber) + (taskBalance.TaskBundleLimitImageExpiredNumber - taskBalance.TaskBundleLimitImageExpiredConsumptionNumber) + - (taskBalance.TaskIncreaseLimitImageExpiredNumber - taskBalance.TaskIncreaseLimitImageExpiredConsumptionNumber) + (taskBalance.TaskIncreaseLimitImageExpiredNumber - taskBalance.TaskIncreaseLimitImageExpiredConsumptionNumber) + + (taskBalance.TaskManualImageNumber - taskBalance.TaskManualImageConsumptionNumber) if imageTotal < 0 { imageTotal = 0 } @@ -399,7 +401,8 @@ func calculatePendingFromTaskBalance(subNum string) (videoTotal, imageTotal, dat (taskBalance.TaskBundleLimitDataAnalysisNumber - taskBalance.TaskBundleLimitDataAnalysisConsumptionNumber) + (taskBalance.TaskIncreaseLimitDataAnalysisNumber - taskBalance.TaskIncreaseLimitDataAnalysisConsumptionNumber) + (taskBalance.TaskBundleLimitDataAnalysisExpiredNumber - taskBalance.TaskBundleLimitDataAnalysisExpiredConsumptionNumber) + - (taskBalance.TaskIncreaseLimitDataAnalysisExpiredNumber - taskBalance.TaskIncreaseLimitDataAnalysisExpiredConsumptionNumber) + (taskBalance.TaskIncreaseLimitDataAnalysisExpiredNumber - taskBalance.TaskIncreaseLimitDataAnalysisExpiredConsumptionNumber) + + (taskBalance.TaskManualDataAnalysisNumber - taskBalance.TaskManualDataAnalysisConsumptionNumber) if dataTotal < 0 { dataTotal = 0 }