|
|
@@ -34,12 +34,12 @@ class StatItemClass extends BaseClass
|
|
|
public static function replace($item, $date = null)
|
|
|
{
|
|
|
$sjId = $item->sjId ?? 0;
|
|
|
- $shopId = $item->shopId ?? 0;
|
|
|
+ $mainId = $item->mainId ?? 0;
|
|
|
$productId = $item->productId ?? 0;
|
|
|
$time = $date == null ? date('Ymd') : $date;
|
|
|
- $stat = self::getByCondition(['sjId' => $sjId, 'shopId' => $shopId, 'itemId' => $productId, 'time' => $time], true);
|
|
|
+ $stat = self::getByCondition(['sjId' => $sjId, 'mainId' => $mainId, 'itemId' => $productId, 'time' => $time], true);
|
|
|
if (empty($stat)) {
|
|
|
- $stat = self::add(['shopId' => $shopId, 'sjId' => $sjId, 'itemId' => $productId, 'time' => $time], true);
|
|
|
+ $stat = self::add(['mainId' => $mainId, 'sjId' => $sjId, 'itemId' => $productId, 'time' => $time], true);
|
|
|
}
|
|
|
$id = $stat->id;
|
|
|
$unique = self::getLockById($id);
|
|
|
@@ -52,7 +52,6 @@ class StatItemClass extends BaseClass
|
|
|
$currentAmount = bcadd($unique->amount, $amount, 2);
|
|
|
$unique->amount = $currentAmount;
|
|
|
|
|
|
-
|
|
|
$unique->save();
|
|
|
StatItemMonthClass::replace($item, $time);
|
|
|
}
|