ChangeMerchantStatusJob.php 884 B

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