Jelajahi Sumber

打印次数控制

shish 2 tahun lalu
induk
melakukan
1938a3365d

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

@@ -1005,8 +1005,11 @@ class OrderController extends BaseController
                 if (isset($order->needPrint) && $order->needPrint == dict::getDict('needPrint', 'need')) {
                     if ($order->status != 1 && $order->status != 5) {
                         OrderClass::onlinePrint($order);
-                        $order->printNum += 1;
-                        $order->save();
+                        $ext = $this->shopExt;
+                        if (isset($ext->printSn) && !empty($ext->printSn)) {
+                            $order->printNum += 1;
+                            $order->save();
+                        }
                     }
                 }
                 //前台提醒出示付款码

+ 13 - 5
app-hd/controllers/NoticeController.php

@@ -127,7 +127,7 @@ class NoticeController extends PublicController
                     if (isset($cg->book) && $cg->book == 0) {
                         $ghsShopId = $order->shopId ?? 0;
                         if (getenv('YII_ENV') == 'production') {
-                            $specialList = [10649, 8042,16454];
+                            $specialList = [10649, 8042, 16454];
                         } else {
                             $specialList = [];
                         }
@@ -358,9 +358,15 @@ class NoticeController extends PublicController
                             if (in_array($order->mainId, $mallOrderNoPrint)) {
 
                             } else {
+
+                                $shopId = $order->shopId ?? 0;
+                                $ext = ShopExtClass::getByCondition(['shopId' => $shopId], true);
+
                                 OrderClass::onlinePrint($order);
-                                $order->printNum += 1;
-                                $order->save();
+                                if (isset($ext->printSn) && !empty($ext->printSn)) {
+                                    $order->printNum += 1;
+                                    $order->save();
+                                }
 
                                 if (getenv('YII_ENV') == 'production') {
                                     //福州我要花要打二次小票
@@ -370,8 +376,10 @@ class NoticeController extends PublicController
                                 }
                                 if (in_array($order->mainId, $needTwoPrint)) {
                                     OrderClass::onlinePrint($order);
-                                    $order->printNum += 1;
-                                    $order->save();
+                                    if (isset($ext->printSn) && !empty($ext->printSn)) {
+                                        $order->printNum += 1;
+                                        $order->save();
+                                    }
                                 }
 
                             }