调整商户采购金额写入
This commit is contained in:
parent
4fdd1d1e7c
commit
52d6cb27ad
@ -786,6 +786,18 @@ class StoreOrderRepository extends BaseRepository
|
|||||||
$order->interest->save();
|
$order->interest->save();
|
||||||
}
|
}
|
||||||
$order->save();
|
$order->save();
|
||||||
|
|
||||||
|
if ($order->uid != $order->merchant->uid) {
|
||||||
|
$refundPrice = StoreRefundOrder::where('order_id', $order['order_id'])->where('status', '<>', -1)->sum('refund_price');
|
||||||
|
$money = bcsub($order->pay_price, $refundPrice, 2);
|
||||||
|
//订单确认收货,增加商户销售金额
|
||||||
|
Merchant::where('mer_id', $order->mer_id)->update(['sale_amount' => Db::raw('sale_amount+' . $money)]);
|
||||||
|
//订单确认收货,增加商户采购金额
|
||||||
|
$merId = Merchant::where('uid', $order->uid)->value('mer_id');
|
||||||
|
if (!empty($merId)) {
|
||||||
|
Merchant::where('mer_id', $merId)->update(['purchase_amount' => Db::raw('purchase_amount+' . $money)]);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -589,13 +589,6 @@ class MerchantRepository extends BaseRepository
|
|||||||
$bill->save();
|
$bill->save();
|
||||||
}
|
}
|
||||||
if ($money > 0) {
|
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', [
|
app()->make(UserBillRepository::class)->incBill($bill->uid, 'mer_computed_money', 'order', [
|
||||||
'link_id' => $order->order_id,
|
'link_id' => $order->order_id,
|
||||||
'mer_id' => $bill->mer_id,
|
'mer_id' => $bill->mer_id,
|
||||||
|
@ -15,7 +15,8 @@ class SendSubsidyCouponListen extends TimerService implements ListenerInterface
|
|||||||
|
|
||||||
public function handle($event): void
|
public function handle($event): void
|
||||||
{
|
{
|
||||||
$this->tick(1000 * 60 * 20, function () {
|
//TODO 上线后改成30分钟
|
||||||
|
$this->tick(1000 * 60 * 1, function () {
|
||||||
Log::info('定时任务:发放商户采购补贴券');
|
Log::info('定时任务:发放商户采购补贴券');
|
||||||
try {
|
try {
|
||||||
$consumption = StoreConsumption::where('type', StoreConsumption::TYPE_SALE_SUBSIDY)->find();
|
$consumption = StoreConsumption::where('type', StoreConsumption::TYPE_SALE_SUBSIDY)->find();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user