!28 订单获取日志记录修改

Merge pull request !28 from develop
This commit is contained in:
赵世界 2022-08-18 06:32:25 +00:00 committed by Gitee
commit d5ba45bad2
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 12 additions and 14 deletions

View File

@ -48,7 +48,7 @@ class Swoole extends Command
$endTime = DateTimeUtils::getMicroTime();
$beginTime = $endTime - 10000;
foreach ($shops as $shop) {
BusinessFactory::init()->make($shop->plat_id)->setShop($shop)->downloadOrdersAndSave($beginTime, $endTime, 'increment', 1);
BusinessFactory::init()->make($shop->plat_id)->setShop($shop)->downloadOrdersAndSave($beginTime, $endTime, 'increment');
}
});
Event::wait();

View File

@ -139,11 +139,8 @@ abstract class BusinessClient
$res = (new Client())->request($method, $url, $headers);
$size = $res->getBody()->getSize();
$res = json_decode($res->getBody()->getContents(), true);
if ('pdd.ktt.increment.order.query' === $params['type']) {
$log = Log::query()->where('user_id', $this->getShop()->id)->where('target_field', $params['type'])->first();
} else {
if (!in_array($params['type'], ['pdd.ktt.increment.order.query', 'pdd.ktt.order.list'], true)) {
$log = new Log();
}
$log->module = 'plat';
$log->action = $method;
$log->target_type = $this->getShop()->plat_id;
@ -154,6 +151,7 @@ abstract class BusinessClient
$log->message = json_encode($res, 256);
}
$log->save();
}
return $res;
}