ChangeMerchantStatusJob.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace crmeb\jobs;
  12. use app\common\repositories\store\product\ProductRepository;
  13. use app\common\repositories\store\service\StoreServiceRepository;
  14. use app\common\repositories\system\merchant\MerchantRepository;
  15. use crmeb\interfaces\JobInterface;
  16. use think\facade\Log;
  17. use think\queue\Job;
  18. class ChangeMerchantStatusJob implements JobInterface
  19. {
  20. public function fire($job, $merId)
  21. {
  22. $merchant = app()->make(MerchantRepository::class)->get($merId);
  23. if ($merchant) {
  24. $where = [
  25. 'mer_status' => ($merchant['is_del'] || !$merchant['mer_state'] || !$merchant['status']) ? 0 : 1
  26. ];
  27. app()->make(ProductRepository::class)->changeMerchantProduct($merId, $where);
  28. }
  29. $job->delete();
  30. }
  31. public function failed($data)
  32. {
  33. // TODO: Implement failed() method.
  34. }
  35. }