Kaynağa Gözat

添加小票机

shish 3 yıl önce
ebeveyn
işleme
5976513b80
1 değiştirilmiş dosya ile 11 ekleme ve 1 silme
  1. 11 1
      app-ghs/controllers/ShopExtController.php

+ 11 - 1
app-ghs/controllers/ShopExtController.php

@@ -43,6 +43,8 @@ class ShopExtController extends BaseController
             util::fail('请先填写小票机编号2');
         }
 
+        $hasFail = 0;
+
         if (!empty($wcPrintSn) && !empty($wcPrintKey)) {
             $print = new printUtil($wcPrintSn);
             $return = $print->addPrint($wcPrintKey, $name);
@@ -50,6 +52,8 @@ class ShopExtController extends BaseController
                 $ext->wcPrintSn = $wcPrintSn;
                 $ext->wcPrintKey = $wcPrintKey;
                 $ext->save();
+            } else {
+                $hasFail = 1;
             }
         } else {
             $ext->wcPrintSn = '';
@@ -64,6 +68,8 @@ class ShopExtController extends BaseController
                 $ext->wcPrintSn2 = $wcPrintSn2;
                 $ext->wcPrintKey2 = $wcPrintKey2;
                 $ext->save();
+            } else {
+                $hasFail = 1;
             }
         } else {
             $ext->wcPrintSn2 = '';
@@ -78,13 +84,17 @@ class ShopExtController extends BaseController
                 $ext->wcPrintSn3 = $wcPrintSn3;
                 $ext->wcPrintKey3 = $wcPrintKey3;
                 $ext->save();
+            } else {
+                $hasFail = 1;
             }
         } else {
             $ext->wcPrintSn3 = '';
             $ext->wcPrintKey3 = '';
             $ext->save();
         }
-
+        if ($hasFail == 1) {
+            util::fail('添加发现失败');
+        }
         util::complete();
     }