From fec4d58e417f98e552f89f26381f6dd0a1869b0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=AF=E4=B9=90=E5=8A=A0=E5=86=B0?= <11869599+addie66@user.noreply.gitee.com> Date: Thu, 8 Oct 2026 21:03:04 +0800 Subject: [PATCH] =?UTF-8?q?```=20feat(wallet):=20=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=97=B6=E7=9B=B4=E8=BF=9E=E6=B1=87=E4=BB=98?= =?UTF-8?q?API=E4=BC=98=E5=8C=96=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除数据库事务包装汇付API调用,避免长耗时锁表问题 - 用户提交申请时直接连接汇付服务,不再仅保存草稿等待后台处理 - 修改汇付重提交方法名为resubmit以明确区分不同操作 - 更新异常处理机制,增加Throwable捕获确保错误正确处理 - 调整提交成功后的消息提示内容,准确反映当前处理状态 fix(agent): 代理申请流程汇付集成优化 - 统一汇付进件提交失败的消息提示文本 - 优化代理申请状态判断逻辑,根据汇付载荷存在性决定提交方式 - 更新区域代理申请成功提示,区分已提交汇付和待提交场景 - 修复业务审核通过后的汇付提交触发机制 docs(huifu): 更新汇付进件相关文档说明 - 修改后台管理界面描述,体现用户直连汇付的新流程 - 更新业务审核状态下的操作指引说明 - 调整汇付网关类的方法注释,明确各方法职责变化 - 修正canSaveHuifuDraft方法注释,说明字段兼容性和新功能 ``` --- addons/shopro/controller/UserWalletApply.php | 31 +++++++++++-------- addons/shopro/controller/commission/Agent.php | 8 ++--- .../controller/regional_agent/Agent.php | 9 ++++-- .../view/shopro_huifu/onboard/index.html | 4 +-- .../library/onboard/HuifuOnboardGate.php | 11 ++++--- .../library/onboard/HuifuOnboardService.php | 2 +- .../listener/CommissionApplyHook.php | 5 +-- .../listener/RegionalAgentApplyHook.php | 3 +- .../view/shopro_huifu/onboard/index.html | 4 +-- 9 files changed, 46 insertions(+), 31 deletions(-) diff --git a/addons/shopro/controller/UserWalletApply.php b/addons/shopro/controller/UserWalletApply.php index 72b7b04..f79ca10 100644 --- a/addons/shopro/controller/UserWalletApply.php +++ b/addons/shopro/controller/UserWalletApply.php @@ -105,19 +105,19 @@ class UserWalletApply extends Base $resubmit = false; try { - \think\Db::transaction(function () use ($bindings, $userId, $form, $service, &$did, &$resubmit) { - foreach ($bindings as $binding) { - $huifu = $binding['huifu_onboard']; - if (!empty($huifu['can_submit'])) { - $service->submit($userId, $binding['role_type'], $binding['role_ref_id'], $form); - $did = true; - $resubmit = true; - } elseif (!empty($huifu['can_save_draft'])) { - $service->saveDraft($userId, $binding['role_type'], $binding['role_ref_id'], $form); - $did = true; - } + // 汇付 API 不放在 DB 事务内,避免长耗时锁表 + foreach ($bindings as $binding) { + $huifu = $binding['huifu_onboard']; + if (!empty($huifu['can_submit'])) { + $service->resubmit($userId, $binding['role_type'], $binding['role_ref_id'], $form); + $did = true; + $resubmit = true; + } elseif (!empty($huifu['can_save_draft'])) { + // 用户提交即直连汇付(不再只存 draft 等后台/定时任务) + $service->submit($userId, $binding['role_type'], $binding['role_ref_id'], $form); + $did = true; } - }); + } } catch (\InvalidArgumentException $e) { $this->error($e->getMessage()); } catch (\RuntimeException $e) { @@ -125,6 +125,11 @@ class UserWalletApply extends Base ? \addons\shopro_huifu\library\onboard\HuifuOnboardError::translate($e->getMessage()) : $e->getMessage(); $this->error($msg); + } catch (\Throwable $e) { + $msg = class_exists('\\addons\\shopro_huifu\\library\\onboard\\HuifuOnboardError') + ? \addons\shopro_huifu\library\onboard\HuifuOnboardError::translate($e->getMessage()) + : $e->getMessage(); + $this->error($msg ?: '提交汇付进件失败'); } if (!$did) { @@ -133,7 +138,7 @@ class UserWalletApply extends Base $msg = $resubmit ? '汇付进件已重新提交,请耐心等待审核' - : '进件资料已提交,请等待后台审核;审核通过后将自动提交汇付'; + : '已提交汇付进件,请耐心等待审核'; $this->success($msg, $this->resolveWalletOnboard($userId)); } diff --git a/addons/shopro/controller/commission/Agent.php b/addons/shopro/controller/commission/Agent.php index 5bb0ab6..777f176 100644 --- a/addons/shopro/controller/commission/Agent.php +++ b/addons/shopro/controller/commission/Agent.php @@ -289,7 +289,7 @@ class Agent extends Commission try { \think\Hook::listen('shopro_commission_apply_after', $hookParams); } catch (\Throwable $e) { - $failMsg = $huifuResubmit ? '汇付进件提交失败' : '进件资料保存失败'; + $failMsg = '汇付进件提交失败'; $this->error($e->getMessage() ?: $failMsg); } } @@ -297,13 +297,13 @@ class Agent extends Commission if ($huifuResubmit) { $msg = '汇付进件已重新提交,请耐心等待审核'; - } elseif ($canSaveHuifuDraft && !$applyStatus) { - $msg = '进件资料已保存,请等待后台审核;审核通过后将自动提交汇付'; + } elseif (!empty($huifuPayload)) { + $msg = '申请已提交,汇付进件已同步提交,请耐心等待审核'; } else { $msg = '申请已提交,请等待后台审核'; if (class_exists('\\addons\\shopro_huifu\\library\\onboard\\HuifuOnboardGate') && \addons\shopro_huifu\library\onboard\HuifuOnboardGate::isOnboardRequired()) { - $msg = '申请已提交,请等待后台审核;审核通过后请到「提现」页绑定进件资料'; + $msg = '申请已提交,请等待后台审核;通过后请到「提现」页完成汇付进件'; } } $this->success($msg, null); diff --git a/addons/shopro/controller/regional_agent/Agent.php b/addons/shopro/controller/regional_agent/Agent.php index ab14944..66a3c0a 100644 --- a/addons/shopro/controller/regional_agent/Agent.php +++ b/addons/shopro/controller/regional_agent/Agent.php @@ -119,11 +119,16 @@ class Agent extends RegionalAgent if ($status === AgentModel::STATUS_PENDING) { $msg = $huifuRequired - ? '申请已提交,请等待后台审核;审核通过后请到「提现」页绑定进件资料' + ? (!empty($huifuOnboard) + ? '申请已提交,汇付进件已同步提交,请耐心等待审核' + : '申请已提交,请等待后台审核;通过后请到「提现」页完成汇付进件') : '申请已提交,请等待后台审核'; } else { $msg = '申请已通过,您已成为该区域公司'; - if ($huifuRequired && class_exists('\\addons\\shopro_huifu\\library\\onboard\\HuifuOnboardGate')) { + if ($huifuRequired && !empty($huifuOnboard)) { + $msg = '申请已通过,汇付进件已同步提交,请耐心等待审核'; + } elseif ($huifuRequired && class_exists('\\addons\\shopro_huifu\\library\\onboard\\HuifuOnboardGate')) { + // 无随申请提交资料时,兜底尝试提交历史 draft \addons\shopro_huifu\library\onboard\HuifuOnboardGate::submitOnBusinessApproved( $userId, 'regional_agent', diff --git a/addons/shopro_huifu/application/admin/view/shopro_huifu/onboard/index.html b/addons/shopro_huifu/application/admin/view/shopro_huifu/onboard/index.html index aa31cae..81d52d7 100644 --- a/addons/shopro_huifu/application/admin/view/shopro_huifu/onboard/index.html +++ b/addons/shopro_huifu/application/admin/view/shopro_huifu/onboard/index.html @@ -21,7 +21,7 @@