bugfix: 把手动扩展任务数量也计算如到增值任务余额。修改扣减任务数量的顺序
This commit is contained in:
parent
952e6e930c
commit
441f2e4fc0
@ -232,17 +232,20 @@ func calculateIncreaseBalances(tb *model.TaskBalance) (video int, image int, dat
|
|||||||
// 视频增值余额
|
// 视频增值余额
|
||||||
video = (tb.TaskIncreaseVideoNumber - tb.TaskIncreaseVideoConsumptionNumber) +
|
video = (tb.TaskIncreaseVideoNumber - tb.TaskIncreaseVideoConsumptionNumber) +
|
||||||
(tb.TaskIncreaseLimitVideoNumber - tb.TaskIncreaseLimitVideoConsumptionNumber) +
|
(tb.TaskIncreaseLimitVideoNumber - tb.TaskIncreaseLimitVideoConsumptionNumber) +
|
||||||
(tb.TaskIncreaseLimitVideoExpiredNumber - tb.TaskIncreaseLimitVideoExpiredConsumptionNumber)
|
(tb.TaskIncreaseLimitVideoExpiredNumber - tb.TaskIncreaseLimitVideoExpiredConsumptionNumber) +
|
||||||
|
(tb.TaskManualVideoNumber - tb.TaskManualVideoConsumptionNumber)
|
||||||
|
|
||||||
// 图文增值余额
|
// 图文增值余额
|
||||||
image = (tb.TaskIncreaseImageNumber - tb.TaskIncreaseImageConsumptionNumber) +
|
image = (tb.TaskIncreaseImageNumber - tb.TaskIncreaseImageConsumptionNumber) +
|
||||||
(tb.TaskIncreaseLimitImageNumber - tb.TaskIncreaseLimitImageConsumptionNumber) +
|
(tb.TaskIncreaseLimitImageNumber - tb.TaskIncreaseLimitImageConsumptionNumber) +
|
||||||
(tb.TaskIncreaseLimitImageExpiredNumber - tb.TaskIncreaseLimitImageExpiredConsumptionNumber)
|
(tb.TaskIncreaseLimitImageExpiredNumber - tb.TaskIncreaseLimitImageExpiredConsumptionNumber) +
|
||||||
|
(tb.TaskManualImageNumber - tb.TaskManualImageConsumptionNumber)
|
||||||
|
|
||||||
// 数据分析增值余额
|
// 数据分析增值余额
|
||||||
data = (tb.TaskIncreaseDataAnalysisNumber - tb.TaskIncreaseDataAnalysisConsumptionNumber) +
|
data = (tb.TaskIncreaseDataAnalysisNumber - tb.TaskIncreaseDataAnalysisConsumptionNumber) +
|
||||||
(tb.TaskIncreaseLimitDataAnalysisNumber - tb.TaskIncreaseLimitDataAnalysisConsumptionNumber) +
|
(tb.TaskIncreaseLimitDataAnalysisNumber - tb.TaskIncreaseLimitDataAnalysisConsumptionNumber) +
|
||||||
(tb.TaskIncreaseLimitDataAnalysisExpiredNumber - tb.TaskIncreaseLimitDataAnalysisExpiredConsumptionNumber)
|
(tb.TaskIncreaseLimitDataAnalysisExpiredNumber - tb.TaskIncreaseLimitDataAnalysisExpiredConsumptionNumber) +
|
||||||
|
(tb.TaskManualDataAnalysisNumber - tb.TaskManualDataAnalysisConsumptionNumber)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -743,6 +746,16 @@ func UpdatePendingCount(req *UpdatePendingCountRequest) error {
|
|||||||
need -= alloc
|
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 {
|
if need > 0 {
|
||||||
totalRemain := tb.TaskIncreaseLimitVideoNumber - tb.TaskIncreaseLimitVideoConsumptionNumber
|
totalRemain := tb.TaskIncreaseLimitVideoNumber - tb.TaskIncreaseLimitVideoConsumptionNumber
|
||||||
@ -754,16 +767,7 @@ func UpdatePendingCount(req *UpdatePendingCountRequest) error {
|
|||||||
need -= alloc
|
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 {
|
if need > 0 {
|
||||||
totalRemain := tb.TaskIncreaseVideoNumber - tb.TaskIncreaseVideoConsumptionNumber
|
totalRemain := tb.TaskIncreaseVideoNumber - tb.TaskIncreaseVideoConsumptionNumber
|
||||||
@ -826,6 +830,16 @@ func UpdatePendingCount(req *UpdatePendingCountRequest) error {
|
|||||||
need -= alloc
|
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 {
|
if need > 0 {
|
||||||
totalRemain := tb.TaskIncreaseLimitImageNumber - tb.TaskIncreaseLimitImageConsumptionNumber
|
totalRemain := tb.TaskIncreaseLimitImageNumber - tb.TaskIncreaseLimitImageConsumptionNumber
|
||||||
@ -837,16 +851,6 @@ func UpdatePendingCount(req *UpdatePendingCountRequest) error {
|
|||||||
need -= alloc
|
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 {
|
if need > 0 {
|
||||||
totalRemain := tb.TaskIncreaseImageNumber - tb.TaskIncreaseImageConsumptionNumber
|
totalRemain := tb.TaskIncreaseImageNumber - tb.TaskIncreaseImageConsumptionNumber
|
||||||
@ -909,6 +913,16 @@ func UpdatePendingCount(req *UpdatePendingCountRequest) error {
|
|||||||
need -= alloc
|
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 {
|
if need > 0 {
|
||||||
totalRemain := tb.TaskIncreaseLimitDataAnalysisNumber - tb.TaskIncreaseLimitDataAnalysisConsumptionNumber
|
totalRemain := tb.TaskIncreaseLimitDataAnalysisNumber - tb.TaskIncreaseLimitDataAnalysisConsumptionNumber
|
||||||
@ -920,16 +934,6 @@ func UpdatePendingCount(req *UpdatePendingCountRequest) error {
|
|||||||
need -= alloc
|
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 {
|
if need > 0 {
|
||||||
totalRemain := tb.TaskIncreaseDataAnalysisNumber - tb.TaskIncreaseDataAnalysisConsumptionNumber
|
totalRemain := tb.TaskIncreaseDataAnalysisNumber - tb.TaskIncreaseDataAnalysisConsumptionNumber
|
||||||
@ -1107,7 +1111,7 @@ func GetValidArtistList() ([]ValidArtistInfo, error) {
|
|||||||
bor.status, bor.uuid as order_uuid,
|
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_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_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_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_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,
|
(bb.bundle_image_consumption_number + bb.increase_image_consumption_number + bb.manual_image_consumption_number) as image_consumption_number,
|
||||||
|
@ -377,7 +377,8 @@ func calculatePendingFromTaskBalance(subNum string) (videoTotal, imageTotal, dat
|
|||||||
(taskBalance.TaskBundleLimitVideoNumber - taskBalance.TaskBundleLimitVideoConsumptionNumber) +
|
(taskBalance.TaskBundleLimitVideoNumber - taskBalance.TaskBundleLimitVideoConsumptionNumber) +
|
||||||
(taskBalance.TaskIncreaseLimitVideoNumber - taskBalance.TaskIncreaseLimitVideoConsumptionNumber) +
|
(taskBalance.TaskIncreaseLimitVideoNumber - taskBalance.TaskIncreaseLimitVideoConsumptionNumber) +
|
||||||
(taskBalance.TaskBundleLimitVideoExpiredNumber - taskBalance.TaskBundleLimitVideoExpiredConsumptionNumber) +
|
(taskBalance.TaskBundleLimitVideoExpiredNumber - taskBalance.TaskBundleLimitVideoExpiredConsumptionNumber) +
|
||||||
(taskBalance.TaskIncreaseLimitVideoExpiredNumber - taskBalance.TaskIncreaseLimitVideoExpiredConsumptionNumber)
|
(taskBalance.TaskIncreaseLimitVideoExpiredNumber - taskBalance.TaskIncreaseLimitVideoExpiredConsumptionNumber) +
|
||||||
|
(taskBalance.TaskManualVideoNumber - taskBalance.TaskManualVideoConsumptionNumber)
|
||||||
if videoTotal < 0 {
|
if videoTotal < 0 {
|
||||||
videoTotal = 0
|
videoTotal = 0
|
||||||
}
|
}
|
||||||
@ -388,7 +389,8 @@ func calculatePendingFromTaskBalance(subNum string) (videoTotal, imageTotal, dat
|
|||||||
(taskBalance.TaskBundleLimitImageNumber - taskBalance.TaskBundleLimitImageConsumptionNumber) +
|
(taskBalance.TaskBundleLimitImageNumber - taskBalance.TaskBundleLimitImageConsumptionNumber) +
|
||||||
(taskBalance.TaskIncreaseLimitImageNumber - taskBalance.TaskIncreaseLimitImageConsumptionNumber) +
|
(taskBalance.TaskIncreaseLimitImageNumber - taskBalance.TaskIncreaseLimitImageConsumptionNumber) +
|
||||||
(taskBalance.TaskBundleLimitImageExpiredNumber - taskBalance.TaskBundleLimitImageExpiredConsumptionNumber) +
|
(taskBalance.TaskBundleLimitImageExpiredNumber - taskBalance.TaskBundleLimitImageExpiredConsumptionNumber) +
|
||||||
(taskBalance.TaskIncreaseLimitImageExpiredNumber - taskBalance.TaskIncreaseLimitImageExpiredConsumptionNumber)
|
(taskBalance.TaskIncreaseLimitImageExpiredNumber - taskBalance.TaskIncreaseLimitImageExpiredConsumptionNumber) +
|
||||||
|
(taskBalance.TaskManualImageNumber - taskBalance.TaskManualImageConsumptionNumber)
|
||||||
if imageTotal < 0 {
|
if imageTotal < 0 {
|
||||||
imageTotal = 0
|
imageTotal = 0
|
||||||
}
|
}
|
||||||
@ -399,7 +401,8 @@ func calculatePendingFromTaskBalance(subNum string) (videoTotal, imageTotal, dat
|
|||||||
(taskBalance.TaskBundleLimitDataAnalysisNumber - taskBalance.TaskBundleLimitDataAnalysisConsumptionNumber) +
|
(taskBalance.TaskBundleLimitDataAnalysisNumber - taskBalance.TaskBundleLimitDataAnalysisConsumptionNumber) +
|
||||||
(taskBalance.TaskIncreaseLimitDataAnalysisNumber - taskBalance.TaskIncreaseLimitDataAnalysisConsumptionNumber) +
|
(taskBalance.TaskIncreaseLimitDataAnalysisNumber - taskBalance.TaskIncreaseLimitDataAnalysisConsumptionNumber) +
|
||||||
(taskBalance.TaskBundleLimitDataAnalysisExpiredNumber - taskBalance.TaskBundleLimitDataAnalysisExpiredConsumptionNumber) +
|
(taskBalance.TaskBundleLimitDataAnalysisExpiredNumber - taskBalance.TaskBundleLimitDataAnalysisExpiredConsumptionNumber) +
|
||||||
(taskBalance.TaskIncreaseLimitDataAnalysisExpiredNumber - taskBalance.TaskIncreaseLimitDataAnalysisExpiredConsumptionNumber)
|
(taskBalance.TaskIncreaseLimitDataAnalysisExpiredNumber - taskBalance.TaskIncreaseLimitDataAnalysisExpiredConsumptionNumber) +
|
||||||
|
(taskBalance.TaskManualDataAnalysisNumber - taskBalance.TaskManualDataAnalysisConsumptionNumber)
|
||||||
if dataTotal < 0 {
|
if dataTotal < 0 {
|
||||||
dataTotal = 0
|
dataTotal = 0
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user