feat(shopro_huifu): 完善商户入网状态检查逻辑

- 新增响应码验证机制,支持通过resp_code判断业务状态
- 增加结算配置和现金配置的状态检测功能
- 实现多维度激活状态判断,包括基础状态、结算状态和现金状态
- 添加JSON对象和数组的安全解析方法
- 扩展日志记录,包含更多调试信息用于问题排查
```
这个提交包含在:
可乐加冰
2026-09-30 15:02:44 +08:00
父节点 8d97769ea8
当前提交 d943c98940

查看文件

@@ -132,10 +132,43 @@ class HuifuOnboardQuery
return false;
}
$stat = strtolower((string) ($data['user_status'] ?? $data['status'] ?? $data['acct_stat'] ?? ''));
$active = in_array($stat, ['n', 'normal', 's', 'success', '1'], true);
$respCode = (string) ($data['resp_code'] ?? '');
$settleConfig = $this->decodeJsonObject($data['settle_config'] ?? null);
$cashConfigList = $this->decodeJsonList($data['qry_cash_config_list'] ?? null);
$settleActive = (string) ($settleConfig['settle_status'] ?? '') === '1';
$cashActive = false;
foreach ($cashConfigList as $cashConfig) {
if ((string) ($cashConfig['switch_state'] ?? '') === '1') {
$cashActive = true;
break;
}
}
$active = in_array($stat, ['n', 'normal', 's', 'success', '1'], true)
|| ($respCode === '00000000' && ($settleActive || $cashActive));
\think\Log::error('[shopro_huifu] onboard basic active check stat=' . $stat
. ' resp_code=' . $respCode
. ' settle_active=' . ($settleActive ? '1' : '0')
. ' cash_active=' . ($cashActive ? '1' : '0')
. ' active=' . ($active ? '1' : '0')
. ' keys=' . implode(',', array_keys($data)));
return $active;
}
protected function decodeJsonObject($value)
{
if (is_array($value)) {
return $value;
}
$decoded = json_decode((string) $value, true);
return is_array($decoded) ? $decoded : [];
}
protected function decodeJsonList($value)
{
$decoded = $this->decodeJsonObject($value);
if (isset($decoded[0]) && is_array($decoded[0])) {
return $decoded;
}
return [];
}
}