修复日志bug

This commit is contained in:
jau1 2024-01-22 18:39:30 +08:00
parent 305871ec5b
commit 30776b55f0

View File

@ -88,8 +88,8 @@ func Redeem(key string, userId int) (quota int, err error) {
return 0, errors.New("兑换失败," + err.Error())
}
RecordLog(userId, LogTypeTopup, fmt.Sprintf("通过兑换码充值 %s", common.LogQuota(redemption.Quota)))
if user.InviterId != 0 {
RecordLog(user.InviterId, LogTypeSale, fmt.Sprintf("通过分销赠送 %s", extendQuota))
if user.InviterId != 0 && extendQuota > 0 {
RecordLog(user.InviterId, LogTypeSale, fmt.Sprintf("通过分销赠送 %s", common.LogQuota(int(float64(redemption.Quota)*common.GetSaleRatio(user.Group)))))
}
return redemption.Quota, nil
}