mirror of
https://gitee.com/hzchunfen/erp.git
synced 2025-12-01 14:40:44 +00:00
feat: #10000 店铺库存更新修改
This commit is contained in:
parent
f1a4d4c9e7
commit
e0a148e140
@ -190,17 +190,17 @@ class ShopsController extends Controller
|
|||||||
public function syncStock(Request $request)
|
public function syncStock(Request $request)
|
||||||
{
|
{
|
||||||
$shopId = $request->get('shop_id');
|
$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());
|
$builder = Shop::query()->where('expires_at', '>', time());
|
||||||
if ('all' === $shopId) {
|
if ('all' === $shopId) {
|
||||||
$shops = $builder->get();
|
$shops = $builder->get();
|
||||||
} else {
|
} else {
|
||||||
$shops = $builder->where('id', $shopId)->get();
|
$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) {
|
foreach ($shops as $shop) {
|
||||||
$business = BusinessFactory::init()->make($shop->plat_id);
|
$business = BusinessFactory::init()->make($shop->plat_id);
|
||||||
$business->setShop($shop);
|
$business->setShop($shop);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user