46 lines
1.1 KiB
PHP
46 lines
1.1 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Jobs;
|
||
|
|
|
||
|
|
use App\Models\BusinessOrderItem;
|
||
|
|
use App\Models\GoodsSku;
|
||
|
|
use App\Services\Business\BusinessFactory;
|
||
|
|
use Illuminate\Bus\Queueable;
|
||
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||
|
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||
|
|
use Illuminate\Queue\InteractsWithQueue;
|
||
|
|
use Illuminate\Queue\SerializesModels;
|
||
|
|
|
||
|
|
class BusinessGoodsSkuIncrQuantity implements ShouldQueue
|
||
|
|
{
|
||
|
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||
|
|
|
||
|
|
public $shop;
|
||
|
|
public $businessOrderItem;
|
||
|
|
public $num;
|
||
|
|
public $goodsSku;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Create a new job instance.
|
||
|
|
*
|
||
|
|
* @return void
|
||
|
|
*/
|
||
|
|
public function __construct($shop, BusinessOrderItem $businessOrderItem, $num, GoodsSku $goodsSku)
|
||
|
|
{
|
||
|
|
$this->shop = $shop;
|
||
|
|
$this->businessOrderItem = $businessOrderItem;
|
||
|
|
$this->num = $num;
|
||
|
|
$this->goodsSku = $goodsSku;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Execute the job.
|
||
|
|
*
|
||
|
|
* @return void
|
||
|
|
*/
|
||
|
|
public function handle()
|
||
|
|
{
|
||
|
|
BusinessFactory::init()->make($this->shop['plat_id'])->setShopId($this->shop['id'])->incrQuantity($this->businessOrderItem, $this->num, true, $this->goodsSku);
|
||
|
|
}
|
||
|
|
}
|