|
@@ -201,16 +201,48 @@ namespace ZhonTai.Admin.Services.DiTuiAPI
|
|
|
{
|
|
|
var platform = _httpContextAccessor.HttpContext.Request.Headers["platform"];
|
|
|
|
|
|
+ if(input.Password != input.PasswordCheck && !string.IsNullOrEmpty(input.Password))
|
|
|
+ {
|
|
|
+ throw ResultOutput.Exception($"两次输入密码不一致");
|
|
|
+ }
|
|
|
if (string.IsNullOrEmpty(input.InvitCode))
|
|
|
{
|
|
|
throw ResultOutput.Exception($"邀请码不可为空");
|
|
|
}
|
|
|
+ if (string.IsNullOrEmpty(input.Phone))
|
|
|
+ {
|
|
|
+ throw ResultOutput.Exception($"手机号不可为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (string.IsNullOrEmpty(input.VCode))
|
|
|
+ {
|
|
|
+ throw ResultOutput.Exception($"短信验证码不可为空");
|
|
|
+ }
|
|
|
+ var vCodeResult = await _smsRepository.Select.DisableGlobalFilter(FilterNames.Tenant)
|
|
|
+ .Where(a => a.Mobile == input.Phone && a.Vcode == input.VCode && a.CreatedTime >= DateTime.Now.AddMinutes(-10) && a.Status == 0)
|
|
|
+ .OrderByDescending(a => a.CreatedTime)
|
|
|
+ .FirstAsync();
|
|
|
+ if(vCodeResult is null)
|
|
|
+ {
|
|
|
+ throw ResultOutput.Exception($"短信验证码不正确");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ SmsEntity smsEntity = new SmsEntity();
|
|
|
+ Mapper.Map(vCodeResult, smsEntity);
|
|
|
+
|
|
|
+ smsEntity.Status = 1;
|
|
|
+ //vCodeResult.Status = 1;
|
|
|
+ var updateResult = _smsRepository.UpdateDiy.DisableGlobalFilter(FilterNames.Tenant).SetSource(smsEntity).ExecuteAffrowsAsync();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
var org = await _orgRepository.Select.Where(a=> a.Code == platform).DisableGlobalFilter()
|
|
|
.FirstAsync(a => new { a.Name, a.TenantId });
|
|
|
|
|
|
Expression<Func<PlatformUserEntity, bool>> where = (a => a.Phone == input.Phone);
|
|
|
- where = where.Or(input.Phone.NotNull(), a => a.Phone == input.Phone)
|
|
|
- .Or(input.Name.NotNull(), a => a.Name == input.Name);
|
|
|
+ //where = where.Or(input.Phone.NotNull(), a => a.Phone == input.Phone);
|
|
|
+ //.And(input.Name.NotNull(), a => a.Name == input.Name);
|
|
|
|
|
|
var existsUser = await _platformUserRepository.Select.Where(where).DisableGlobalFilter().Where(a => a.TenantId == org.TenantId)
|
|
|
.FirstAsync(a => new { a.Name, a.Phone, a.TenantId });
|
|
@@ -236,7 +268,7 @@ namespace ZhonTai.Admin.Services.DiTuiAPI
|
|
|
|
|
|
if (input.Phone.NotNull() && existsUser.Phone == input.Phone)
|
|
|
{
|
|
|
- throw ResultOutput.Exception($"手机号已存在");
|
|
|
+ throw ResultOutput.Exception($"手机号已注册");
|
|
|
}
|
|
|
|
|
|
//if (input.Name.NotNull() && existsUser.Name == input.Name)
|
|
@@ -323,7 +355,7 @@ namespace ZhonTai.Admin.Services.DiTuiAPI
|
|
|
/// </summary>
|
|
|
/// <param name="phone"></param>
|
|
|
/// <returns></returns>
|
|
|
- [HttpGet]
|
|
|
+ [HttpPost]
|
|
|
[AllowAnonymous]
|
|
|
[NoOprationLog]
|
|
|
public string SendCode(string phone)
|