调整商户采购金额写入
This commit is contained in:
parent
4fdd1d1e7c
commit
52d6cb27ad
@ -786,6 +786,18 @@ class StoreOrderRepository extends BaseRepository
|
||||
$order->interest->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)]);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -270,7 +270,7 @@ class MerchantRepository extends BaseRepository
|
||||
$margin = app()->make(MerchantTypeRepository::class)->get($data['type_id']);
|
||||
$data['is_margin'] = $margin['is_margin'] ?? -1;
|
||||
$data['margin'] = $margin['margin'] ?? 0;
|
||||
|
||||
|
||||
return Db::transaction(function () use ($data, $make) {
|
||||
$account = $data['mer_account'];
|
||||
$password = $data['mer_password'];
|
||||
@ -589,13 +589,6 @@ class MerchantRepository extends BaseRepository
|
||||
$bill->save();
|
||||
}
|
||||
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,
|
||||
|
@ -15,7 +15,8 @@ class SendSubsidyCouponListen extends TimerService implements ListenerInterface
|
||||
|
||||
public function handle($event): void
|
||||
{
|
||||
$this->tick(1000 * 60 * 20, function () {
|
||||
//TODO 上线后改成30分钟
|
||||
$this->tick(1000 * 60 * 1, function () {
|
||||
Log::info('定时任务:发放商户采购补贴券');
|
||||
try {
|
||||
$consumption = StoreConsumption::where('type', StoreConsumption::TYPE_SALE_SUBSIDY)->find();
|
||||
|
Loading…
x
Reference in New Issue
Block a user