🐛 增加日志信息
This commit is contained in:
@@ -165,9 +165,19 @@ func (c *CpdailyIapLogin) Login(ctx context.Context, schoolDetail *school.School
|
|||||||
case "CAPTCHA_NOTMATCH":
|
case "CAPTCHA_NOTMATCH":
|
||||||
utils.OkOrPanic(errors.NewBusinessError(503, "Iap登录失败, 验证码识别失败"))
|
utils.OkOrPanic(errors.NewBusinessError(503, "Iap登录失败, 验证码识别失败"))
|
||||||
case "FAIL_UPNOTMATCH":
|
case "FAIL_UPNOTMATCH":
|
||||||
utils.OkOrPanic(errors.NewBusinessError(503, "Iap登录失败, 用户名或密码错误"))
|
utils.OkOrPanic(errors.NewBusinessError(503, "Iap登录失败, 用户名或密码错误"), func(err error) error {
|
||||||
|
return oops.With("username", username).
|
||||||
|
With("password", password).
|
||||||
|
With("userId", utils.GetUserIdNotPanic(ctx)).
|
||||||
|
In("Cpdaily.Login").New("Iap登录失败, 用户名或密码错误")
|
||||||
|
})
|
||||||
default:
|
default:
|
||||||
utils.OkOrPanic(errors.NewBusinessError(503, fmt.Sprintf("Iap登录失败, 状态识别码: %s", resultCode)))
|
utils.OkOrPanic(errors.NewBusinessError(503, fmt.Sprintf("Iap登录失败, 状态识别码: %s", resultCode)), func(err error) error {
|
||||||
|
return oops.With("username", username).
|
||||||
|
With("password", password).
|
||||||
|
With("userId", utils.GetUserIdNotPanic(ctx)).
|
||||||
|
In("Cpdaily.Login").New("Iap登录失败, 状态识别码: %s" + resultCode)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,14 @@ func GetUserInfoFromCtx(ctx context.Context) *ent.SysUser {
|
|||||||
return user
|
return user
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetUserIdNotPanic(ctx context.Context) int64 {
|
||||||
|
if ctx.Value(cst.CtxUserInfo) == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
user := ctx.Value(cst.CtxUserInfo).(*ent.SysUser)
|
||||||
|
return user.ID
|
||||||
|
}
|
||||||
|
|
||||||
// CalculateBalance 获取给下级充值后剩余余额
|
// CalculateBalance 获取给下级充值后剩余余额
|
||||||
func CalculateBalance(balance decimal.Decimal, rate decimal.Decimal, amount decimal.Decimal, amountRate decimal.Decimal) decimal.Decimal {
|
func CalculateBalance(balance decimal.Decimal, rate decimal.Decimal, amount decimal.Decimal, amountRate decimal.Decimal) decimal.Decimal {
|
||||||
// 如果当前级别费率为0(超级管理员)
|
// 如果当前级别费率为0(超级管理员)
|
||||||
|
|||||||
Reference in New Issue
Block a user