```
feat(shopro/split): 优化汇付分账查询功能 - 重构汇付渠道状态查询逻辑,新增 queryHuifuChannelStatus 方法处理支付查单和分账查询 - 支持未 confirm 时使用支付查单,有 confirm_hf_seq_id 时查询分账结果 - 优化异常处理机制,区分 HttpResponseException 和其他异常类型 - 改进前端显示逻辑,根据返回数据类型展示更详细的查询结果信息 - 增强错误提示和用户体验,提供更精确的反馈信息 ```
这个提交包含在:
@@ -225,8 +225,7 @@ class Order extends Base
|
||||
}
|
||||
try {
|
||||
if (($row['channel'] ?? 'wechat') === 'huifu' && class_exists('\\addons\\shopro_huifu\\library\\HuifuSplitService')) {
|
||||
$service = new \addons\shopro_huifu\library\HuifuSplitService();
|
||||
$result = $service->querySplit($row['transaction_id']);
|
||||
$result = $this->queryHuifuChannelStatus($row);
|
||||
} elseif ((new SplitConfig())->isHuifuMode()) {
|
||||
$this->error('当前为汇付分账,请对 channel=huifu 的分账记录查询,或到汇付控台查看分账结果');
|
||||
} else {
|
||||
@@ -236,11 +235,34 @@ class Order extends Base
|
||||
'transaction_id' => $row['transaction_id'],
|
||||
]);
|
||||
}
|
||||
$row->wx_result = json_encode($result, JSON_UNESCAPED_UNICODE);
|
||||
$row->save();
|
||||
$this->success('查询成功', null, $result);
|
||||
} catch (\Exception $e) {
|
||||
$this->error($e->getMessage());
|
||||
} catch (\think\exception\HttpResponseException $e) {
|
||||
throw $e;
|
||||
} catch (\Throwable $e) {
|
||||
$this->error('查询失败:' . ($e->getMessage() ?: '未知错误'));
|
||||
}
|
||||
|
||||
$row->wx_result = json_encode($result, JSON_UNESCAPED_UNICODE);
|
||||
$row->save();
|
||||
$this->success('查询成功', null, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 汇付:未 confirm 成功时用支付查单;已有 confirm_hf_seq_id 时再查分账结果
|
||||
*/
|
||||
protected function queryHuifuChannelStatus($row)
|
||||
{
|
||||
$payload = [];
|
||||
if (class_exists('\\addons\\shopro_huifu\\library\\HuifuQueryService')) {
|
||||
$payload['pay_query'] = (new \addons\shopro_huifu\library\HuifuQueryService())->queryByOrderSn($row['order_sn']);
|
||||
}
|
||||
$confirmSeq = trim((string) ($row['confirm_hf_seq_id'] ?? ''));
|
||||
if ($confirmSeq !== '') {
|
||||
$service = new \addons\shopro_huifu\library\HuifuSplitService();
|
||||
$payload['split_query'] = $service->querySplit($confirmSeq);
|
||||
}
|
||||
if (empty($payload)) {
|
||||
throw new \RuntimeException('汇付查询组件不可用');
|
||||
}
|
||||
return $payload;
|
||||
}
|
||||
}
|
||||
|
||||
在新工单中引用
屏蔽一个用户