45 lines
942 B
PHP
45 lines
942 B
PHP
<?php
|
|
|
|
namespace Yunshop\GoodsAssistant\jobs;
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Queue\SerializesModels;
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Yunshop\GoodsAssistant\services\ImportUniacidService;
|
|
|
|
|
|
class GoodsImportJob implements ShouldQueue
|
|
{
|
|
use InteractsWithQueue, Queueable, SerializesModels;
|
|
public $uniacid;
|
|
public $file;
|
|
/**
|
|
* Create a new job instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct($uniacid,$file)
|
|
{
|
|
$this->uniacid = $uniacid;
|
|
$this->file = $file;
|
|
}
|
|
|
|
/**
|
|
* Execute the job.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function handle()
|
|
{
|
|
\Setting::$uniqueAccountId = \YunShop::app()->uniacid = $this->uniacid;
|
|
$value = $this->value;
|
|
try {
|
|
$importUniacidService = new ImportUniacidService();
|
|
$importUniacidService->import($this->file);
|
|
} catch (\Exception $e) {
|
|
\Log::error('商品导入失败',$e->getMessage());
|
|
}
|
|
}
|
|
}
|