| 123456789101112131415161718192021222324252627282930313233343536373839 |
- <?php
- namespace app\common\command;
- use think\console\Input;
- use think\console\Output;
- use think\console\Command;
- use app\common\model\works\ServiceWork;
- class CancelDispatch extends Command
- {
- protected function configure()
- {
- $this->setName('cancel_dispatch')
- ->setDescription('派单5分钟未领取的工单自动取消');
- }
- protected function execute(Input $input, Output $output)
- {
- $this->cancelDispatch();
- }
- /*
- * 超过5分钟未领取工单的,取消分配
- */
- protected function cancelDispatch()
- {
- ServiceWork::where('work_status',1)
- ->where('dispatch_time','<',strtotime('-5 minutes'))
- ->update([
- 'master_worker_id' => 0,
- 'work_status' => 0,
- 'dispatch_time' => 0,
- 'first_contact_time' => 0,
- 'estimated_finish_time' => 0,
- ]);
- }
- }
|