!72 增量订单获取优化

Merge pull request !72 from 赵世界/develop
This commit is contained in:
赵世界 2022-08-26 06:13:15 +00:00 committed by Gitee
commit d6ced61036
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 4 additions and 4 deletions

View File

@ -43,10 +43,10 @@ class Swoole extends Command
*/ */
public function handle() public function handle()
{ {
Timer::tick(1000, function () { Timer::tick(5000, function () {
$shops = Shop::query()->where('plat_id', 1)->where('status', 1)->get(); $shops = Shop::query()->where('plat_id', 1)->where('status', 1)->get();
$endTime = DateTimeUtils::getMicroTime(); $endTime = DateTimeUtils::getMicroTime();
$beginTime = $endTime - 10000; $beginTime = $endTime - 5000;
foreach ($shops as $shop) { foreach ($shops as $shop) {
BusinessFactory::init()->make($shop->plat_id)->setShop($shop)->downloadOrdersAndSave($beginTime, $endTime, 'increment'); BusinessFactory::init()->make($shop->plat_id)->setShop($shop)->downloadOrdersAndSave($beginTime, $endTime, 'increment');
} }

View File

@ -40,7 +40,7 @@ class UpdateBusinessGoodsStock implements ShouldQueue
$log->target_id = $event->goodsSku->id ?? 0; $log->target_id = $event->goodsSku->id ?? 0;
$log->target_field = 'stock'; $log->target_field = 'stock';
$log->user_id = 999; $log->user_id = 999;
$log->message = ($event->businessOrderItem['external_sku_id'] ?? $event->businessOrderItem['id']) . '未找到'; $log->message = '未找到' . json_encode($event->businessOrderItem, 256);
$log->save(); $log->save();
return; return;

View File

@ -56,7 +56,7 @@ class Goods
$type = 'pdd.ktt.goods.incr.quantity'; $type = 'pdd.ktt.goods.incr.quantity';
$appendParams = [ $appendParams = [
'goods_id' => $goodsId, 'goods_id' => $goodsId,
'quantity_delta' => $quantity, 'quantity_delta' => max($quantity, 0),
'sku_id' => $skuId, 'sku_id' => $skuId,
// 非必填 // 非必填
'modify_quantity_type' => $modifyType, // 修改库存的类型不传或1代表增量修改2代表全量修改 'modify_quantity_type' => $modifyType, // 修改库存的类型不传或1代表增量修改2代表全量修改