From d943c9894034b6b133e0572d40baa51f0119f6fe 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: Wed, 30 Sep 2026 15:02:44 +0800 Subject: [PATCH] =?UTF-8?q?```=20feat(shopro=5Fhuifu):=20=E5=AE=8C?= =?UTF-8?q?=E5=96=84=E5=95=86=E6=88=B7=E5=85=A5=E7=BD=91=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增响应码验证机制,支持通过resp_code判断业务状态 - 增加结算配置和现金配置的状态检测功能 - 实现多维度激活状态判断,包括基础状态、结算状态和现金状态 - 添加JSON对象和数组的安全解析方法 - 扩展日志记录,包含更多调试信息用于问题排查 ``` --- .../library/onboard/HuifuOnboardQuery.php | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/addons/shopro_huifu/library/onboard/HuifuOnboardQuery.php b/addons/shopro_huifu/library/onboard/HuifuOnboardQuery.php index 8bc83e1..2a2b105 100644 --- a/addons/shopro_huifu/library/onboard/HuifuOnboardQuery.php +++ b/addons/shopro_huifu/library/onboard/HuifuOnboardQuery.php @@ -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 []; + } }