order-profit:send 仅限微信分账订单
parent
11b6e0c1b8
commit
5227b83ac6
|
|
@ -54,6 +54,8 @@ class OrderProfitCommand extends Command
|
||||||
->where('completed_at', '<', now()->subDays($saleDays))
|
->where('completed_at', '<', now()->subDays($saleDays))
|
||||||
// 未支付提成
|
// 未支付提成
|
||||||
->whereNull('profit_paid')
|
->whereNull('profit_paid')
|
||||||
|
// 微信分账订单
|
||||||
|
->orderBy('wx_share->status', 'Y')
|
||||||
->limit(10)
|
->limit(10)
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
|
|
@ -61,10 +63,9 @@ class OrderProfitCommand extends Command
|
||||||
try {
|
try {
|
||||||
DB::beginTransaction();
|
DB::beginTransaction();
|
||||||
$service->wechatShare($order);
|
$service->wechatShare($order);
|
||||||
// 分账成功, 更新订单状态
|
|
||||||
$order->update(['profit_paid' => $now]);
|
|
||||||
DB::commit();
|
DB::commit();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
logger('app/Console/Commands/OrderProfitCommand error');
|
||||||
DB::rollBack();
|
DB::rollBack();
|
||||||
report($e);
|
report($e);
|
||||||
$this->error($e->getMessage());
|
$this->error($e->getMessage());
|
||||||
|
|
|
||||||
|
|
@ -251,7 +251,10 @@ class DistributeService
|
||||||
}
|
}
|
||||||
if ($status == 'FINISHED') {
|
if ($status == 'FINISHED') {
|
||||||
$attributes = ['share_sn' => $sn, 'status' => 'N'];
|
$attributes = ['share_sn' => $sn, 'status' => 'N'];
|
||||||
$order->update(['wx_share' => $order->wx_share ? array_merge($order->wx_share, $attributes) : $attributes]);
|
$order->update([
|
||||||
|
'wx_share' => $order->wx_share ? array_merge($order->wx_share, $attributes) : $attributes,
|
||||||
|
'profit_paid' => now(),
|
||||||
|
]);
|
||||||
$this->success($list, $result);
|
$this->success($list, $result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue