shish 4 年 前
コミット
bc4ff4bed2
1 ファイル変更3 行追加2 行削除
  1. 3 2
      biz/stat/classes/StatPdSubMonthClass.php

+ 3 - 2
biz/stat/classes/StatPdSubMonthClass.php

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