```
feat(shopro_huifu): 添加商户入驻查询日志记录功能 为HuifuOnboardQuery类的pollAndUpdate方法添加详细的错误日志记录, 包括开始轮询、跳过条件判断、申请状态查询和基础信息查询等关键步骤的日志输出, 便于调试和监控商户入驻流程的状态变化。 同时为applyRemoteStatus和isBasicActive方法增加日志记录, 帮助追踪远程状态解析结果和基础状态激活检查的过程。 ```
这个提交包含在:
@@ -16,23 +16,39 @@ class HuifuOnboardQuery
|
||||
|
||||
public function pollAndUpdate(Onboard $row)
|
||||
{
|
||||
\think\Log::error('[shopro_huifu] onboard poll begin file=' . realpath(__FILE__)
|
||||
. ' id=' . $row['id']
|
||||
. ' huifu_id=' . ($row['huifu_id'] ?? '')
|
||||
. ' apply_no=' . ($row['apply_no'] ?? '')
|
||||
. ' busi_req_seq_id=' . ($row['busi_req_seq_id'] ?? '')
|
||||
. ' status=' . ($row['onboard_status'] ?? ''));
|
||||
|
||||
if (!$row['huifu_id']) {
|
||||
\think\Log::error('[shopro_huifu] onboard poll skipped: missing huifu_id id=' . $row['id']);
|
||||
return $row;
|
||||
}
|
||||
if ($row['onboard_status'] === Onboard::STATUS_APPROVED) {
|
||||
\think\Log::error('[shopro_huifu] onboard poll skipped: already approved id=' . $row['id']);
|
||||
return $row;
|
||||
}
|
||||
|
||||
$applyNo = $row['apply_no'];
|
||||
if ($applyNo) {
|
||||
$status = $this->queryApply($row['huifu_id'], $applyNo);
|
||||
\think\Log::error('[shopro_huifu] onboard apply query id=' . $row['id']
|
||||
. ' apply_no=' . $applyNo
|
||||
. ' data=' . json_encode($status, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES));
|
||||
$row = $this->applyRemoteStatus($row, $status);
|
||||
if ($row['onboard_status'] === Onboard::STATUS_APPROVED) {
|
||||
return $row;
|
||||
}
|
||||
} else {
|
||||
\think\Log::error('[shopro_huifu] onboard apply query skipped: empty apply_no id=' . $row['id']);
|
||||
}
|
||||
|
||||
$basic = $this->queryBasic($row['huifu_id']);
|
||||
\think\Log::error('[shopro_huifu] onboard basic query id=' . $row['id']
|
||||
. ' data=' . json_encode($basic, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES));
|
||||
if ($this->isBasicActive($basic)) {
|
||||
if (in_array($row['onboard_status'], [Onboard::STATUS_BUSI_PENDING, Onboard::STATUS_BASIC_OK], true)) {
|
||||
$row->onboard_status = Onboard::STATUS_APPROVED;
|
||||
@@ -76,11 +92,17 @@ class HuifuOnboardQuery
|
||||
protected function applyRemoteStatus(Onboard $row, array $data)
|
||||
{
|
||||
if (!$data) {
|
||||
\think\Log::error('[shopro_huifu] onboard remote status empty id=' . $row['id']);
|
||||
return $row;
|
||||
}
|
||||
$stat = strtolower((string) ($data['apply_status'] ?? $data['audit_status'] ?? $data['status'] ?? ''));
|
||||
$desc = (string) ($data['apply_desc'] ?? $data['resp_desc'] ?? $data['reject_reason'] ?? '');
|
||||
|
||||
\think\Log::error('[shopro_huifu] onboard remote status parsed id=' . $row['id']
|
||||
. ' stat=' . $stat
|
||||
. ' desc=' . $desc
|
||||
. ' keys=' . implode(',', array_keys($data)));
|
||||
|
||||
if (in_array($stat, ['s', 'success', 'approved', '1', '02', '2'], true)) {
|
||||
$row->onboard_status = Onboard::STATUS_APPROVED;
|
||||
$row->reject_reason = '';
|
||||
@@ -106,9 +128,14 @@ class HuifuOnboardQuery
|
||||
protected function isBasicActive(array $data)
|
||||
{
|
||||
if (!$data) {
|
||||
\think\Log::error('[shopro_huifu] onboard basic active check: empty response');
|
||||
return false;
|
||||
}
|
||||
$stat = strtolower((string) ($data['user_status'] ?? $data['status'] ?? $data['acct_stat'] ?? ''));
|
||||
return in_array($stat, ['n', 'normal', 's', 'success', '1'], true);
|
||||
$active = in_array($stat, ['n', 'normal', 's', 'success', '1'], true);
|
||||
\think\Log::error('[shopro_huifu] onboard basic active check stat=' . $stat
|
||||
. ' active=' . ($active ? '1' : '0')
|
||||
. ' keys=' . implode(',', array_keys($data)));
|
||||
return $active;
|
||||
}
|
||||
}
|
||||
|
||||
在新工单中引用
屏蔽一个用户