|
|
@@ -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);
|