setName('droptopool') ->setDescription('drop to pool everyday night'); } protected function execute(Input $input, Output $output) { $where = []; $records = Customer::where($where)->select(); foreach($records as $item){ //过滤已签单客户,不掉公 if($item->state == "签单"){ continue; } //过滤已到访客户,并掉公 if ($item->state == "已到访") { $protect_days_num = pubpoolSetting('arrived'); } //过滤已量房客户,并掉公 if($item->state == "已量房"){ $protect_days_num = pubpoolSetting('measured'); } //过滤已下定客户,并掉公 if($item->state == "交定"){ $protect_days_num = pubpoolSetting('deposited'); } //过滤未联系客户,并掉公 if($item->state == "待确认"){ $protect_days_num = pubpoolSetting('notouched'); } if((int)$protect_days_num > 0){ $time_til = time() + (int)$protect_days_num * 86400; $enddate = ($item->protected_to)?$item->protected_to:date('Y-m-d H:i:s', $time_til); if(date('Y-m-d H:i:s', time()) > $enddate){ $org_id = knnPubPool($item->org_id); Customer::where('id',$item->id)->update(['employee_id'=> NULL, 'org_id'=>$org_id, 'protected_to' => NULL]); $output->writeln($item->name." 回收至公海"); } } } } }