李昊 4 年之前
父节点
当前提交
ade866bebf
共有 1 个文件被更改,包括 9 次插入1 次删除
  1. 9 1
      GxPress/Repository/GxPress.Repository.Implement/UserRepository.cs

+ 9 - 1
GxPress/Repository/GxPress.Repository.Implement/UserRepository.cs

@@ -353,7 +353,15 @@ namespace GxPress.Repository.Implement
         {
             if (user == null) throw new Exception("用户不能为空");
             if (string.IsNullOrEmpty(user.Name)) throw new Exception("用户不能为空");
-
+            if (!string.IsNullOrEmpty(user.Phone) &&
+                            await _repository.ExistsAsync(Q.Where(nameof(User.Phone), user.Phone).Where(nameof(User.IsDelete), true)))
+            {
+                var userModel = await GetByPhoneAsync(user.Phone);
+                user.IsDelete = false;
+                user.Id = userModel.Id;
+                await _repository.UpdateAsync(user);
+                return userModel.Id;
+            }
             if (!string.IsNullOrEmpty(user.Phone) &&
                 await _repository.ExistsAsync(Q.Where(nameof(User.Phone), user.Phone)))
             {