AutoAgentJob.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\jobs\agent;
  12. use crmeb\basic\BaseJobs;
  13. use app\services\agent\AgentManageServices;
  14. use crmeb\traits\QueueTrait;
  15. use think\facade\Log;
  16. /**
  17. * 自动解除上下级
  18. * Class AutoAgentJob
  19. * @package app\jobs\user
  20. */
  21. class AutoAgentJob extends BaseJobs
  22. {
  23. use QueueTrait;
  24. /**
  25. * @return string
  26. */
  27. protected static function queueName()
  28. {
  29. return 'CRMEB_PRO_TASK';
  30. }
  31. /**
  32. * @param $page
  33. * @param $limit
  34. * @param $where
  35. */
  36. public function doJob($page, $limit, $where)
  37. {
  38. //自动解绑上级绑定
  39. try {
  40. /** @var AgentManageServices $agentManage */
  41. $agentManage = app()->make(AgentManageServices::class);
  42. return $agentManage->startRemoveSpread($page, $limit, $where);
  43. } catch (\Throwable $e) {
  44. Log::error('自动解除上级绑定失败,失败原因:[' . class_basename($this) . ']' . $e->getMessage());
  45. }
  46. }
  47. }