|
...
|
...
|
@@ -9,7 +9,9 @@ namespace App\Http\Controllers\Api; |
|
|
|
|
|
|
|
use App\Enums\Common\Code;
|
|
|
|
use App\Http\Logic\Bside\User\UserLoginLogic;
|
|
|
|
use App\Models\Blog\Blog;
|
|
|
|
use App\Models\Domain\DomainInfo;
|
|
|
|
use App\Models\News\News;
|
|
|
|
use App\Models\Product\Category;
|
|
|
|
use App\Models\Product\CategoryRelated;
|
|
|
|
use App\Models\Product\Keyword;
|
|
...
|
...
|
@@ -283,4 +285,54 @@ class PrivateController extends BaseController |
|
|
|
}
|
|
|
|
return $this->success($projects);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 获取有效时间内 新增有效URL
|
|
|
|
* 用于自动提交Google收录
|
|
|
|
* @param Request $request
|
|
|
|
* @return false|string
|
|
|
|
*/
|
|
|
|
public function projectNewUrl(Request $request)
|
|
|
|
{
|
|
|
|
$domain = trim($request->input('domain'));
|
|
|
|
$domain_parse = parse_url($domain);
|
|
|
|
$domain = $domain_parse['host'] ?? $domain;
|
|
|
|
$date = trim($request->input('date'));
|
|
|
|
|
|
|
|
if (empty($domain) || empty($date)) {
|
|
|
|
return $this->error('非法参数!');
|
|
|
|
}
|
|
|
|
|
|
|
|
$project = Project::getProjectByDomain($domain);
|
|
|
|
if (empty($project)) {
|
|
|
|
return $this->error('未找到当前域名对应的项目!');
|
|
|
|
}
|
|
|
|
|
|
|
|
ProjectServer::useProject($project->id);
|
|
|
|
$result = [];
|
|
|
|
// 查询有效时间后 有效的产品、新闻、博客、聚合页 链接
|
|
|
|
$product = Product::where(['status' => Product::STATUS_ON])->where('created_at', '>=', $date)->pluck('route');
|
|
|
|
$news = News::where(['status' => News::STATUS_ONE])->where('release_at', '>', $date)->pluck('url');
|
|
|
|
$blog = Blog::where(['status' => Blog::STATUS_ONE])->where('release_at', '>', $date)->pluck('url');
|
|
|
|
$keyword = Keyword::where('created_at', '>', $date)->pluck('route');
|
|
|
|
|
|
|
|
// 组装链接
|
|
|
|
foreach ($product as $item) {
|
|
|
|
$url = 'https://' . $domain . '/' . $item;
|
|
|
|
array_push($result, $url);
|
|
|
|
}
|
|
|
|
foreach ($keyword as $item) {
|
|
|
|
$url = 'https://' . $domain . '/' . $item;
|
|
|
|
array_push($result, $url);
|
|
|
|
}
|
|
|
|
foreach ($news as $item) {
|
|
|
|
$url = 'https://' . $domain . '/news/' . $item;
|
|
|
|
array_push($result, $url);
|
|
|
|
}
|
|
|
|
foreach ($blog as $item) {
|
|
|
|
$url = 'https://' . $domain . '/blogs/' . $item;
|
|
|
|
array_push($result, $url);
|
|
|
|
}
|
|
|
|
return $this->success($result);
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|