shish %!s(int64=5) %!d(string=hai) anos
pai
achega
2bee6024bb
Modificáronse 3 ficheiros con 9 adicións e 9 borrados
  1. 4 5
      app-ghs/controllers/AuthController.php
  2. 3 3
      app-hd/controllers/AuthController.php
  3. 2 1
      sql.sql

+ 4 - 5
app-ghs/controllers/AuthController.php

@@ -2,6 +2,7 @@
 
 namespace ghs\controllers;
 
+use biz\admin\classes\AdminClass;
 use bizHd\admin\classes\ShopAdminClass;
 use bizGhs\shop\services\ShopAdminService;
 use bizGhs\admin\services\AdminService;
@@ -154,19 +155,17 @@ class AuthController extends PublicController
         if (empty($password)) {
             util::fail('请输入密码');
         }
-        $admin = AdminService::getByCondition(['mobile' => $mobile]);
+        $admin = AdminService::getByCondition(['mobile' => $mobile, 'style' => AdminClass::STYLE_GHS]);
         if (password_verify($password, $admin['password']) == false) {
             util::fail('密码错误');
         }
         $adminId = $admin['id'];
-        $shopAdmin = ShopAdminService::getByCondition(['adminId' => $adminId]);
+        $shopAdmin = ShopAdminService::getByCondition(['adminId' => $adminId, 'delStatus' => 0]);
         $merchantId = isset($shopAdmin['merchantId']) ? $shopAdmin['merchantId'] : 0;
-        $shopId = isset($shopAdmin['shopId']) ? $shopAdmin['shopId'] : 0;
+        $shopId = $shopAdmin['shopId'] ?? 0;
         if (empty($shopId)) {
             util::fail('您不是管理员');
         }
-        //管理员关联门店
-        Yii::$app->redis->executeCommand('SET', ['LOGIN_ADMIN_SHOP' . $adminId, $shopId]);
         //获取token
         $token = jwt::getNewToken($adminId);
         util::success(['token' => $token, 'account' => $merchantId, 'shopId' => $shopId]);

+ 3 - 3
app-hd/controllers/AuthController.php

@@ -153,14 +153,14 @@ class AuthController extends PublicController
         if (empty($password)) {
             util::fail('请输入密码');
         }
-        $admin = AdminService::getByCondition(['style' => AdminClass::STYLE_HD, 'mobile' => $mobile]);
+        $admin = AdminService::getByCondition(['mobile' => $mobile, 'style' => AdminClass::STYLE_HD]);
         if (password_verify($password, $admin['password']) == false) {
             util::fail('密码错误');
         }
         $adminId = $admin['id'];
-        $shopAdmin = ShopAdminService::getByCondition(['adminId' => $adminId]);
+        $shopAdmin = ShopAdminService::getByCondition(['adminId' => $adminId, 'delStatus' => 0]);
         $merchantId = isset($shopAdmin['merchantId']) ? $shopAdmin['merchantId'] : 0;
-        $shopId = isset($shopAdmin['shopId']) ? $shopAdmin['shopId'] : 0;
+        $shopId = $shopAdmin['shopId'] ?? 0;
         if (empty($shopId)) {
             util::fail('您不是管理员');
         }

+ 2 - 1
sql.sql

@@ -1720,4 +1720,5 @@ CREATE TABLE IF NOT EXISTS `xhRenewSn` (
   `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
   PRIMARY KEY (`id`)
 ) AUTO_INCREMENT=18623508 COMMENT='续费订单号';
-ALTER TABLE xhOrder DROP COLUMN `createTime`;
+ALTER TABLE xhOrder DROP COLUMN `createTime`;
+ALTER TABLE xhAdmin ADD INDEX `admin`(`mobile`,`style`);