feat: #10000 店铺库存更新修改

This commit is contained in:
赵世界 2023-04-23 14:04:42 +08:00
parent f1a4d4c9e7
commit e0a148e140

View File

@ -190,17 +190,17 @@ class ShopsController extends Controller
public function syncStock(Request $request)
{
$shopId = $request->get('shop_id');
$skus = GoodsSku::query()
->where('status', '>', 0)
->whereNotNull('external_sku_id')
->pluck('stock', 'external_sku_id')
->toArray();
$builder = Shop::query()->where('expires_at', '>', time());
if ('all' === $shopId) {
$shops = $builder->get();
} else {
$shops = $builder->where('id', $shopId)->get();
}
$skus = GoodsSku::query()
->where('updated_at', '>', date('Y-m-d 07:01:00'))
->whereNotNull('external_sku_id')
->pluck('stock', 'external_sku_id')
->toArray();
foreach ($shops as $shop) {
$business = BusinessFactory::init()->make($shop->plat_id);
$business->setShop($shop);