/// <summary> /// 修改密码 /// </summary> /// <param name="tel">账号(电话)</param> /// <param name="password">新密码</param> /// <param name="key">秘钥(用于加解密)</param> /// <returns></returns> public async Task ChangePwd(string tel, string password, string key) { using (IStaffInfoService staffInfoService = new StaffInfoService()) { var staff = await staffInfoService.GetAll().Where(p => p.Tel == tel).FirstAsync(); staff.Password = StringEncryptAndDecrypt.AESEncrypt(password, key); await staffInfoService.EditAsync(staff); } }
/// <summary> /// 冻结账号 /// </summary> /// <param name="tel">账号(电话)</param> /// <returns></returns> public async Task LockAccount(string tel) { using (IStaffInfoService staffInfoService = new StaffInfoService()) { var staff = staffInfoService.GetAll().Where(p => p.Tel == tel).FirstOrDefault(); if (staff != null) { staff.Status = false; await staffInfoService.EditAsync(staff); } } }
/// <summary> /// 移除职员状态 /// </summary> /// <param name="staffId"></param> /// <param name="operatorId"></param> /// <returns></returns> public async Task ChangeStaffStatusById(Guid staffId, Guid operatorId) { using (var staffInfoService = new StaffInfoService()) { var staff = await staffInfoService.GetOneById(staffId); staff.Status = !staff.Status; await staffInfoService.EditAsync(staff); using (var accountOperateLogService = new AccountOperateLogService()) { await accountOperateLogService.CreateAsync(new Model.AccountOperateLog() { OperatorId = operatorId, ModifiedId = staffId, OPerateType = "2" }); } } }