shish преди 4 години
родител
ревизия
ba7d83ef99
променени са 3 файла, в които са добавени 8 реда и са изтрити 7 реда
  1. 2 1
      app-ghs/controllers/PurchaseOrderController.php
  2. 3 3
      biz/stat/classes/StatCgGhsClass.php
  3. 3 3
      biz/stat/classes/StatCgGhsMonthClass.php

+ 2 - 1
app-ghs/controllers/PurchaseOrderController.php

@@ -26,11 +26,12 @@ class PurchaseOrderController extends BaseController
             util::fail('请在首店发起采购');
         }
 
+        // [{productId:0,itemPrice:1,bigNum:1,smallNum:0}]
         $ghsItemInfo = $post['itemInfo'] ?? '';
         if (empty($ghsItemInfo)) {
             util::fail('请选择花材');
         }
-        $ghsItemInfo = json_decode($ghsItemInfo, true); // [{productId:0,itemPrice:1,bigNum:1,smallNum:0}]
+        $ghsItemInfo = json_decode($ghsItemInfo, true);
         if (!is_array($ghsItemInfo)) {
             util::fail('花材格式不正确');
         }

+ 3 - 3
biz/stat/classes/StatCgGhsClass.php

@@ -36,12 +36,12 @@ class StatCgGhsClass extends BaseClass
     public static function ghsReplace($cgInfo, $date = null)
     {
         $sjId = $cgInfo->sjId ?? 0;
-        $shopId = $cgInfo->shopId ?? 0;
+        $mainId = $cgInfo->mainId ?? 0;
         $ghsId = $cgInfo->ghsId ?? 0;
         $time = $date == null ? date('Ymd') : $date;
-        $stat = self::getByCondition(['sjId' => $sjId, 'shopId' => $shopId, 'ghsId' => $ghsId, 'time' => $time], true);
+        $stat = self::getByCondition(['sjId' => $sjId, 'mainId' => $mainId, 'ghsId' => $ghsId, 'time' => $time], true);
         if (empty($stat)) {
-            $stat = self::add(['shopId' => $shopId, 'sjId' => $sjId, 'ghsId' => $ghsId, 'time' => $time], true);
+            $stat = self::add(['mainId' => $mainId, 'sjId' => $sjId, 'ghsId' => $ghsId, 'time' => $time], true);
         }
         $id = $stat->id;
 

+ 3 - 3
biz/stat/classes/StatCgGhsMonthClass.php

@@ -53,11 +53,11 @@ class StatCgGhsMonthClass extends BaseClass
             $month = date('m', $timestamp);
         }
         $sjId = $order->sjId ?? 0;
-        $shopId = $order->shopId ?? 0;
+        $mainId = $order->mainId ?? 0;
         $ghsId = $order->ghsId ?? 0;
-        $stat = self::getByCondition(['sjId' => $sjId, 'shopId' => $shopId, 'ghsId' => $ghsId, 'time' => $time], true);
+        $stat = self::getByCondition(['sjId' => $sjId, 'mainId' => $mainId, 'ghsId' => $ghsId, 'time' => $time], true);
         if (empty($stat)) {
-            $stat = self::add(['shopId' => $shopId, 'sjId' => $sjId, 'ghsId' => $ghsId, 'time' => $time, 'year' => $year, 'month' => $month], true);
+            $stat = self::add(['mainId' => $mainId, 'sjId' => $sjId, 'ghsId' => $ghsId, 'time' => $time, 'year' => $year, 'month' => $month], true);
         }
         $id = $stat->id;
         $unique = self::getLockById($id);