|
...
|
...
|
@@ -111,7 +111,10 @@ class SyncInquiryProject extends Command |
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$this->deleteExpire($date);
|
|
|
|
|
|
|
|
$ids = InquiryProject::where('date', '<', $date)->where('version', '<', InquiryProject::VERSION_SIX)->pluck('id')->toArrat();
|
|
|
|
$this->deleteExpire($ids);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -142,20 +145,26 @@ class SyncInquiryProject extends Command |
|
|
|
$project = InquiryProject::saveProject($date,InquiryProject::VERSION_SIX, $val->id, $val->title, $val->channel['channel_id'], $domains[$val->id]);
|
|
|
|
$this->pushTask($project->id);
|
|
|
|
}
|
|
|
|
$this->deleteExpire($date);
|
|
|
|
|
|
|
|
$ids = InquiryProject::where('date', '<', $date)->where('version', '=', InquiryProject::VERSION_SIX)->pluck('id')->toArrat();
|
|
|
|
$this->deleteExpire($ids);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 删除过期数据, 非当日更新数据, 都删除, 误删第二天再重新同步更新
|
|
|
|
* @param $date
|
|
|
|
* @param $ids
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function deleteExpire($date)
|
|
|
|
public function deleteExpire($ids)
|
|
|
|
{
|
|
|
|
$project_num = InquiryProject::where('date', '<', $date)->delete();
|
|
|
|
$this->log('删除过期项目数量:' . $project_num);
|
|
|
|
if (empty($ids))
|
|
|
|
return true;
|
|
|
|
$project_num = InquiryProject::whereIn('id', $ids)->delete();
|
|
|
|
$project_route_num = InquiryProjectRoute::whereIn('project_id', $ids)->delete();
|
|
|
|
$this->log('删除过期项目数量:' . $project_num . ', 删除过期项目路由数量:' . $project_route_num);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
...
|
...
|
|