Browse Source

预订更新

shish 1 year ago
parent
commit
7d70b88605
2 changed files with 12 additions and 9 deletions
  1. 7 4
      biz-ghs/book/classes/BookItemClass.php
  2. 5 5
      biz-ghs/order/services/OrderService.php

+ 7 - 4
biz-ghs/book/classes/BookItemClass.php

@@ -136,7 +136,7 @@ class BookItemClass extends BaseClass
             $bookCustomRes = BookCustomChangeClass::delBookNum($bookCustomRes, $num, $order, $shop, $product, $params);
 
             //预订变化通知 ssh 20240820
-            $noticeText = json_encode(['orderId' => $orderId,'customName'=>$customName,'customId'=>$customId,'itemId'=>$itemId,'itemName'=>$name,'io'=>0,'num'=>$num,'shopId'=>$shopId]);
+            $noticeText = json_encode(['orderId' => $orderId, 'customName' => $customName, 'customId' => $customId, 'itemId' => $itemId, 'itemName' => $name, 'io' => 0, 'num' => $num, 'shopId' => $shopId]);
             $noticeKey = "bookChangeNoticeStaff";
             Yii::$app->redis->executeCommand('LPUSH', [$noticeKey, $noticeText]);
 
@@ -209,6 +209,7 @@ class BookItemClass extends BaseClass
     //批量添加预订花材 ssh 20240711
     public static function addBatchItem($batchData, $order, $params = [])
     {
+        $action = $params['action'] ?? 'update';
         $orderId = $order->id ?? 0;
         $shopId = $order->shopId ?? 0;
         $shop = ShopClass::getById($shopId, true);
@@ -353,9 +354,11 @@ class BookItemClass extends BaseClass
             Yii::$app->redis->executeCommand('SADD', [$cacheKey, $bookSn]);
 
             //预订变化通知
-            $noticeText = json_encode(['orderId' => $orderId,'customName'=>$customName,'customId'=>$customId,'itemId'=>$itemId,'itemName'=>$name,'io'=>1,'num'=>$num,'shopId'=>$shopId]);
-            $noticeKey = "bookChangeNoticeStaff";
-            Yii::$app->redis->executeCommand('LPUSH', [$noticeKey, $noticeText]);
+            if($action == 'update'){
+                $noticeText = json_encode(['orderId' => $orderId, 'customName' => $customName, 'customId' => $customId, 'itemId' => $itemId, 'itemName' => $name, 'io' => 1, 'num' => $num, 'shopId' => $shopId]);
+                $noticeKey = "bookChangeNoticeStaff";
+                Yii::$app->redis->executeCommand('LPUSH', [$noticeKey, $noticeText]);
+            }
         }
     }
 

+ 5 - 5
biz-ghs/order/services/OrderService.php

@@ -765,20 +765,20 @@ class OrderService extends BaseService
             if (!empty($itemList)) {
                 $bookData = [];
                 foreach ($itemList as $currentItem) {
-                    $itemRemark = $currentItem->remark??0;
-                    $hasRemark = !empty($itemRemark)?1:0;
+                    $itemRemark = $currentItem->remark ?? 0;
+                    $hasRemark = !empty($itemRemark) ? 1 : 0;
                     $bookData[] = [
                         'productId' => $currentItem->productId,
                         'num' => $currentItem->xhNum ?? 0,
                         'lastNum' => $currentItem->xhNum ?? 0,
-                        'remark'=>$itemRemark,
-                        'hasRemark'=>$hasRemark,
+                        'remark' => $itemRemark,
+                        'hasRemark' => $hasRemark,
                     ];
                 }
                 $staffId = $order->shopAdminId ?? 0;
                 $staffName = $order->shopAdminName ?? '';
                 $params = [
-                    'staffId' => $staffId, 'staffName' => $staffName
+                    'staffId' => $staffId, 'staffName' => $staffName, 'action' => 'add'
                 ];
                 BookItemClass::addBatchItem($bookData, $order, $params);
             }