public async Task <IActionResult> BindTherapistWeChatOpenIdAsync([FromBody] BindTherapistWeChatOpenIdRequestDto requestDto) { var biz = new TherapistBiz(); var model = await biz.GetModelByPhoneAsync(requestDto.TherapistPhone); if (model == null) { return(Failed(ErrorCode.InvalidIdPassword)); } if (!string.Equals(model.TherapistPassword, CryptoHelper.AddSalt(model.TherapistGuid, requestDto.TherapistPassword), StringComparison.OrdinalIgnoreCase)) { return(Failed(ErrorCode.InvalidIdPassword)); } if (string.Equals(model.WeChatOpenId, requestDto.WeChatOpenId, StringComparison.OrdinalIgnoreCase)) { return(Failed(ErrorCode.UserData, "已绑定过,无需重复绑定")); } model.WeChatOpenId = requestDto.WeChatOpenId; var result = await biz.UpdateAsync(model); return(result ? Success() : Failed(ErrorCode.DataBaseError, "服务人员绑定微信失败")); }
public async Task <IActionResult> TherapistResetPasswordAsync([FromBody] TherapistResetPasswordAsyncRequestDto requestDto) { var therapistBiz = new TherapistBiz(); var biz = new AccountBiz(); if (!biz.VerifyCode(requestDto.Phone, requestDto.Code)) { return(Failed(ErrorCode.VerificationCode, "手机验证码错误!")); } var model = await therapistBiz.GetModelByPhoneAsync(requestDto.Phone); if (model == null) { return(Failed(ErrorCode.Empty, "该手机号未注册")); } model.LastUpdatedBy = string.IsNullOrWhiteSpace(UserID) ? "test" : UserID; model.TherapistPassword = CryptoHelper.AddSalt(model.TherapistGuid, requestDto.Password); if (string.IsNullOrEmpty(model.TherapistPassword)) { return(Failed(ErrorCode.SystemException, "密码加盐失败")); } return(therapistBiz.UpdateAsync(model).Result ? Success() : Failed(ErrorCode.DataBaseError, "密码更新失败!")); }