Parcourir la source

修复创客注销功能

lichunlei il y a 3 ans
Parent
commit
01fa477e94

+ 11 - 17
Areas/Admin/Controllers/MainServer/UsersController.cs

@@ -574,26 +574,20 @@ namespace MySystem.Areas.Admin.Controllers
                         // return Json(new AppResultJson() { Status = "-1", Info = "注销失败,未满足条件:名下无未绑定机具、机具券,无未申请的循环机。如有疑问,请联系客服" });
                         // return Json(new AppResultJson() { Status = "-1", Info = "注销失败,未满足条件:名下无未绑定机具、机具券,无未申请的循环机。如有疑问,请联系客服" });
                         return "注销失败,未满足条件:名下无未绑定机具、机具券,无未申请的循环机。如有疑问,请联系客服";
                         return "注销失败,未满足条件:名下无未绑定机具、机具券,无未申请的循环机。如有疑问,请联系客服";
                     }
                     }
-                    UserForMobile forMobile = db.UserForMobile.FirstOrDefault(m => m.Mobile == user.Mobile);
-                    if (forMobile != null)
-                    {
-                        db.Remove(forMobile);
-                    }
-                    user.Status = -1;
-                    user.Mobile += "d";
-                    user.CertId += "d";
                 }
                 }
-                else
+                UserForMobile forMobile = db.UserForMobile.FirstOrDefault(m => m.Mobile == user.Mobile);
+                if (forMobile != null)
                 {
                 {
-                    UserForMobile forMobile = db.UserForMobile.FirstOrDefault(m => m.Mobile == user.Mobile);
-                    if (forMobile != null)
-                    {
-                        db.Remove(forMobile);
-                    }
-                    user.Status = -1;
-                    user.Mobile += "d";
-                    user.CertId += "d";
+                    db.UserForMobile.Remove(forMobile);
+                }
+                UserForMakerCode forCode = db.UserForMakerCode.FirstOrDefault(m => m.MakerCode == user.MakerCode);
+                if (forCode != null)
+                {
+                    db.UserForMakerCode.Remove(forCode);
                 }
                 }
+                user.Status = -1;
+                user.Mobile += "d";
+                user.CertId += "d";
                 function.WriteLog(user.Id + "于" + DateTime.Now.ToString() + "注销账号", "创客注销日志");
                 function.WriteLog(user.Id + "于" + DateTime.Now.ToString() + "注销账号", "创客注销日志");
                 // TODO: 每月扫描一次注销的创客,把注销创客伞下创客全部挂到注销创客的上级
                 // TODO: 每月扫描一次注销的创客,把注销创客伞下创客全部挂到注销创客的上级
                 // TODO: 清除token,token登录返回
                 // TODO: 清除token,token登录返回

+ 1 - 1
wwwroot/layuiadmin/modules_main/Users_Admin.js

@@ -156,7 +156,7 @@ layui.config({
                     $.ajax({
                     $.ajax({
                         type: "POST",
                         type: "POST",
                         url: "/Admin/Users/Cancel?r=" + Math.random(1),
                         url: "/Admin/Users/Cancel?r=" + Math.random(1),
-                        data: "Id=" + data.Id,
+                        data: "UserId=" + data.Id,
                         dataType: "text",
                         dataType: "text",
                         success: function (data) {
                         success: function (data) {
                             if (data == "success") {
                             if (data == "success") {