```
feat(split): 新增分账订单线下结案功能 - 添加 SplitCloseService 类用于处理订单结案逻辑 - 实现订单结案状态检查和标记功能 - 在汇付分账重试逻辑中加入结案状态验证,防止已结案订单继续重试 - 更新分账手动服务,添加结案操作类型 - 扩展钱包结算类,增加结案相关诊断方法 - 修改测试脚本,支持批量标记订单为已结案状态 - 添加数据库升级脚本,增加结案相关字段和菜单权限 ```
这个提交包含在:
@@ -3,7 +3,9 @@
|
||||
namespace addons\shopro_huifu\library;
|
||||
|
||||
use addons\shopro\library\split\SplitCalculator;
|
||||
use addons\shopro\library\split\SplitCloseService;
|
||||
use addons\shopro\library\split\SplitManualService;
|
||||
use addons\shopro\library\split\SplitWalletSettlement;
|
||||
use addons\shopro\library\split\SplitOrderHelper;
|
||||
use addons\shopro\library\split\Config as SplitConfig;
|
||||
use addons\shopro\model\Order;
|
||||
@@ -29,6 +31,16 @@ class HuifuSplitService
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((new SplitCloseService())->isClosed($orderId)) {
|
||||
\think\Log::info('[shopro_huifu] split skipped order_id=' . $orderId . ' reason=closed_offline');
|
||||
return false;
|
||||
}
|
||||
|
||||
$retryBlock = SplitWalletSettlement::getHuifuRetryBlockReason($orderId);
|
||||
if ($retryBlock !== null) {
|
||||
throw new \RuntimeException($retryBlock);
|
||||
}
|
||||
|
||||
$done = SplitOrder::where('order_id', $orderId)->where('channel', 'huifu')->where('status', 2)->find();
|
||||
if ($done) {
|
||||
return true;
|
||||
@@ -150,7 +162,19 @@ class HuifuSplitService
|
||||
if (!$splitOrder || $splitOrder['channel'] !== 'huifu') {
|
||||
return false;
|
||||
}
|
||||
return $this->executeByOrderId((int) $splitOrder['order_id']);
|
||||
if (intval($splitOrder['status']) === SplitCloseService::STATUS_CLOSED) {
|
||||
throw new \RuntimeException('该订单已标记线下结案,不可重试');
|
||||
}
|
||||
if ((new SplitCloseService())->isClosed((int) $splitOrder['order_id'])) {
|
||||
throw new \RuntimeException('该订单已标记线下结案,不可重试');
|
||||
}
|
||||
$orderId = (int) $splitOrder['order_id'];
|
||||
$ok = $this->executeByOrderId($orderId);
|
||||
if ($ok) {
|
||||
$event = (new SplitConfig())->getTiming();
|
||||
SplitWalletSettlement::finalizeAfterSplitAttempt($orderId, $event, true);
|
||||
}
|
||||
return $ok;
|
||||
}
|
||||
|
||||
public function retryByOrderId($orderId)
|
||||
@@ -159,7 +183,11 @@ class HuifuSplitService
|
||||
if ($orderId <= 0) {
|
||||
return false;
|
||||
}
|
||||
return $this->executeByOrderId($orderId);
|
||||
$latest = SplitOrder::where('order_id', $orderId)->where('channel', 'huifu')->order('id', 'desc')->find();
|
||||
if (!$latest) {
|
||||
return $this->executeByOrderId($orderId);
|
||||
}
|
||||
return $this->retry((int) $latest['id']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
在新工单中引用
屏蔽一个用户