@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace addons\shopro\job;
|
||||
|
||||
use think\queue\Job;
|
||||
use think\Db;
|
||||
use think\exception\HttpResponseException;
|
||||
use addons\shopro\service\partner\PartnerRewardService;
|
||||
|
||||
class PartnerSettle extends BaseJob
|
||||
{
|
||||
public function order(Job $job, $payload)
|
||||
{
|
||||
try {
|
||||
$orderId = $payload['order_id'] ?? 0;
|
||||
if ($orderId) {
|
||||
Db::transaction(function () use ($orderId) {
|
||||
(new PartnerRewardService())->settleOrder($orderId);
|
||||
});
|
||||
}
|
||||
$job->delete();
|
||||
} catch (HttpResponseException $e) {
|
||||
$data = $e->getResponse()->getData();
|
||||
$message = $data ? ($data['msg'] ?? '') : $e->getMessage();
|
||||
format_log_error($e, 'PartnerSettle.HttpResponseException', $message);
|
||||
} catch (\Exception $e) {
|
||||
format_log_error($e, 'PartnerSettle');
|
||||
}
|
||||
}
|
||||
}
|
||||
在新工单中引用
屏蔽一个用户