shopId; $ext = ShopExtClass::getByCondition(['shopId' => $shopId], true); if (isset($ext->printSn) && !empty($ext->printSn)) { util::fail('您已经添加过了'); } $get = Yii::$app->request->get(); $sn = $get['sn'] ?? ''; $key = $get['key'] ?? ''; $print = new printUtil($sn); $shop = $this->shop; $shopName = $shop['shopName'] ?? ''; $ext->printSn = $sn; $ext->printKey = $key; $ext->save(); $return = $print->addPrint($key, $shopName); if ($return) { util::complete(); } util::fail(); } //获取打印机信息 public function actionGetPrint() { $shopId = $this->shopId; $ext = ShopExtClass::getByCondition(['shopId' => $shopId]); util::success($ext); } }