shop-php/crmeb/jobs/ImportProductJob.php

29 lines
657 B
PHP
Raw Normal View History

2023-12-01 11:28:49 +08:00
<?php
namespace crmeb\jobs;
use crmeb\interfaces\JobInterface;
use think\facade\Log;
2023-12-01 11:32:29 +08:00
use app\common\repositories\store\order\StoreOrderRepository;
2023-12-01 11:28:49 +08:00
class ImportProductJob implements JobInterface
{
public function fire($job, $data)
{
if ($job->attempts() > 1) {
$job->delete();
$this->failed($data);
}
2023-12-02 12:54:56 +08:00
app()->make(StoreOrderRepository::class)->setProduct($data['data'],$data['mer_id'],$data['product_type']);
2023-12-01 11:28:49 +08:00
$job->delete();
}
public function failed($data)
{
Log::error('导入商品失败:' . json_encode($data));
// TODO: Implement failed() method.
}
}