shish há 4 anos atrás
pai
commit
3a9e6410af

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

@@ -25,10 +25,10 @@ class StatRefundMonthClass extends BaseClass
             $month = date('m', $timestamp);
         }
         $sjId = $shop->sjId;
-        $shopId = $shop->id;
-        $stat = self::getByCondition(['sjId' => $sjId, 'shopId' => $shopId, 'time' => $time], true);
+        $mainId = $main->id ?? 0;
+        $stat = self::getByCondition(['sjId' => $sjId, 'mainId' => $mainId, 'time' => $time], true);
         if (empty($stat)) {
-            $stat = self::add(['shopId' => $shopId, 'sjId' => $sjId, 'time' => $time, 'year' => $year, 'month' => $month, 'num' => 1], true);
+            $stat = self::add(['mainId' => $mainId, 'sjId' => $sjId, 'time' => $time, 'year' => $year, 'month' => $month, 'num' => 1], true);
         }
         $id = $stat->id;
         $unique = self::getLockById($id);

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

@@ -21,11 +21,11 @@ class StatStockInClass extends BaseClass
     public static function replace($main, $shop, $amount)
     {
         $sjId = $shop->sjId;
-        $shopId = $shop->id;
+        $mainId = $main->id ?? 0;
         $time = date('Ymd');
-        $stat = self::getByCondition(['sjId' => $sjId, 'shopId' => $shopId, 'time' => $time], true);
+        $stat = self::getByCondition(['sjId' => $sjId, 'mainId' => $mainId, 'time' => $time], true);
         if (empty($stat)) {
-            $stat = self::add(['shopId' => $shopId, 'sjId' => $sjId, 'time' => $time], true);
+            $stat = self::add(['mainId' => $mainId, 'sjId' => $sjId, 'time' => $time], true);
         }
         $id = $stat->id;
         $unique = self::getLockById($id);

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

@@ -17,10 +17,10 @@ class StatStockInMonthClass extends BaseClass
         $year = date('Y');
         $month = date('m');
         $sjId = $shop->sjId;
-        $shopId = $shop->id;
-        $stat = self::getByCondition(['sjId' => $sjId, 'shopId' => $shopId, 'time' => $time], true);
+        $mainId = $main->id ?? 0;
+        $stat = self::getByCondition(['sjId' => $sjId, 'mainId' => $mainId, 'time' => $time], true);
         if (empty($stat)) {
-            $stat = self::add(['shopId' => $shopId, 'sjId' => $sjId, 'time' => $time, 'year' => $year, 'month' => $month], true);
+            $stat = self::add(['mainId' => $mainId, 'sjId' => $sjId, 'time' => $time, 'year' => $year, 'month' => $month], true);
         }
         $id = $stat->id;
         $unique = self::getLockById($id);

+ 4 - 4
biz/stat/classes/StatStockOutMonthClass.php

@@ -16,10 +16,10 @@ class StatStockOutMonthClass extends BaseClass
         $year = date('Y');
         $month = date('m');
         $sjId = $shop->sjId;
-        $shopId = $shop->id;
-        $stat = self::getByCondition(['sjId' => $sjId, 'shopId' => $shopId, 'time' => $time], true);
+        $mainId = $main->id ?? 0;
+        $stat = self::getByCondition(['sjId' => $sjId, 'mainId' => $mainId, 'time' => $time], true);
         if (empty($stat)) {
-            $stat = self::add(['shopId' => $shopId, 'sjId' => $sjId, 'time' => $time, 'year' => $year, 'month' => $month], true);
+            $stat = self::add(['mainId' => $mainId, 'sjId' => $sjId, 'time' => $time, 'year' => $year, 'month' => $month], true);
         }
         $id = $stat->id;
         $unique = self::getLockById($id);
@@ -32,4 +32,4 @@ class StatStockOutMonthClass extends BaseClass
         $unique->save();
     }
 
-}
+}