diff --git a/app/Console/Commands/KttOrderSyncStatus.php b/app/Console/Commands/KttOrderSyncStatus.php index e3f326b..0c89e11 100644 --- a/app/Console/Commands/KttOrderSyncStatus.php +++ b/app/Console/Commands/KttOrderSyncStatus.php @@ -44,19 +44,17 @@ class KttOrderSyncStatus extends Command public function handle() { $startTime = Carbon::now()->subDays(15)->getPreciseTimestamp(3); - $shops = Shop::query()->where('plat_id', Shop::$PLAT_KTT)->where('status', Shop::$STATUS_AUTHORIZED)->get(); BusinessOrder::query()->where('confirm_at', '>=', $startTime) ->where('shipping_status',BusinessOrderShippingStatus::UNSHIP) ->where('cancel_status',0) - ->chunk(200, function ($orders) use ($shops) { + ->chunk(200, function ($orders){ foreach ($orders as $order) { - $shop = $shops->where('id',$order['shop_id'])->first(); + $shop = Shop::query()->find($order['shop_id']); if(!empty($shop)){ BusinessFactory::init()->make($shop->plat_id)->setShop($shop)->queryStatusAndSync($order); usleep(10); } } }); - } } diff --git a/app/Services/Business/MiaoXuan/MiaoXuan.php b/app/Services/Business/MiaoXuan/MiaoXuan.php index a900d0f..d2392f9 100644 --- a/app/Services/Business/MiaoXuan/MiaoXuan.php +++ b/app/Services/Business/MiaoXuan/MiaoXuan.php @@ -33,11 +33,16 @@ class MiaoXuan extends BusinessClient { } - public function downloadAfterSaleOrdersAndSave($beginTime, $endTime, $page = 1){ + public function downloadAfterSaleOrdersAndSave($beginTime, $endTime, $page = 1) + { } - public function queryStatusAndSync($order){ + public function queryStatusAndSync($order) + { + $appendParams = ["order_sn" => $order->order_sn, "type" => "erpQuery"]; + $url = 'http://shop.chutang66.com/miaoxuan/queryStatus'; + $res = $this->formDataPostRequest($url, $appendParams); } diff --git a/app/Services/GoodSku/GoodSkuService.php b/app/Services/GoodSku/GoodSkuService.php index a37dd1a..8efb84c 100644 --- a/app/Services/GoodSku/GoodSkuService.php +++ b/app/Services/GoodSku/GoodSkuService.php @@ -121,7 +121,7 @@ class GoodSkuService ->select("external_sku_id", DB::raw("SUM(goods_number) - SUM(already_cancel_number) as number")) ->whereIn("external_sku_id", $externalSkuIds) ->where("b.shipping_status", "=", BusinessOrderShippingStatus::UNSHIP) - ->where("business_order_items.created_at", ">=", $startTime)->where("b.cancel_status", "=", 0) + ->where("business_order_items.created_at", ">=", $startTime)->where("business_order_items.cancel_status", "=", 0) ->groupBy('external_sku_id')->get()->toArray(); Log::info("盘点未发货数据",[$unshippedDataCollect]);