refactor: 移除不必要的上下文调用,简化服务方法参数

This commit is contained in:
2025-12-30 22:14:22 +08:00
parent c8f6cb0b34
commit e5064db577
12 changed files with 67 additions and 67 deletions

View File

@@ -22,7 +22,7 @@ type Auth struct{}
// @Success 200 {object} string "OTP sent"
// @Bind form body
func (a *Auth) SendOTP(ctx fiber.Ctx, form *dto.SendOTPForm) error {
return services.User.SendOTP(ctx.Context(), form.Phone)
return services.User.SendOTP(ctx, form.Phone)
}
// Login logs in or registers a user with OTP.
@@ -37,5 +37,5 @@ func (a *Auth) SendOTP(ctx fiber.Ctx, form *dto.SendOTPForm) error {
// @Success 200 {object} dto.LoginResponse
// @Bind form body
func (a *Auth) Login(ctx fiber.Ctx, form *dto.LoginForm) (*dto.LoginResponse, error) {
return services.User.LoginWithOTP(ctx.Context(), form.Phone, form.OTP)
return services.User.LoginWithOTP(ctx, form.Phone, form.OTP)
}