|
|
@@ -39,9 +39,9 @@ class StatKhCgClass extends BaseClass
|
|
|
//客户退款统计
|
|
|
public static function refundReplace($order, $date = null)
|
|
|
{
|
|
|
- $sjId = $order['sjId'] ?? 0;
|
|
|
- $shopId = $order['shopId'] ?? 0;
|
|
|
- $customId = $order['customId'] ?? 0;
|
|
|
+ $sjId = $order->sjId ?? 0;
|
|
|
+ $shopId = $order->shopId ?? 0;
|
|
|
+ $customId = $order->customId ?? 0;
|
|
|
$time = $date == null ? date('Ymd') : $date;
|
|
|
$stat = self::getByCondition(['sjId' => $sjId, 'shopId' => $shopId, 'customId' => $customId, 'time' => $time], true);
|
|
|
if (empty($stat)) {
|
|
|
@@ -50,14 +50,16 @@ class StatKhCgClass extends BaseClass
|
|
|
$id = $stat->id;
|
|
|
$unique = self::getLockById($id);
|
|
|
|
|
|
- $num = $order['itemNum'] ?? 0;
|
|
|
- $unitePrice = $order['itemPrice'] ?? 0;
|
|
|
- $price = bcmul($unitePrice, $num, 2);
|
|
|
+ $num = $order->itemNum ?? 0;
|
|
|
+ $refundPrice = $order->refundPrice ?? 0;
|
|
|
|
|
|
$currentRefundNum = bcadd($unique->refundNum, $num, 2);
|
|
|
- $currentRefundAmount = bcadd($unique->refundAmount, $price, 2);
|
|
|
+
|
|
|
+ $currentRefundAmount = bcadd($unique->refundPrice, $refundPrice, 2);
|
|
|
+
|
|
|
$unique->refundNum = $currentRefundNum;
|
|
|
$unique->refundAmount = $currentRefundAmount;
|
|
|
+
|
|
|
$unique->save();
|
|
|
|
|
|
StatKhCgMonthClass::refundReplace($order, $time);
|