/// <summary> /// 修改登录密码 /// </summary> /// <returns></returns> public async Task <ApiResult <string> > ModifyLoginPwdAsync(StaffModifyPwdParm parm) { var res = new ApiResult <string>() { data = "1", statusCode = (int)ApiEnum.ParameterError }; try { //判断原密码是否正确 parm.HistoryPwd = DES3Encrypt.EncryptString(parm.HistoryPwd); var isExt = ErpStaffDb.IsAny(m => m.LoginPwd == parm.HistoryPwd && m.Guid == parm.Guid); if (!isExt) { res.message = "原密码输入错误~"; return(await Task.Run(() => res)); } //开始修改新密码 parm.NewPwd = DES3Encrypt.EncryptString(parm.NewPwd); ErpStaffDb.Update(m => new ErpStaff() { LoginPwd = parm.NewPwd }, m => m.Guid == parm.Guid); res.statusCode = (int)ApiEnum.Status; } catch (Exception ex) { res.statusCode = (int)ApiEnum.Error; res.message = ApiEnum.Error.GetEnumText() + ex.Message; } return(await Task.Run(() => res)); }
public async Task <ApiResult <string> > StaffEditPwdAsync(StaffModifyPwdParm parm) { return(await _staffService.ModifyLoginPwdAsync(parm)); }