42 lines
1.2 KiB
PHP
42 lines
1.2 KiB
PHP
<?php
|
|
/**
|
|
* SaaSMall商城系统 - 团队十年电商经验汇集巨献!
|
|
* =========================================================
|
|
* Copy right 2019-2029 成都SAAS云科技有限公司, 保留所有权利。
|
|
* ----------------------------------------------
|
|
* 官方网址: https://www.gobuysaas.com
|
|
* =========================================================
|
|
*/
|
|
|
|
namespace addon\commission\event;
|
|
|
|
|
|
use addon\commission\job\AccountSettlementJob;
|
|
use think\Exception;
|
|
use think\facade\Queue;
|
|
|
|
class OrderComplete{
|
|
// 订单完成
|
|
public function handle($data){
|
|
// trace($data, '平台抽成 - 订单完成');
|
|
try{
|
|
$orderId = $data['order_id'] ?? 0;
|
|
// 分配豆豆解冻
|
|
model('commission_legumes_log')->update(['status'=>1],[
|
|
['order_id', '=', $orderId]
|
|
]);
|
|
// 结算当前订单的 招商员佣金、推广员佣金
|
|
Queue::push(AccountSettlementJob::class,[
|
|
'order_id' => (int)$orderId,
|
|
'account_type' => 'merchants_promoter',
|
|
]);
|
|
|
|
}catch(Exception $e){
|
|
trace($e->getMessage(), '平台抽成 - 订单完成 - 错误');
|
|
}
|
|
|
|
return success();
|
|
}
|
|
|
|
|
|
} |