feat: 效果图限额支持 VIP 不限与广告加次
This commit is contained in:
@@ -33,13 +33,16 @@ func (s *effectImageService) run(ctx context.Context, planId, userId int64) {
|
||||
g.Log().Errorf(ctx, "效果图任务: 方案不存在 planId=%d", planId)
|
||||
return
|
||||
}
|
||||
// 每日免费次数校验
|
||||
limit := dailyEffectLimit(ctx)
|
||||
if limit > 0 {
|
||||
used, _ := dao.PlanEffectImage.CountByUserToday(ctx, userId)
|
||||
if used >= limit {
|
||||
g.Log().Warningf(ctx, "效果图任务: 用户 %d 当日次数已用尽(%d/%d)", userId, used, limit)
|
||||
return
|
||||
// 每日限额:VIP 不限;普通用户 = 基础额度 + 广告激励额外次数
|
||||
if !dao.UserMember.IsVip(ctx, userId) {
|
||||
limit := dailyEffectLimit(ctx)
|
||||
if limit > 0 {
|
||||
used, _ := dao.PlanEffectImage.CountByUserToday(ctx, userId)
|
||||
extra, _ := dao.AdRewardLog.CountTodayByType(ctx, userId, consts.AdTypeEffectExtra)
|
||||
if used >= limit+extra {
|
||||
g.Log().Warningf(ctx, "效果图任务: 用户 %d 当日次数已用尽(%d/%d)", userId, used, limit+extra)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user