ChangeMerchantStatusJob.php 806 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace ln\jobs;
  3. use app\common\repositories\store\product\ProductRepository;
  4. use app\common\repositories\system\merchant\MerchantRepository;
  5. use ln\interfaces\JobInterface;
  6. use think\facade\Log;
  7. use think\queue\Job;
  8. class ChangeMerchantStatusJob implements JobInterface
  9. {
  10. public function fire($job, $merId)
  11. {
  12. $merchant = app()->make(MerchantRepository::class)->get($merId);
  13. if ($merchant) {
  14. $where = [
  15. 'mer_status' => ($merchant['is_del'] || !$merchant['mer_state'] || !$merchant['status']) ? 0 : 1
  16. ];
  17. app()->make(ProductRepository::class)->changeMerchantProduct($merId, $where);
  18. }
  19. $job->delete();
  20. }
  21. public function failed($data)
  22. {
  23. // TODO: Implement failed() method.
  24. }
  25. }