shish 5 роки тому
батько
коміт
98919de01b
1 змінених файлів з 5 додано та 2 видалено
  1. 5 2
      app-ghs/controllers/ShopExtController.php

+ 5 - 2
app-ghs/controllers/ShopExtController.php

@@ -16,8 +16,8 @@ class ShopExtController extends BaseController
     public function actionAddPrint()
     {
         $shopId = $this->shopId;
-        $ext = ShopExtClass::getByCondition(['shopId' => $shopId]);
-        if (isset($ext['printSn']) && !empty($ext['printSn'])) {
+        $ext = ShopExtClass::getByCondition(['shopId' => $shopId], true);
+        if (isset($ext->printSn) && !empty($ext->printSn)) {
             util::fail('您已经添加过了');
         }
         $get = Yii::$app->request->get();
@@ -26,6 +26,9 @@ class ShopExtController extends BaseController
         $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();