shopAdmin; $roleId = $shopAdmin['roleId'] ?? 0; $role = AdminRoleClass::getById($roleId); $roleName = $role['roleName'] ?? ''; if ($roleName == '员工') { util::fail('没有权限操作哦'); } $shopId = $this->shopId; $ext = ShopExtClass::getByCondition(['shopId' => $shopId], true); $get = Yii::$app->request->get(); $printSn = $get['printSn'] ?? ''; $printKey = $get['printKey'] ?? ''; $print = new printUtil($printSn); $shop = $this->shop; $default = $shop->default ?? 0; $shopName = $shop->shopName ?? ''; $sj = $this->sj; $sjName = $sj->name ?? ''; $name = $default == 1 ? $sjName : $sjName . ' ' . $shopName; if (!empty($printSn) && !empty($printKey)) { $return = $print->addPrint($printKey, $name); if ($return) { $ext->printSn = $printSn; $ext->printKey = $printKey; $ext->save(); util::complete('添加成功'); } } if (empty($printSn) && empty($printKey)) { $ext->printSn = ''; $ext->printKey = ''; $ext->save(); util::complete('修改成功'); } util::fail('添加失败'); } //获取打印机信息 public function actionGetPrint() { $shopId = $this->shopId; $ext = ShopExtClass::getByCondition(['shopId' => $shopId]); util::success($ext); } }