mirror of
https://gitee.com/hzchunfen/erp.git
synced 2025-11-30 22:20:45 +00:00
commit
a9f5b39ce9
@ -3,15 +3,16 @@
|
|||||||
namespace App\Listeners;
|
namespace App\Listeners;
|
||||||
|
|
||||||
use App\Events\BatchStockUpdateEvent;
|
use App\Events\BatchStockUpdateEvent;
|
||||||
use App\Jobs\BusinessGoodsSkuIncrQuantity;
|
|
||||||
use App\Models\BusinessGoodsSku;
|
use App\Models\BusinessGoodsSku;
|
||||||
use App\Models\Shop;
|
use App\Models\Shop;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
use Illuminate\Queue\InteractsWithQueue;
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
use App\Services\Business\BusinessFactory;
|
use App\Services\Business\BusinessFactory;
|
||||||
|
|
||||||
class BatchStockUpdateListener
|
class BatchStockUpdateListener implements ShouldQueue
|
||||||
{
|
{
|
||||||
|
use InteractsWithQueue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the event listener.
|
* Create the event listener.
|
||||||
*
|
*
|
||||||
@ -32,7 +33,7 @@ class BatchStockUpdateListener
|
|||||||
{
|
{
|
||||||
$shops = Shop::query()->whereNotIn('status', [Shop::$STATUS_UNAUTHORIZED, Shop::$STATUS_STOP])->get(['id', 'plat_id']);
|
$shops = Shop::query()->whereNotIn('status', [Shop::$STATUS_UNAUTHORIZED, Shop::$STATUS_STOP])->get(['id', 'plat_id']);
|
||||||
if (empty($shops)) {
|
if (empty($shops)) {
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
foreach ($shops as $shop) {
|
foreach ($shops as $shop) {
|
||||||
foreach ($event->goodsSkus as $goodsSku) {
|
foreach ($event->goodsSkus as $goodsSku) {
|
||||||
|
|||||||
@ -9,8 +9,10 @@ use Illuminate\Contracts\Queue\ShouldQueue;
|
|||||||
use Illuminate\Queue\InteractsWithQueue;
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
use App\Services\Business\BusinessFactory;
|
use App\Services\Business\BusinessFactory;
|
||||||
|
|
||||||
class StockUpdateListener
|
class StockUpdateListener implements ShouldQueue
|
||||||
{
|
{
|
||||||
|
use InteractsWithQueue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the event listener.
|
* Create the event listener.
|
||||||
*
|
*
|
||||||
@ -31,7 +33,7 @@ class StockUpdateListener
|
|||||||
{
|
{
|
||||||
$shops = Shop::query()->whereNotIn('status', [Shop::$STATUS_UNAUTHORIZED, Shop::$STATUS_STOP])->get(['id', 'plat_id']);
|
$shops = Shop::query()->whereNotIn('status', [Shop::$STATUS_UNAUTHORIZED, Shop::$STATUS_STOP])->get(['id', 'plat_id']);
|
||||||
if (empty($shops)) {
|
if (empty($shops)) {
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
foreach ($shops as $shop) {
|
foreach ($shops as $shop) {
|
||||||
$num = $event->goodsSku->stock;
|
$num = $event->goodsSku->stock;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user