Browse Source

增加登录退出code

林琦海 5 years ago
parent
commit
f628aef705

+ 2 - 2
app-ghs/controllers/BaseController.php

@@ -42,7 +42,7 @@ class BaseController extends PublicController
         $this->adminId = $adminId;
         $admin = AdminService::getById($adminId);
         if (empty($admin)) {
-            util::fail('帐号无效');
+            util::logout('帐号无效');
         }
         $this->admin = $admin;
 
@@ -61,7 +61,7 @@ class BaseController extends PublicController
             }
             $shopAdmin = ShopAdminClass::getByCondition(['shopId' => $currentShopId, 'adminId' => $adminId, 'delStatus' => 0]);
             if (empty($shopAdmin)) {
-                util::fail('没有找到员工信息');
+                util::logout('没有找到员工信息');
             }
             $this->shopAdmin = $shopAdmin;
             $this->shopAdminId = $shopAdmin['id'] ?? 0;

+ 2 - 2
app-hd/controllers/BaseController.php

@@ -56,7 +56,7 @@ class BaseController extends PublicController
             }
             $shopAdmin = ShopAdminClass::getByCondition(['shopId' => $currentShopId, 'adminId' => $adminId, 'delStatus' => 0]);
             if (empty($shopAdmin)) {
-                util::fail('没有找到员工信息');
+                util::logout('没有找到员工信息');
             }
             $this->shopAdmin = $shopAdmin;
             $this->shopAdminId = $shopAdmin['id'] ?? 0;
@@ -71,4 +71,4 @@ class BaseController extends PublicController
         return parent::beforeAction($action);
     }
 
-}
+}

+ 3 - 2
common/components/util.php

@@ -278,6 +278,7 @@ class util
         self::encode(['code' => 0, 'msg' => $msg, 'data' => []]);
     }
 
+
     //成功输出内容
     public static function success($data, $msg = '操作成功')
     {
@@ -285,9 +286,9 @@ class util
     }
 
     //退出当前登陆 ssh 2020.3.8
-    public static function logout()
+    public static function logout($msg = '当前登陆信息已失效,请重新登陆')
     {
-        self::encode(['code' => 2, 'msg' => '当前登陆信息已失效,请重新登陆', 'data' => []]);
+        self::encode(['code' => 2, 'msg' => $msg, 'data' => []]);
     }
 
     //只输出执行完成状态 ssh 2020.3.11