Browse Source

app 云喇叭

shish 4 years ago
parent
commit
ddb1407f22
1 changed files with 27 additions and 6 deletions
  1. 27 6
      app-ghs/controllers/ShopExtController.php

+ 27 - 6
app-ghs/controllers/ShopExtController.php

@@ -17,13 +17,9 @@ class ShopExtController extends BaseController
     //添加打印机 shish 20210712
     public function actionAddPrint()
     {
-
         $shopAdmin = $this->shopAdmin;
-        $roleId = $shopAdmin['roleId'] ?? 0;
-        $role = AdminRoleClass::getById($roleId);
-        $roleName = $role['roleName'] ?? '';
-        if ($roleName == '员工') {
-            util::fail('没有权限操作哦');
+        if (isset($shopAdmin->super) == false || $shopAdmin->super != 1) {
+            util::fail('超管才能修改');
         }
 
         $shopId = $this->shopId;
@@ -64,6 +60,31 @@ class ShopExtController extends BaseController
         util::success($ext);
     }
 
+    //获取云喇叭信息 shish 20220105
+    public function actionGetLb()
+    {
+        $shopId = $this->shopId;
+        $ext = ShopExtClass::getByCondition(['shopId' => $shopId]);
+        util::success($ext);
+    }
+
+    //添加喇叭 shish 20220105
+    public function actionAddLb()
+    {
+        $shopAdmin = $this->shopAdmin;
+        if (isset($shopAdmin->super) == false || $shopAdmin->super != 1) {
+            util::fail('超管才能修改');
+        }
+
+        $shopId = $this->shopId;
+        $ext = ShopExtClass::getByCondition(['shopId' => $shopId], true);
+        $get = Yii::$app->request->get();
+        $lbSn = $get['lbSn'] ?? '';
+        $ext->lbSn = $lbSn;
+        $ext->save();
+        util::complete('设置成功');
+    }
+
     //小菊启用和停用 shish 20211210
     public function actionReplaceXj()
     {