日志记录优化
This commit is contained in:
parent
4e7f17091f
commit
5b0ffa0c15
@ -152,6 +152,10 @@ abstract class BusinessClient
|
|||||||
$res = (new Client())->request($method, $url, $headers);
|
$res = (new Client())->request($method, $url, $headers);
|
||||||
$size = $res->getBody()->getSize();
|
$size = $res->getBody()->getSize();
|
||||||
$res = json_decode($res->getBody()->getContents(), true);
|
$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)) {
|
if (!in_array($params['type'], ['pdd.ktt.increment.order.query', 'pdd.ktt.order.list'], true)) {
|
||||||
$log = new Log();
|
$log = new Log();
|
||||||
$log->module = 'plat';
|
$log->module = 'plat';
|
||||||
@ -161,14 +165,14 @@ abstract class BusinessClient
|
|||||||
$log->target_field = $params['type'];
|
$log->target_field = $params['type'];
|
||||||
$log->user_id = Auth::id() ?? 999;
|
$log->user_id = Auth::id() ?? 999;
|
||||||
if ($size < 48000) {
|
if ($size < 48000) {
|
||||||
$log->message = json_encode($res, 256) . '=====' . json_encode($params, 256);
|
$log->message = json_encode($res, 256) . '=====' . $paramsJson;
|
||||||
} else {
|
} else {
|
||||||
$log->message = json_encode($params, 256);
|
$log->message = $paramsJson;
|
||||||
}
|
}
|
||||||
$log->save();
|
$log->save();
|
||||||
}
|
}
|
||||||
if (in_array($params['type'], ['pdd.ktt.increment.order.query', 'pdd.ktt.order.list'], true)) {
|
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));
|
LogFile::info('快团团返回: ' . json_encode($res, 256));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user