2022-08-11 11:18:21 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Jobs;
|
|
|
|
|
|
|
|
|
|
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;
|
2022-08-16 21:02:31 +08:00
|
|
|
public $isIncremental = true;
|
2022-08-11 11:18:21 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Create a new job instance.
|
|
|
|
|
*
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
2022-08-17 13:49:36 +08:00
|
|
|
public function __construct($shop, $businessOrderItem, $num, $isIncremental)
|
2022-08-11 11:18:21 +08:00
|
|
|
{
|
|
|
|
|
$this->shop = $shop;
|
|
|
|
|
$this->businessOrderItem = $businessOrderItem;
|
|
|
|
|
$this->num = $num;
|
2022-08-16 21:02:31 +08:00
|
|
|
$this->isIncremental = $isIncremental;
|
2022-08-11 11:18:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Execute the job.
|
|
|
|
|
*
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
public function handle()
|
|
|
|
|
{
|
2022-08-16 21:02:31 +08:00
|
|
|
if ($this->businessOrderItem) {
|
|
|
|
|
BusinessFactory::init()->make($this->shop['plat_id'])->setShopWithId($this->shop['id'])->incrQuantity($this->businessOrderItem, $this->num, $this->isIncremental);
|
|
|
|
|
}
|
2022-08-11 11:18:21 +08:00
|
|
|
}
|
|
|
|
|
}
|