with(['template_info','scheduling'])->select(); foreach($all as $k=>$data){ $task_id=explode(',',$data['task_id']); $task_count=Task::where('id','in',$task_id)->field('nikename')->select(); halt(count($task_count)==count($task_id)); if(count($task_count)==count($task_id)){ $name=implode(',',$task_count); $arr['money']=$data['template_info']['money']; $arr['company_id']=$data['scheduling']['company_id']; $arr['msg']='来自任务【'.$data['template_info']['title'].'】,执行人:'.$name.',的任务结算'; $arr['sn']=$data['sn']; $arr['user_id']=$data['user_id']; (new ShareProfit())->first($arr); } } halt($all); } public function ceshi(){ // $time=strtotime(date('Y-m-d',strtotime('+1 day'))); $time=strtotime(date('Y-m-d')); $tiem_end=$time+86399; $all=TaskSchedulingPlan::where('start_time','between',[$time,$tiem_end])->with(['template_info','scheduling'])->select()->toArray(); foreach($all as $k=>$v){ TaskLogic::CronAdd($v); } } }