This commit is contained in:
liufumingren 2026-08-07 00:29:38 +08:00
parent 94fd06c6ab
commit efb69dc45e

View File

@ -94,12 +94,8 @@ abstract class Base
$url = $this->baseUrl . '/warehouse?' . $queryStr; $url = $this->baseUrl . '/warehouse?' . $queryStr;
$bodyJson = json_encode($body, JSON_UNESCAPED_UNICODE); $bodyJson = json_encode($body, JSON_UNESCAPED_UNICODE);
\think\Log::info("[WmsFunc] {$method} 请求: " . json_encode([ // ---- 调试:打印完整请求 ----
'url' => $url, \think\Log::error("[WmsFunc] {$method} 请求\nURL: {$url}\nBody: {$bodyJson}");
'query' => $queryParams,
'body' => $bodyJson,
'sign' => $sign,
], JSON_UNESCAPED_UNICODE));
try { try {
$response = Http::post($url, $bodyJson, [ $response = Http::post($url, $bodyJson, [
@ -113,25 +109,17 @@ abstract class Base
$result = json_decode($response, true); $result = json_decode($response, true);
if ($result === null && json_last_error() !== JSON_ERROR_NONE) { if ($result === null && json_last_error() !== JSON_ERROR_NONE) {
\think\Log::error("[WmsFunc] {$method} 响应解析失败\nURL: {$url}\nBody: {$bodyJson}\nResponse: {$response}"); \think\Log::error("[WmsFunc] {$method} 响应解析失败\nResponse: {$response}");
return [ return ['code' => -1, 'msg' => '响应解析失败', 'data' => null];
'code' => -1,
'msg' => '响应解析失败',
'data' => null,
];
} }
\think\Log::info("[WmsFunc] {$method} 响应: " . json_encode($result, JSON_UNESCAPED_UNICODE)); \think\Log::error("[WmsFunc] {$method} 响应: " . json_encode($result, JSON_UNESCAPED_UNICODE));
return $result; return $result;
} catch (\Exception $e) { } catch (\Exception $e) {
\think\Log::error("[WmsFunc] {$method} 请求异常: " . $e->getMessage() . "\nURL: {$url}\nBody: {$bodyJson}"); \think\Log::error("[WmsFunc] {$method} 请求异常: " . $e->getMessage());
return [ return ['code' => -1, 'msg' => '请求异常: ' . $e->getMessage(), 'data' => null];
'code' => -1,
'msg' => '请求异常: ' . $e->getMessage(),
'data' => null,
];
} }
} }