作者 刘锟

升级项目上线后也能采集增量数据

... ... @@ -115,10 +115,25 @@ class UpdateController extends BaseController
$old_info->save();
}
UpdateLog::where('project_id', $this->param['project_id'])->whereNotIn('api_type', ['category', 'category_news', 'website_info', 'tag'])->update(['collect_status' => 0]);
$logs = UpdateLog::where('project_id', $this->param['project_id'])->whereNotIn('api_type', ['category', 'category_news'])->get();
if ($this->param['type'] == 2 && !$domain_info) {
UpdateLog::where('project_id', $this->param['project_id'])->whereNotIn('api_type', ['category', 'category_news'])->update(['status' => 0]);
foreach ($logs as $log) {
if ($domain_info) {
$url_arr = parse_url($log->api_url);
$api_url = str_replace($url_arr['host'], $test_domain, $log->api_url);
$log->api_url = $api_url;
$log->status = 0;
} else {
if ($this->param['type'] == 2) {
$log->status = 0;
}
}
if (!in_array($log->api_type, ['website_info', 'tag'])) {
$log->collect_status = 0;
}
$log->save();
}
$this->response('采集任务添加成功');
... ...