fix: CountScopedSubscribePurchaseOrders 包含续费单并排除赠送单
Some checks failed
Build docker and publish / build (20.15.1) (push) Has been cancelled
Some checks failed
Build docker and publish / build (20.15.1) (push) Has been cancelled
- type IN (1, 2):同时统计首购和续费历史,防止用户用续费绕过新人价限制 - amount > 0:排除 admin 赠送的免费订单(amount=0),避免误判新人资格 Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
parent
5733ebe40d
commit
40cfe46ba8
@ -76,7 +76,7 @@ func CountScopedSubscribePurchaseOrders(
|
||||
var count int64
|
||||
query := db.WithContext(ctx).
|
||||
Model(&modelOrder.Order{}).
|
||||
Where("user_id IN ? AND subscribe_id = ? AND type = 1", scopeUserIDs, subscribeID)
|
||||
Where("user_id IN ? AND subscribe_id = ? AND type IN ? AND amount > 0", scopeUserIDs, subscribeID, []int64{1, 2})
|
||||
if len(statuses) > 0 {
|
||||
query = query.Where("status IN ?", statuses)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user