作者 lyh

gxapi接口

@@ -374,4 +374,31 @@ class PrivateController extends BaseController @@ -374,4 +374,31 @@ class PrivateController extends BaseController
374 $optimize->save(); 374 $optimize->save();
375 return $this->success(); 375 return $this->success();
376 } 376 }
  377 +
  378 + /**
  379 + * @remark :根据项目域名获取产品关键字
  380 + * @name :getProjectKeyword
  381 + * @author :lyh
  382 + * @method :post
  383 + * @time :2025/2/7 17:26
  384 + */
  385 + public function getProjectKeyword(){
  386 + $this->request->validate([
  387 + 'domain' => 'required',
  388 + ], [
  389 + 'domain.required' => '域名不能为空',
  390 + ]);
  391 + $parsedUrl = parse_url($this->map['domain']);
  392 + $this->map['domain'] = $parsedUrl['host'] ?? $this->map['domain'];
  393 + $domainModel = new DomainInfo();
  394 + $info = $domainModel->read(['domain'=>$this->param['domain']]);
  395 + if(empty($info)){
  396 + $this->response('当前域名不存在',Code::SYSTEM_ERROR);
  397 + }
  398 + ProjectServer::useProject($info['project_id']);
  399 + $productKeywordModel = new Keyword();
  400 + $list = $productKeywordModel::orderByRaw('LENGTH(title) ASC')->limit(50)->get();
  401 + DB::disconnect('custom_mysql');
  402 + $this->response('success',Code::SUCCESS,$list);
  403 + }
377 } 404 }
@@ -56,7 +56,8 @@ Route::any('get_project_product', [\App\Http\Controllers\Api\PrivateController:: @@ -56,7 +56,8 @@ Route::any('get_project_product', [\App\Http\Controllers\Api\PrivateController::
56 Route::any('get_project_online', [\App\Http\Controllers\Api\PrivateController::class, 'getProjectOnline'])->name('api.get_project_online'); 56 Route::any('get_project_online', [\App\Http\Controllers\Api\PrivateController::class, 'getProjectOnline'])->name('api.get_project_online');
57 // 将项目标记为广告状态 57 // 将项目标记为广告状态
58 Route::any('mark_project_ads', [\App\Http\Controllers\Api\PrivateController::class, 'markProjectAds'])->name('api.mark_project_ads'); 58 Route::any('mark_project_ads', [\App\Http\Controllers\Api\PrivateController::class, 'markProjectAds'])->name('api.mark_project_ads');
59 - 59 +//获取对应产品关键词
  60 +Route::any('getProjectKeyword', [\App\Http\Controllers\Api\PrivateController::class, 'getProjectKeyword'])->name('api.getProjectKeyword');
60 //自建站接口转接 61 //自建站接口转接
61 Route::post('selfSiteApi', [\App\Http\Controllers\Api\SelfSiteController::class, 'selfSiteApi']); 62 Route::post('selfSiteApi', [\App\Http\Controllers\Api\SelfSiteController::class, 'selfSiteApi']);
62 Route::post('selfSiteNotify', [\App\Http\Controllers\Api\SelfSiteController::class, 'selfSiteNotify']); 63 Route::post('selfSiteNotify', [\App\Http\Controllers\Api\SelfSiteController::class, 'selfSiteNotify']);