调整商户采购金额写入

This commit is contained in:
luofei 2024-02-28 16:17:17 +08:00
parent 5abee67569
commit 4b9c717ec6
2 changed files with 6 additions and 1 deletions

View File

@ -591,6 +591,11 @@ class MerchantRepository extends BaseRepository
if ($money > 0) {
//订单确认收货,增加商户销售金额
Merchant::where('mer_id', $bill->mer_id)->update(['sale_amount' => Db::raw('sale_amount+' . $money)]);
//订单确认收货,增加商户采购金额
$merId = Merchant::where('uid', $bill->uid)->value('mer_id');
if (!empty($merId)) {
Merchant::where('mer_id', $merId)->update(['purchase_amount' => Db::raw('purchase_amount+' . $money)]);
}
app()->make(UserBillRepository::class)->incBill($bill->uid, 'mer_computed_money', 'order', [
'link_id' => $order->order_id,
'mer_id' => $bill->mer_id,

View File

@ -16,7 +16,7 @@ class OrderDeliveryListen implements ListenerInterface
{
$order = $event['order'];
foreach ($order->orderProduct as $orderProduct) {
$merchantCate = $orderProduct->product->merCateId;
$merchantCate = $orderProduct->product->merCateId->toArray();
if (empty($merchantCate) || $merchantCate[0]['mer_cate_id'] != env('PLATFORM_CARD_CATE_ID')) {
continue;
}