|
|
@@ -51,26 +51,21 @@ class StatYjClass extends BaseClass
|
|
|
}
|
|
|
|
|
|
//增加业绩 ssh 2021.3.20
|
|
|
- public static function addYj($order, $date = null)
|
|
|
+ public static function addYj($main, $shop, $shopAdminId, $amount, $date = null)
|
|
|
{
|
|
|
- $shopAdminId = $order->shopAdminId ?? 0;
|
|
|
- if (empty($shopAdminId)) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- $admin = ShopAdminClass::getById($shopAdminId);
|
|
|
- $sjId = $admin['sjId'] ?? 0;
|
|
|
- $shopId = $admin['shopId'] ?? 0;
|
|
|
+ $sjId = $shop->sjId ?? 0;
|
|
|
+ $mainId = $main->id ?? 0;
|
|
|
$date = isset($date) ? $date : date("Ymd");
|
|
|
- $stat = self::getByCondition(['shopAdminId' => $shopAdminId, 'time' => $date], true);
|
|
|
+ $stat = self::getByCondition(['shopAdminId' => $shopAdminId, 'mainId' => $mainId, 'sjId' => $sjId, 'time' => $date], true);
|
|
|
if (empty($stat)) {
|
|
|
- $stat = self::add(['sjId' => $sjId, 'shopId' => $shopId, 'shopAdminId' => $shopAdminId, 'time' => $date], true);
|
|
|
+ $stat = self::add(['sjId' => $sjId, 'shopAdminId' => $shopAdminId, 'mainId' => $mainId, 'time' => $date], true);
|
|
|
}
|
|
|
$stat->num += 1;
|
|
|
$stat->totalNum += 1;
|
|
|
- $stat->amount = bcadd($order->actPrice, $stat->amount, 2);
|
|
|
- $stat->totalAmount = bcadd($order->actPrice, $stat->totalAmount, 2);
|
|
|
+ $stat->amount = bcadd($amount, $stat->amount, 2);
|
|
|
+ $stat->totalAmount = bcadd($amount, $stat->totalAmount, 2);
|
|
|
$stat->save();
|
|
|
- StatYjMonthClass::addYj($order);
|
|
|
+ StatYjMonthClass::addYj($main, $shop, $shopAdminId, $amount);
|
|
|
}
|
|
|
|
|
|
}
|