ChangeSpuStatusJob.php 685 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace ln\jobs;
  3. use app\common\repositories\store\product\SpuRepository;
  4. use ln\interfaces\JobInterface;
  5. use think\facade\Log;
  6. class ChangeSpuStatusJob implements JobInterface
  7. {
  8. public function fire($job, $data)
  9. {
  10. try{
  11. $make = app()->make(SpuRepository::class);
  12. if(!is_array($data['id']) && is_numeric($data['id'])){
  13. $make->changeStatus($data['id'],$data['product_type']);
  14. }
  15. $job->delete();
  16. }catch (\Exception $exception){
  17. Log::info($exception->getMessage());
  18. }
  19. }
  20. public function failed($data)
  21. {
  22. // TODO: Implement failed() method.
  23. }
  24. }