فهرست منبع

切换门店时,旧门店相关的用户设备状态变更为退出

shizhongqi 7 ماه پیش
والد
کامیت
1c0b370db3
2فایلهای تغییر یافته به همراه18 افزوده شده و 0 حذف شده
  1. 9 0
      app-ghs/controllers/ShopController.php
  2. 9 0
      app-hd/controllers/ShopController.php

+ 9 - 0
app-ghs/controllers/ShopController.php

@@ -455,11 +455,20 @@ class ShopController extends BaseController
         }
 
         $newShopId = Yii::$app->request->post('shopId', 0);
+        $deviceId = Yii::$app->request->post('deviceId', '');
+        if (empty($deviceId)) {
+            util::fail('设备ID出错');
+        }
         $newShop = ShopClass::getById($newShopId, true);
         if (empty($newShop)) {
             util::fail('没有找到门店66');
         }
         $res = AdminClass::toggleShop($this->admin, $newShop, $this->sjId, $this->shopAdmin);
+
+        //设备登录状态更新
+        \bizGhs\device\classes\GhsDeviceClass::updateByCondition(['shopId'=>$this->shopId, 'deviceId'=>$deviceId], ['status'=>0]);
+        //\bizGhs\device\classes\GhsDeviceClass::updateByCondition(['shopId'=>$newShop, 'deviceId'=>$deviceId], ['status'=>1]);
+
         util::success($res);
     }
 

+ 9 - 0
app-hd/controllers/ShopController.php

@@ -229,11 +229,20 @@ class ShopController extends BaseController
         }
 
         $newShopId = Yii::$app->request->post('shopId', 0);
+        $deviceId = Yii::$app->request->post('deviceId', '');
+        if (empty($deviceId)) {
+            util::fail('设备ID出错');
+        }
         $newShop = ShopClass::getById($newShopId, true);
         if (empty($newShop)) {
             util::fail('没有找到门店30');
         }
         $res = \bizHd\admin\classes\AdminClass::toggleShop($this->admin, $newShop, $this->sjId, $this->shopAdmin);
+
+        //设备登录状态更新
+        \bizHd\device\classes\HdDeviceClass::updateByCondition(['shopId'=>$this->shopId, 'deviceId'=>$deviceId], ['status'=>0]);
+        //\bizHd\device\classes\HdDeviceClass::updateByCondition(['shopId'=>$newShopId, 'deviceId'=>$deviceId], ['status'=>1]);
+
         util::success($res);
     }