public IActionResult UpdatePhone([FromBody] VerifyCodeRequestDto request) { var accountBiz = new AccountBiz(); if (!accountBiz.VerifyCode(request.Phone, request.Code)) { return(Failed(ErrorCode.VerificationCode, "手机验证码错误")); } var list = accountBiz.GetUserByPhone(request.Phone); if (list.Any()) { return(Failed(ErrorCode.DuplicatePhone, "手机号已经注册")); } list = accountBiz.GetUserByPhone(request.Phone, false); if (list.Any()) { return(Failed(ErrorCode.DuplicatePhone, "手机号已经注册")); } var biz = new AccountBiz(); var userModel = biz.GetUserById(UserID); if (userModel == null) { return(Failed(ErrorCode.Empty, "用户不存在或者已经注销")); } userModel.Phone = request.Phone; return(biz.UpdateUser(userModel) ? Success() : Failed(ErrorCode.DataBaseError, "修改电话号码失败")); }
public IActionResult VerifyCode([FromBody] VerifyCodeRequestDto request) { var biz = new AccountBiz(); if (biz.VerifyCode(request.Phone, request.Code)) { return(Success()); } else { return(Failed(ErrorCode.VerificationCode)); } }