|
@@ -9,7 +9,9 @@ namespace App\Http\Controllers\Api; |
|
@@ -9,7 +9,9 @@ namespace App\Http\Controllers\Api; |
|
9
|
|
9
|
|
|
10
|
use App\Enums\Common\Code;
|
10
|
use App\Enums\Common\Code;
|
|
11
|
use App\Http\Logic\Bside\User\UserLoginLogic;
|
11
|
use App\Http\Logic\Bside\User\UserLoginLogic;
|
|
|
|
12
|
+use App\Models\Blog\Blog;
|
|
12
|
use App\Models\Domain\DomainInfo;
|
13
|
use App\Models\Domain\DomainInfo;
|
|
|
|
14
|
+use App\Models\News\News;
|
|
13
|
use App\Models\Product\Category;
|
15
|
use App\Models\Product\Category;
|
|
14
|
use App\Models\Product\CategoryRelated;
|
16
|
use App\Models\Product\CategoryRelated;
|
|
15
|
use App\Models\Product\Keyword;
|
17
|
use App\Models\Product\Keyword;
|
|
@@ -283,4 +285,54 @@ class PrivateController extends BaseController |
|
@@ -283,4 +285,54 @@ class PrivateController extends BaseController |
|
283
|
}
|
285
|
}
|
|
284
|
return $this->success($projects);
|
286
|
return $this->success($projects);
|
|
285
|
}
|
287
|
}
|
|
|
|
288
|
+
|
|
|
|
289
|
+ /**
|
|
|
|
290
|
+ * 获取有效时间内 新增有效URL
|
|
|
|
291
|
+ * 用于自动提交Google收录
|
|
|
|
292
|
+ * @param Request $request
|
|
|
|
293
|
+ * @return false|string
|
|
|
|
294
|
+ */
|
|
|
|
295
|
+ public function projectNewUrl(Request $request)
|
|
|
|
296
|
+ {
|
|
|
|
297
|
+ $domain = trim($request->input('domain'));
|
|
|
|
298
|
+ $domain_parse = parse_url($domain);
|
|
|
|
299
|
+ $domain = $domain_parse['host'] ?? $domain;
|
|
|
|
300
|
+ $date = trim($request->input('date'));
|
|
|
|
301
|
+
|
|
|
|
302
|
+ if (empty($domain) || empty($date)) {
|
|
|
|
303
|
+ return $this->error('非法参数!');
|
|
|
|
304
|
+ }
|
|
|
|
305
|
+
|
|
|
|
306
|
+ $project = Project::getProjectByDomain($domain);
|
|
|
|
307
|
+ if (empty($project)) {
|
|
|
|
308
|
+ return $this->error('未找到当前域名对应的项目!');
|
|
|
|
309
|
+ }
|
|
|
|
310
|
+
|
|
|
|
311
|
+ ProjectServer::useProject($project->id);
|
|
|
|
312
|
+ $result = [];
|
|
|
|
313
|
+ // 查询有效时间后 有效的产品、新闻、博客、聚合页 链接
|
|
|
|
314
|
+ $product = Product::where(['status' => Product::STATUS_ON])->where('created_at', '>=', $date)->pluck('route');
|
|
|
|
315
|
+ $news = News::where(['status' => News::STATUS_ONE])->where('release_at', '>', $date)->pluck('url');
|
|
|
|
316
|
+ $blog = Blog::where(['status' => Blog::STATUS_ONE])->where('release_at', '>', $date)->pluck('url');
|
|
|
|
317
|
+ $keyword = Keyword::where('created_at', '>', $date)->pluck('route');
|
|
|
|
318
|
+
|
|
|
|
319
|
+ // 组装链接
|
|
|
|
320
|
+ foreach ($product as $item) {
|
|
|
|
321
|
+ $url = 'https://' . $domain . '/' . $item;
|
|
|
|
322
|
+ array_push($result, $url);
|
|
|
|
323
|
+ }
|
|
|
|
324
|
+ foreach ($keyword as $item) {
|
|
|
|
325
|
+ $url = 'https://' . $domain . '/' . $item;
|
|
|
|
326
|
+ array_push($result, $url);
|
|
|
|
327
|
+ }
|
|
|
|
328
|
+ foreach ($news as $item) {
|
|
|
|
329
|
+ $url = 'https://' . $domain . '/news/' . $item;
|
|
|
|
330
|
+ array_push($result, $url);
|
|
|
|
331
|
+ }
|
|
|
|
332
|
+ foreach ($blog as $item) {
|
|
|
|
333
|
+ $url = 'https://' . $domain . '/blogs/' . $item;
|
|
|
|
334
|
+ array_push($result, $url);
|
|
|
|
335
|
+ }
|
|
|
|
336
|
+ return $this->success($result);
|
|
|
|
337
|
+ }
|
|
286
|
} |
338
|
} |