清理代码

This commit is contained in:
马梓彭 2026-03-30 21:44:32 +08:00
parent 87a8c989bf
commit 854d367ff1
2 changed files with 3 additions and 19 deletions

View File

@ -38,9 +38,9 @@ public class OAuthController : IDynamicApiController
[AllowAnonymous]
public async Task<MiniProgramLoginOutput> Login([FromBody] MiniProgramLoginInput input)
{
if (string.IsNullOrEmpty(input.Password) && string.IsNullOrEmpty(input.VerificationCode))
if (string.IsNullOrEmpty(input.Password) )
{
throw Oops.Bah("密码和验证码至少提供一个");
throw Oops.Bah("密码必填");
}
var appUser = await _appUserRepository.GetFirstAsync(x => x.Mobile == input.Mobile);
@ -62,17 +62,6 @@ public class OAuthController : IDynamicApiController
}
}
if (!string.IsNullOrEmpty(input.VerificationCode))
{
var cacheKey = $"{SmsCodeCachePrefix}{input.Mobile}";
string cachedCode = null;
if (!_memoryCache.TryGetValue(cacheKey, out cachedCode) || cachedCode != input.VerificationCode)
{
throw Oops.Bah("验证码错误或已过期");
}
_memoryCache.Remove(cacheKey);
}
(string accessToken, string refreshToken) = GenerateTokens(appUser);
var userInfo = new

View File

@ -2092,12 +2092,7 @@
</member>
<member name="P:YD_Event.Application.Client.Dtos.MiniProgramLoginInput.Password">
<summary>
密码(可选,与验证码至少提供一个)
</summary>
</member>
<member name="P:YD_Event.Application.Client.Dtos.MiniProgramLoginInput.VerificationCode">
<summary>
验证码(可选,与密码至少提供一个)
密码
</summary>
</member>
<member name="T:YD_Event.Application.Client.Dtos.MiniProgramLoginOutput">