From 441f2e4fc05205d39195ef21327b02d48538479c Mon Sep 17 00:00:00 2001 From: cjy Date: Wed, 22 Oct 2025 19:40:09 +0800 Subject: [PATCH] =?UTF-8?q?bugfix:=20=E6=8A=8A=E6=89=8B=E5=8A=A8=E6=89=A9?= =?UTF-8?q?=E5=B1=95=E4=BB=BB=E5=8A=A1=E6=95=B0=E9=87=8F=E4=B9=9F=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E5=A6=82=E5=88=B0=E5=A2=9E=E5=80=BC=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E4=BD=99=E9=A2=9D=E3=80=82=E4=BF=AE=E6=94=B9=E6=89=A3=E5=87=8F?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=95=B0=E9=87=8F=E7=9A=84=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/dao/taskDao.go | 72 +++++++++++++++++++------------------ internal/logic/taskLogic.go | 9 +++-- 2 files changed, 44 insertions(+), 37 deletions(-) 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 }