作者 lyh

gx

... ... @@ -14,7 +14,7 @@ use App\Models\Domain\DomainInfo;
use App\Models\GoogleSearch\GoogleSearch;
use App\Models\GoogleSearch\GoogleSearchDetail;
use App\Models\Project\Project;
use App\Services\GoogleSearchService;
use App\Services\RapIdApIService;
use App\Services\ProjectServer;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
... ... @@ -48,7 +48,7 @@ class GoogleSearchKeyword extends Command
public function __construct()
{
$this->googleService = new GoogleSearchService();
$this->googleService = new RapIdApIService();
$this->searchModel = new GoogleSearch();
$this->detailModel = new GoogleSearchDetail();
parent::__construct();
... ...
... ... @@ -16,7 +16,7 @@ use App\Http\Controllers\Bside\BaseController;
use App\Models\Com\NoticeLog;
use App\Models\GoogleSearch\GoogleSearch;
use App\Models\GoogleSearch\GoogleSearchDetail;
use App\Services\GoogleSearchService;
use App\Services\RapIdApIService;
class GoogleSearchController extends BaseController
{
... ...
... ... @@ -28,7 +28,7 @@ use App\Models\Project\Project;
use App\Models\Project\ProjectAiSetting;
use App\Models\RouteMap\RouteMap;
use App\Services\AiBlogService;
use App\Services\GoogleSearchService;
use App\Services\RapIdApIService;
use App\Services\ProjectServer;
use Illuminate\Support\Facades\DB;
... ...
... ... @@ -13,7 +13,7 @@ use App\Helper\Translate;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\GoogleKeywordInsight\GoogleKeywordInsight;
use App\Models\GoogleKeywordInsight\GoogleKeywordInsightDetail;
use App\Services\GoogleSearchService;
use App\Services\RapIdApIService;
use Illuminate\Support\Facades\DB;
class GoogleKeywordInsightLogic extends BaseLogic
... ... @@ -37,7 +37,7 @@ class GoogleKeywordInsightLogic extends BaseLogic
public function getGoogleInsight(){
$data = $this->model->read(['search'=>$this->param['keyword']],['id']);
if($data === false){
$this->service = new GoogleSearchService();
$this->service = new RapIdApIService();
$data = $this->service->requestUrl($this->param['keyword']);
if(!empty($data)){
DB::beginTransaction();
... ... @@ -64,7 +64,7 @@ class GoogleKeywordInsightLogic extends BaseLogic
* @time :2025/3/25 14:36
*/
public function getGoogleInsightDetail(){
$this->service = new GoogleSearchService();
$this->service = new RapIdApIService();
$data = $this->service->requestUrl($this->param['keyword']);
if(!empty($data)){
DB::beginTransaction();
... ...
<?php
/**
* @remark :
* @name :GoogleSearchService.php
* @name :RapIdApIService.php
* @author :lyh
* @method :post
* @time :2025/3/25 11:36
... ... @@ -13,15 +13,17 @@ use App\Helper\Country;
/**
* @remark :google关键字扩展
* @name :GoogleSearchService
* @name :RapIdApIService
* @author :lyh
* @method :post
* @time :2025/3/25 11:38
*/
class GoogleSearchService
class RapIdApIService
{
public $url = "";
public $key = '3eba1ba999msh3a7c11101a7e298p19924bjsn5089487f7c37';
/**
* @remark :扩展关键词请求数据
* @name :requestUrl
... ... @@ -67,7 +69,7 @@ class GoogleSearchService
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-rapidapi-host: google-keyword-insight1.p.rapidapi.com",
"x-rapidapi-key: d246239565mshc29088b58ff484dp17c0bdjsn2d28d03622c7"
"x-rapidapi-key: $this->key"
],
]);
$response = curl_exec($curl);
... ...