feat(wallet): 用户提交时直连汇付API优化流程

- 移除数据库事务包装汇付API调用,避免长耗时锁表问题
- 用户提交申请时直接连接汇付服务,不再仅保存草稿等待后台处理
- 修改汇付重提交方法名为resubmit以明确区分不同操作
- 更新异常处理机制,增加Throwable捕获确保错误正确处理
- 调整提交成功后的消息提示内容,准确反映当前处理状态

fix(agent): 代理申请流程汇付集成优化

- 统一汇付进件提交失败的消息提示文本
- 优化代理申请状态判断逻辑,根据汇付载荷存在性决定提交方式
- 更新区域代理申请成功提示,区分已提交汇付和待提交场景
- 修复业务审核通过后的汇付提交触发机制

docs(huifu): 更新汇付进件相关文档说明

- 修改后台管理界面描述,体现用户直连汇付的新流程
- 更新业务审核状态下的操作指引说明
- 调整汇付网关类的方法注释,明确各方法职责变化
- 修正canSaveHuifuDraft方法注释,说明字段兼容性和新功能
```
这个提交包含在:
可乐加冰
2026-10-08 21:03:04 +08:00
父节点 bf1f525545
当前提交 fec4d58e41
共有 9 个文件被更改,包括 46 次插入 和 31 次删除

查看文件

@@ -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));
}

查看文件

@@ -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);

查看文件

@@ -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',