GoogleSearchController.php 986 字节
<?php
/**
 * @remark :
 * @name   :GoogleSearchController.php
 * @author :lyh
 * @method :post
 * @time   :2025/3/27 13:53
 */

namespace App\Http\Controllers\Bside\GoogleKeyword;

use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Services\GoogleSearchService;

class GoogleSearchController extends BaseController
{
    /**
     * @remark :google搜索数据
     * @name   :searchList
     * @author :lyh
     * @method :post
     * @time   :2025/3/27 13:59
     */
    public function getSearchList(){
        $this->request->validate([
            'search' => 'required'
        ],[
            'search.required' => '搜索类型不能为空',
        ]);
        //获取当前项目域名
        $domain = parse_url($this->user['domain'], PHP_URL_HOST);
        $googleService = new GoogleSearchService();
        $data = $googleService->googleSearch($domain,$this->param['search']);
        $this->response('success',Code::SUCCESS,$data);
    }
}