From 5b0ffa0c152b622997ebdb206b612ebeb894353a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Sun, 28 Apr 2024 15:31:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E5=BF=97=E8=AE=B0=E5=BD=95=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/Business/BusinessClient.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/Services/Business/BusinessClient.php b/app/Services/Business/BusinessClient.php index a28a3f1..314e6ef 100644 --- a/app/Services/Business/BusinessClient.php +++ b/app/Services/Business/BusinessClient.php @@ -152,6 +152,10 @@ abstract class BusinessClient $res = (new Client())->request($method, $url, $headers); $size = $res->getBody()->getSize(); $res = json_decode($res->getBody()->getContents(), true); + $paramsJson = json_encode($params, 256); + if (strlen($paramsJson) > 1024) { + $paramsJson = ''; + } if (!in_array($params['type'], ['pdd.ktt.increment.order.query', 'pdd.ktt.order.list'], true)) { $log = new Log(); $log->module = 'plat'; @@ -161,14 +165,14 @@ abstract class BusinessClient $log->target_field = $params['type']; $log->user_id = Auth::id() ?? 999; if ($size < 48000) { - $log->message = json_encode($res, 256) . '=====' . json_encode($params, 256); + $log->message = json_encode($res, 256) . '=====' . $paramsJson; } else { - $log->message = json_encode($params, 256); + $log->message = $paramsJson; } $log->save(); } if (in_array($params['type'], ['pdd.ktt.increment.order.query', 'pdd.ktt.order.list'], true)) { - LogFile::info('快团团请求: ' . json_encode($params, 256)); + LogFile::info('快团团请求: ' . $paramsJson); LogFile::info('快团团返回: ' . json_encode($res, 256)); }