1
This commit is contained in:
parent
94fd06c6ab
commit
efb69dc45e
@ -94,12 +94,8 @@ abstract class Base
|
||||
$url = $this->baseUrl . '/warehouse?' . $queryStr;
|
||||
$bodyJson = json_encode($body, JSON_UNESCAPED_UNICODE);
|
||||
|
||||
\think\Log::info("[WmsFunc] {$method} 请求: " . json_encode([
|
||||
'url' => $url,
|
||||
'query' => $queryParams,
|
||||
'body' => $bodyJson,
|
||||
'sign' => $sign,
|
||||
], JSON_UNESCAPED_UNICODE));
|
||||
// ---- 调试:打印完整请求 ----
|
||||
\think\Log::error("[WmsFunc] {$method} 请求\nURL: {$url}\nBody: {$bodyJson}");
|
||||
|
||||
try {
|
||||
$response = Http::post($url, $bodyJson, [
|
||||
@ -113,25 +109,17 @@ abstract class Base
|
||||
$result = json_decode($response, true);
|
||||
|
||||
if ($result === null && json_last_error() !== JSON_ERROR_NONE) {
|
||||
\think\Log::error("[WmsFunc] {$method} 响应解析失败\nURL: {$url}\nBody: {$bodyJson}\nResponse: {$response}");
|
||||
return [
|
||||
'code' => -1,
|
||||
'msg' => '响应解析失败',
|
||||
'data' => null,
|
||||
];
|
||||
\think\Log::error("[WmsFunc] {$method} 响应解析失败\nResponse: {$response}");
|
||||
return ['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;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
\think\Log::error("[WmsFunc] {$method} 请求异常: " . $e->getMessage() . "\nURL: {$url}\nBody: {$bodyJson}");
|
||||
return [
|
||||
'code' => -1,
|
||||
'msg' => '请求异常: ' . $e->getMessage(),
|
||||
'data' => null,
|
||||
];
|
||||
\think\Log::error("[WmsFunc] {$method} 请求异常: " . $e->getMessage());
|
||||
return ['code' => -1, 'msg' => '请求异常: ' . $e->getMessage(), 'data' => null];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user