commit
e828627c3d
@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers\Business;
|
||||
|
||||
use App\Events\StockUpdateEvent;
|
||||
use App\Events\BusinessOrdersUpdate;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Resources\BusinessGoodsSkuResource;
|
||||
use App\Models\BusinessGoodsSku;
|
||||
@ -87,7 +87,7 @@ class BusinessGoodsSkusController extends Controller
|
||||
if (empty($sku)) {
|
||||
$this->setValidatorFailResponse('未找到对应的商品,请核实后再次同步或删除此平台商品');
|
||||
} else {
|
||||
event(new StockUpdateEvent($sku));
|
||||
event(new BusinessOrdersUpdate($businessGoodsSku, 0));
|
||||
$this->res['message'] = '库存同步请求发送成功,具体结果查看日志';
|
||||
}
|
||||
return response($this->res, $this->res['httpCode']);
|
||||
|
||||
@ -49,7 +49,12 @@ class UpdateBusinessGoodsStock implements ShouldQueue
|
||||
if ('下架' === $event->goodsSku->status) {
|
||||
return;
|
||||
}
|
||||
$shops = Shop::query()->whereNotIn('status', [0, 3])->get(['id', 'plat_id']);
|
||||
$builder = Shop::query()->whereNotIn('status', [0, 3]);
|
||||
// 非订单影响库存变更,只更新本店铺下商品
|
||||
if (!isset($event->businessGoods['business_order_id'])) {
|
||||
$builder->where('id', $event->businessGoods['shop_id']);
|
||||
}
|
||||
$shops = $builder->get(['id', 'plat_id']);
|
||||
if (empty($shops)) {
|
||||
LogFile::info('可操作店铺为空');
|
||||
return;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user