添加日志
This commit is contained in:
parent
ed8d1d420c
commit
36d16437bf
39
application/common/command/CheckOrdeRecordCommand.php
Normal file
39
application/common/command/CheckOrdeRecordCommand.php
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\common\command;
|
||||||
|
|
||||||
|
use app\admin\model\OrderDispatchRecord;
|
||||||
|
|
||||||
|
use think\console\Command;
|
||||||
|
use think\console\Input;
|
||||||
|
use think\console\Output;
|
||||||
|
|
||||||
|
class CheckOrdeRecordCommand extends Command
|
||||||
|
{
|
||||||
|
protected function configure()
|
||||||
|
{
|
||||||
|
$this->setName('check:dispatch-record-notice')
|
||||||
|
->setDescription('dispatch跟进记录通知,每分钟一次');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function execute(Input $input, Output $output){
|
||||||
|
|
||||||
|
$Model = new OrderDispatchRecord();
|
||||||
|
$now = date('Y-m-d H:i:s'); //创建三十分名以上未接的任务
|
||||||
|
|
||||||
|
$Model->where('need_notice',1)
|
||||||
|
->where('notice_time','<=',$now)
|
||||||
|
->where('status',0)
|
||||||
|
->chunk(100, function ($list) {
|
||||||
|
$ids = [];
|
||||||
|
foreach ($list as $item) {
|
||||||
|
//todo...通知逻辑
|
||||||
|
$ids[] = $item->id;
|
||||||
|
//修改状态
|
||||||
|
}
|
||||||
|
OrderDispatchRecord::whereIn('id',$ids)->update(['status'=>1]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user