user) { Db::transaction(function () use ($agent) { $agent->runAgentUpgradePlan(); }); } $job->delete(); } catch (HttpResponseException $e) { $data = $e->getResponse()->getData(); $message = $data ? ($data['msg'] ?? '') : $e->getMessage(); format_log_error($e, 'AgentUpgrade.HttpResponseException', $message); } catch (\Exception $e) { format_log_error($e, 'AgentUpgrade'); } } /** * 分销商升级 (新) */ public function createAsyncAgentUpgradeNew(Job $job, $payload) { try { $userId = $payload['user_id']; $order = $payload['order']; $agentScore = new CommissionScoreLog($userId); if ($agentScore->user) { Db::transaction(function () use ($agentScore, $order) { $agentScore->runAgentUpgradePlan($order); }); } $job->delete(); }catch (HttpResponseException $e) { $data = $e->getResponse()->getData(); $message = $data ? ($data['msg'] ?? '') : $e->getMessage(); format_log_error($e, 'AgentUpgradeNew.HttpResponseException', $message); } catch (\Exception $e) { format_log_error($e, 'AgentUpgradeNew'); } } /** * 分销积分结算佣金 */ public function createAsyncAgentScoreSettlePlan(Job $job, $payload) { try { $userId = $payload['user_id']; $order = $payload['order']; $agentScore = new CommissionScoreLog($userId); if ($agentScore->user) { Db::transaction(function () use ($agentScore, $order) { $agentScore->agentScoreSettlePlan($order); }); } $job->delete(); }catch (HttpResponseException $e) { $data = $e->getResponse()->getData(); $message = $data ? ($data['msg'] ?? '') : $e->getMessage(); format_log_error($e, 'agentScoreSettle.HttpResponseException', $message); } catch (\Exception $e) { format_log_error($e, 'agentScoreSettle'); } } }