修复:goctl api 生成的代码没有在路由中加入Ipa模式
Build docker and publish / build (20.15.1) (push) Successful in 7m48s
Build docker and publish / build (20.15.1) (push) Successful in 7m48s
This commit is contained in:
@@ -37,14 +37,14 @@ func (l *GetUserInviteStatsLogic) GetUserInviteStats(req *types.GetUserInviteSta
|
||||
}
|
||||
userId := u.Id
|
||||
|
||||
// 2. 获取历史邀请佣金 (FriendlyCount): 所有被邀请用户产生订单的佣金总和
|
||||
// 注意:这里复用了 friendly_count 字段名,实际含义是佣金总额
|
||||
// 2. 获取历史邀请佣金总额 (FriendlyCount): 从佣金日志中统计邀请人收到的佣金
|
||||
// type=33(佣金日志),object_id=userId,content JSON 中 type 为 331(购买) 或 332(续费) 时才是真实收入
|
||||
var totalCommission sql.NullInt64
|
||||
err = l.svcCtx.DB.WithContext(l.ctx).
|
||||
Table("`order` o").
|
||||
Select("COALESCE(SUM(o.commission), 0) as total").
|
||||
Joins("JOIN user u ON o.user_id = u.id").
|
||||
Where("u.referer_id = ? AND o.status IN (?, ?)", userId, 2, 5). // 只统计已支付和已完成的订单
|
||||
Table("system_logs").
|
||||
Select("COALESCE(SUM(JSON_EXTRACT(content, '$.amount')), 0) as total").
|
||||
Where("type = ? AND object_id = ? AND JSON_EXTRACT(content, '$.type') IN (?, ?)",
|
||||
33, userId, 331, 332).
|
||||
Scan(&totalCommission).Error
|
||||
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user