|
...
|
...
|
@@ -568,4 +568,48 @@ class PrivateController extends BaseController |
|
|
|
return $this->error('项目未匹配到域名');
|
|
|
|
return $this->success(['domain' => $domain->domain]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 根据域名获取外链
|
|
|
|
* @param Request $request
|
|
|
|
* @return false|string
|
|
|
|
*/
|
|
|
|
public function getProjectExternalLink(Request $request)
|
|
|
|
{
|
|
|
|
$domain = trim($request->input('domain'));
|
|
|
|
$domain_parse = parse_url($domain);
|
|
|
|
$domain = $domain_parse['host'] ?? $domain;
|
|
|
|
|
|
|
|
if (empty($domain)) {
|
|
|
|
return $this->error('非法参数!');
|
|
|
|
}
|
|
|
|
|
|
|
|
$project = Project::getProjectByDomain($domain);
|
|
|
|
if (empty($project)) {
|
|
|
|
return $this->error('未找到当前域名对应的项目!');
|
|
|
|
}
|
|
|
|
|
|
|
|
ProjectServer::useProject($project->id);
|
|
|
|
$keywords = Keyword::select(['id', 'title', 'route', 'seo_title'])->where('route', '<>', null)->orderBy('id', 'desc')->limit(500)->get();
|
|
|
|
$host = 'https://' . $domain . '/';
|
|
|
|
$data = [];
|
|
|
|
foreach ($keywords as $keyword) {
|
|
|
|
$data[] = $host . $keyword->route . '/{' . $keyword->seo_title . '}';
|
|
|
|
}
|
|
|
|
DB::disconnect('custom_mysql');
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 获取今日需要推送的外链
|
|
|
|
* @param Request $request
|
|
|
|
* @return false|string
|
|
|
|
*/
|
|
|
|
public function getExternalLink(Request $request)
|
|
|
|
{
|
|
|
|
$max_id = DB::table('gl_project_external_link_make')->where(['status' => 0])->max('id');
|
|
|
|
$links = DB::table('gl_project_external_link_make')->where(['status' => 0])->where('id', '<=', $max_id)->pluck('external_link')->toArray();
|
|
|
|
DB::table('gl_project_external_link_make')->where(['status' => 0])->where('id', '<=', $max_id)->update(['status' => 1, 'updated_at' => date('Y-m-d H:i;s')]);
|
|
|
|
return $this->success($links);
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|