Browse Source

更新打印机

shish 5 years ago
parent
commit
665941ad71
1 changed files with 6 additions and 9 deletions
  1. 6 9
      app-ghs/controllers/ShopExtController.php

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

@@ -17,19 +17,16 @@ class ShopExtController extends BaseController
     {
         $shopId = $this->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);
+        $printSn = $get['printSn'] ?? '';
+        $printKey = $get['printKey'] ?? '';
+        $print = new printUtil($printSn);
         $shop = $this->shop;
         $shopName = $shop['shopName'] ?? '';
-        $ext->printSn = $sn;
-        $ext->printKey = $key;
+        $ext->printSn = $printSn;
+        $ext->printKey = $printKey;
         $ext->save();
-        $return = $print->addPrint($key, $shopName);
+        $return = $print->addPrint($printKey, $shopName);
         if ($return) {
             util::complete();
         }