作者 赵彬吉
... ... @@ -10,6 +10,7 @@
namespace App\Console\Commands\LyhTest;
use App\Models\Project\AiBlogTask;
use App\Models\Project\Project;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\DB;
... ... @@ -31,12 +32,8 @@ class lyhDemo extends Command
protected $description = '更新路由';
public function handle(){
$aiBlogTaskModel = new AiBlogTask();
$lists = $aiBlogTaskModel->distinct()->pluck('project_id')->toArray();
foreach ($lists as $v){
echo '执行的项目id:'.$v;
Artisan::call('save_ai_blog_list', ['project_id' => $v]);
}
return true;
$projectModel = new Project();
$lists = $projectModel->list(['from_order_id'=>null]);
return true;
}
}
... ...
... ... @@ -269,6 +269,16 @@ class SyncProject extends Command
}
/**
* @remark :生成唯一的13位数字
* @name :stringTo13DigitNumber
* @author :lyh
* @method :post
* @time :2025/3/27 15:09
*/
public function generateUniqueString($input) {
return substr(md5($input), 0, 13);
}
/**
* @remark :设置post_id
* @name :setPostId
* @author :lyh
... ... @@ -299,6 +309,9 @@ class SyncProject extends Command
$param['channel'] = Arr::a2s(["user_id"=>"", "zone_id"=>"", "channel_id"=>""]);
}
$projectModel = new Project();
if(empty($param['from_order_id'])){
$param['from_order_id'] = $this->generateUniqueString($param['notice_order_id']);
}
$info = $projectModel->read(['from_order_id'=>$param['from_order_id'],'delete_status'=>0]);
if($info !== false){
unset($param['type']); //更新的 不更新状态了
... ...
... ... @@ -973,5 +973,261 @@ class Country
]
}';
/**
* @remark :国家码与国家名称的映射
* @name :getCountryNameByAlpha3
* @author :lyh
* @method :post
* @time :2025/3/27 10:38
*/
public function getCountryNameByAlpha3($alpha3) {
// ISO 3166-1 alpha-3 国家码与国家名称的映射
$countries = [
'AFG' => 'Afghanistan',
'ALB' => 'Albania',
'DZA' => 'Algeria',
'AND' => 'Andorra',
'AGO' => 'Angola',
'ATG' => 'Antigua and Barbuda',
'ARG' => 'Argentina',
'ARM' => 'Armenia',
'AUS' => 'Australia',
'AUT' => 'Austria',
'AZE' => 'Azerbaijan',
'BHS' => 'Bahamas',
'BHR' => 'Bahrain',
'BGD' => 'Bangladesh',
'BRB' => 'Barbados',
'BLR' => 'Belarus',
'BEL' => 'Belgium',
'BLZ' => 'Belize',
'BEN' => 'Benin',
'BTN' => 'Bhutan',
'BOL' => 'Bolivia',
'BES' => 'Bonaire, Sint Eustatius and Saba',
'BIH' => 'Bosnia and Herzegovina',
'BWA' => 'Botswana',
'BVT' => 'Bouvet Island',
'BRA' => 'Brazil',
'IOT' => 'British Indian Ocean Territory',
'BRN' => 'Brunei Darussalam',
'BGR' => 'Bulgaria',
'BFA' => 'Burkina Faso',
'BDI' => 'Burundi',
'CPV' => 'Cabo Verde',
'KHM' => 'Cambodia',
'CMR' => 'Cameroon',
'CAN' => 'Canada',
'CYM' => 'Cayman Islands',
'CAF' => 'Central African Republic',
'TCD' => 'Chad',
'CHL' => 'Chile',
'CHN' => 'China',
'CXR' => 'Christmas Island',
'CCK' => 'Cocos (Keeling) Islands',
'COL' => 'Colombia',
'COM' => 'Comoros',
'COD' => 'Congo (Democratic Republic of the)',
'COG' => 'Congo',
'COK' => 'Cook Islands',
'CRI' => 'Costa Rica',
'CIV' => 'Côte d\'Ivoire',
'HRV' => 'Croatia',
'CUB' => 'Cuba',
'CUW' => 'Curaçao',
'CYP' => 'Cyprus',
'CZE' => 'Czech Republic',
'DNK' => 'Denmark',
'DJI' => 'Djibouti',
'DMA' => 'Dominica',
'DOM' => 'Dominican Republic',
'ECU' => 'Ecuador',
'EGY' => 'Egypt',
'SLV' => 'El Salvador',
'GNQ' => 'Equatorial Guinea',
'ERI' => 'Eritrea',
'EST' => 'Estonia',
'SWZ' => 'Eswatini',
'ETH' => 'Ethiopia',
'FLK' => 'Falkland Islands (Malvinas)',
'FRO' => 'Faroe Islands',
'FJI' => 'Fiji',
'FIN' => 'Finland',
'FRA' => 'France',
'GUF' => 'French Guiana',
'PYF' => 'French Polynesia',
'ATF' => 'French Southern Territories',
'GAB' => 'Gabon',
'GMB' => 'Gambia',
'GEO' => 'Georgia',
'DEU' => 'Germany',
'GHA' => 'Ghana',
'GIB' => 'Gibraltar',
'GRC' => 'Greece',
'GRL' => 'Greenland',
'GRD' => 'Grenada',
'GLP' => 'Guadeloupe',
'GUM' => 'Guam',
'GTM' => 'Guatemala',
'GGY' => 'Guernsey',
'GIN' => 'Guinea',
'GNB' => 'Guinea-Bissau',
'GUY' => 'Guyana',
'HTI' => 'Haiti',
'HMD' => 'Heard Island and McDonald Islands',
'VAT' => 'Holy See',
'HND' => 'Honduras',
'HKG' => 'Hong Kong',
'HUN' => 'Hungary',
'ISL' => 'Iceland',
'IND' => 'India',
'IDN' => 'Indonesia',
'IRN' => 'Iran (Islamic Republic of)',
'IRQ' => 'Iraq',
'IRL' => 'Ireland',
'IMN' => 'Isle of Man',
'ISR' => 'Israel',
'ITA' => 'Italy',
'JAM' => 'Jamaica',
'JPN' => 'Japan',
'JEY' => 'Jersey',
'JOR' => 'Jordan',
'KAZ' => 'Kazakhstan',
'KEN' => 'Kenya',
'KIR' => 'Kiribati',
'KOR' => 'Korea (Republic of)',
'KWT' => 'Kuwait',
'KGZ' => 'Kyrgyzstan',
'LAO' => 'Lao People\'s Democratic Republic',
'LVA' => 'Latvia',
'LBN' => 'Lebanon',
'LSO' => 'Lesotho',
'LBR' => 'Liberia',
'LBY' => 'Libya',
'LIE' => 'Liechtenstein',
'LTU' => 'Lithuania',
'LUX' => 'Luxembourg',
'MAC' => 'Macao',
'MDG' => 'Madagascar',
'MWI' => 'Malawi',
'MYS' => 'Malaysia',
'MDV' => 'Maldives',
'MLI' => 'Mali',
'MLT' => 'Malta',
'MHL' => 'Marshall Islands',
'MTQ' => 'Martinique',
'MRT' => 'Mauritania',
'MUS' => 'Mauritius',
'MYT' => 'Mayotte',
'MEX' => 'Mexico',
'FSM' => 'Micronesia (Federated States of)',
'MDA' => 'Moldova (Republic of)',
'MCO' => 'Monaco',
'MNG' => 'Mongolia',
'MNE' => 'Montenegro',
'MSR' => 'Montserrat',
'MAR' => 'Morocco',
'MOZ' => 'Mozambique',
'MMR' => 'Myanmar',
'NAM' => 'Namibia',
'NRU' => 'Nauru',
'NPL' => 'Nepal',
'NLD' => 'Netherlands',
'NCL' => 'New Caledonia',
'NZL' => 'New Zealand',
'NIC' => 'Nicaragua',
'NER' => 'Niger',
'NGA' => 'Nigeria',
'NIU' => 'Niue',
'NFK' => 'Norfolk Island',
'MNP' => 'Northern Mariana Islands',
'NOR' => 'Norway',
'OMN' => 'Oman',
'PAK' => 'Pakistan',
'PLW' => 'Palau',
'PSE' => 'Palestine, State of',
'PAN' => 'Panama',
'PNG' => 'Papua New Guinea',
'PRY' => 'Paraguay',
'PER' => 'Peru',
'PHL' => 'Philippines',
'PCN' => 'Pitcairn',
'POL' => 'Poland',
'PRT' => 'Portugal',
'PRI' => 'Puerto Rico',
'QAT' => 'Qatar',
'REU' => 'Réunion',
'ROU' => 'Romania',
'RUS' => 'Russian Federation',
'RWA' => 'Rwanda',
'BLM' => 'Saint Barthélemy',
'SHN' => 'Saint Helena, Ascension and Tristan da Cunha',
'KNA' => 'Saint Kitts and Nevis',
'LCA' => 'Saint Lucia',
'MAF' => 'Saint Martin (French part)',
'SPM' => 'Saint Pierre and Miquelon',
'VCT' => 'Saint Vincent and the Grenadines',
'WSM' => 'Samoa',
'SMR' => 'San Marino',
'STP' => 'Sao Tome and Principe',
'SAU' => 'Saudi Arabia',
'SEN' => 'Senegal',
'SRB' => 'Serbia',
'SYC' => 'Seychelles',
'SLE' => 'Sierra Leone',
'SGP' => 'Singapore',
'SXM' => 'Sint Maarten (Dutch part)',
'SVK' => 'Slovakia',
'SVN' => 'Slovenia',
'SLB' => 'Solomon Islands',
'SOM' => 'Somalia',
'ZAF' => 'South Africa',
'SGS' => 'South Georgia and the South Sandwich Islands',
'SSD' => 'South Sudan',
'ESP' => 'Spain',
'LKA' => 'Sri Lanka',
'SDN' => 'Sudan',
'SUR' => 'Suriname',
'SJM' => 'Svalbard and Jan Mayen',
'SWE' => 'Sweden',
'CHE' => 'Switzerland',
'SYR' => 'Syrian Arab Republic',
'TWN' => 'Taiwan, Province of China',
'TJK' => 'Tajikistan',
'TZA' => 'Tanzania, United Republic of',
'THA' => 'Thailand',
'TLS' => 'Timor-Leste',
'TGO' => 'Togo',
'TKL' => 'Tokelau',
'TON' => 'Tonga',
'TTO' => 'Trinidad and Tobago',
'TUN' => 'Tunisia',
'TUR' => 'Turkey',
'TKM' => 'Turkmenistan',
'TCA' => 'Turks and Caicos Islands',
'TUV' => 'Tuvalu',
'UGA' => 'Uganda',
'UKR' => 'Ukraine',
'ARE' => 'United Arab Emirates',
'GBR' => 'United Kingdom',
'USA' => 'United States',
'URY' => 'Uruguay',
'UZB' => 'Uzbekistan',
'VUT' => 'Vanuatu',
'VEN' => 'Venezuela (Bolivarian Republic of)',
'VNM' => 'Viet Nam',
'WLF' => 'Wallis and Futuna',
'ESH' => 'Western Sahara',
'YEM' => 'Yemen',
'ZMB' => 'Zambia',
'ZWE' => 'Zimbabwe',
];
// 检查国家码是否存在于数组中
if (array_key_exists($alpha3, $countries)) {
return $countries[$alpha3];
} else {
return false;
}
}
}
... ...
... ... @@ -119,7 +119,7 @@ if (!function_exists('http_get')) {
$access_txt = curl_exec($ch1);
if (curl_errno($ch1)) {
$error_message = curl_error($ch1);
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($error_message, true) . PHP_EOL, FILE_APPEND);
errorLog('请求失败', $url, $error_message);
}
curl_close($ch1);
return json_decode($access_txt, true);
... ...
... ... @@ -12,6 +12,7 @@ namespace App\Http\Controllers\Bside\GoogleKeywordInsight;
use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\GoogleKeywordInsight\GoogleKeywordInsightLogic;
use App\Models\GoogleKeywordInsight\GoogleKeywordInsightDetail;
/**
* @remark :谷歌洞察数据
... ... @@ -35,7 +36,9 @@ class GoogleKeywordInsightController extends BaseController
],[
'keyword.required' => '关键词不能为空',
]);
$data = $logic->getGoogleInsight();
$logic->getGoogleInsight();
$detailModel = new GoogleKeywordInsightDetail();
$data = $detailModel->lists(['search'=>$this->param['keyword']],$this->page,$this->row);
$this->response('success',Code::SUCCESS,$data);
}
}
... ...
<?php
/**
* @remark :
* @name :GoogleSearchController.php
* @author :lyh
* @method :post
* @time :2025/3/27 13:53
*/
namespace App\Http\Controllers\Bside\GoogleKeywordInsight;
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 searchList(){
$this->request->validate([
'search' => 'required'
],[
'search.required' => '搜索类型不能为空',
]);
//获取当前项目域名
$domain = parse_url($this->user['domain'], PHP_URL_HOST);
$googleService = new GoogleSearchService();
$googleService->googleSearch();
$data = [];
$this->response('success',Code::SUCCESS,$data);
}
}
... ...
... ... @@ -45,11 +45,11 @@ class DomainSettingController extends BaseController
public function save(DomainSettingLogic $logic)
{
$this->request->validate([
'type' => ['required'],
'domain' => ['required'],
'record' => ['required'],
], [
'type.required' => '服务器类型不能为空',
'domain.required' => '主域名不能为空',
'record.required' => '解析记录不能为空',
]);
$logic->saveDomain();
$this->response('success', Code::SUCCESS);
... ...
... ... @@ -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\GoogleKeywordInsightService;
use App\Services\GoogleSearchService;
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\GoogleKeywordInsightService;
use App\Services\GoogleSearchService;
use Illuminate\Support\Facades\DB;
class GoogleKeywordInsightLogic extends BaseLogic
... ... @@ -35,9 +35,9 @@ class GoogleKeywordInsightLogic extends BaseLogic
* @time :2025/3/25 14:36
*/
public function getGoogleInsight(){
$data = $this->model->read(['search'=>$this->param['keyword']]);
$data = $this->model->read(['search'=>$this->param['keyword']],['id']);
if($data === false){
$this->service = new GoogleKeywordInsightService();
$this->service = new GoogleSearchService();
$data = $this->service->requestUrl($this->param['keyword']);
if(!empty($data)){
DB::beginTransaction();
... ... @@ -53,6 +53,6 @@ class GoogleKeywordInsightLogic extends BaseLogic
}
}
}
return $this->success($data);
return $this->success();
}
}
... ...
... ... @@ -9,7 +9,9 @@
namespace App\Http\Logic\Bside\SeoSetting;
use App\Helper\Arr;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\Devops\ServerConfig;
use App\Models\Devops\Servers;
use App\Models\Devops\ServersIp;
use App\Models\Domain\DomainCreateTask;
... ... @@ -37,11 +39,11 @@ class DomainSettingLogic extends BaseLogic
public function infoDomain()
{
$domain_info = $this->model->read(['project_id' => $this->user['project_id']], ['seo_type', 'seo_domain', 'seo_ftp']);
$domain = $domain_info['seo_domain'] ?: '';
$ftp = $domain_info['seo_ftp'] ? json_decode($domain['seo_ftp'], true) : ['url' => '', 'username' => '', 'password' => '', 'port' => ''];
$type = $domain_info['seo_type'] ?: 1;
$record = '';
$type = $domain_info['seo_type'] ?? WebSetting::SEO_TYPE_PUBLIC;
$domain = $domain_info['seo_domain'] ?? '';
$ftp = isset($domain_info['seo_ftp']) && $domain_info['seo_ftp'] ? Arr::s2a($domain_info['seo_ftp']) : ['url' => '', 'username' => '', 'password' => '', 'port' => ''];
$record = '';
if ($type == WebSetting::SEO_TYPE_PUBLIC) {
//公共服务器
if ($domain) {
... ... @@ -65,7 +67,8 @@ class DomainSettingLogic extends BaseLogic
/**
* @remark :保存设置
* @name :saveDomain
* @throws \App\Exceptions\AsideGlobalException
* @throws \App\Exceptions\BsideGlobalException
* @author :lyh
* @method :post
* @time :2025/3/20 16:12
... ... @@ -79,13 +82,6 @@ class DomainSettingLogic extends BaseLogic
$this->fail('主域名填写错误');
}
//获取解析服务器详情
$server_ip_model = new ServersIp();
$record_info = $server_ip_model->read(['domain' => $this->param['record']], ['id', 'servers_id', 'ip', 'domain', 'total']);
if (!$record_info) {
$this->fail('解析记录不存在');
}
//获取项目详情
$project_model = new Project();
$project_info = $project_model->read(['id' => $this->user['project_id']], ['company']);
... ... @@ -93,64 +89,125 @@ class DomainSettingLogic extends BaseLogic
$this->fail('获取项目数据失败');
}
//构建blog二级域名
$domain_array = explode('.', $domain);
if (count($domain_array) == 1) {
$this->fail('请填写正确的主域名');
} elseif (count($domain_array) == 2) {
array_unshift($domain_array, 'blog');
} else {
$domain_array[0] = 'blog';
}
$blog_domain = implode('.', $domain_array);
$server_ip_model = new ServersIp();
$domain_model = new DomainInfo();
$server_model = new Servers();
$optimize_model = new DeployOptimize();
if ($this->param['type'] == WebSetting::SEO_TYPE_PUBLIC) {
//公共服务器
$record = $this->param['record'] ?? '';
if (empty($record)) {
$this->fail('解析记录不能为空');
}
//判断blog二级域名是否已经解析
if (!check_domain_record($blog_domain, $record_info)) {
$this->fail($blog_domain . '还未解析cname至' . $this->param['record']);
}
//获取解析服务器详情
$record_info = $server_ip_model->read(['domain' => $record], ['id', 'servers_id', 'ip', 'domain', 'total']);
if (!$record_info) {
$this->fail('解析记录不存在');
}
DB::beginTransaction();
try {
//保存一条主域名记录
$setting_info = $this->model->read(['project_id' => $this->user['project_id']]);
if ($setting_info === false) {
$this->model->add(['seo_domain' => $domain, 'project_id' => $this->user['project_id']]);
//构建blog二级域名
$domain_array = explode('.', $domain);
if (count($domain_array) == 1) {
$this->fail('请填写正确的主域名');
} elseif (count($domain_array) == 2) {
array_unshift($domain_array, 'blog');
} else {
$this->model->edit(['seo_domain' => $domain], ['id' => $setting_info['id']]);
$domain_array[0] = 'blog';
}
$blog_domain = implode('.', $domain_array);
//添加域名到域名管理
$domain_model = new DomainInfo();
$info = $domain_model->read(['domain' => $blog_domain]);
if ($info === false) {
$id = $domain_model->addReturnId(['domain' => $blog_domain, 'project_id' => $this->user['project_id'], 'belong_to' => 2, 'status' => 1, 'remark' => $project_info['company']]);
//保存优化设置
$optimize_model = new DeployOptimize();
$optimize_model->edit(['domain' => $id], ['project_id' => $this->user['project_id']]);
//保存项目ip
$project_model->edit(['serve_id' => $record_info['id']], ['id' => $this->user['project_id']]);
//变更ip使用数量
$server_ip_model->edit(['total' => $record_info['total'] + 1], ['id' => $record_info['id']]);
$server_model = new Servers();
$server_model->edit(['being_number' => $record_info['total'] + 1], ['id' => $record_info['servers_id']]);
//创建建站任务
$domain_create_model = new DomainCreateTask();
$domain_create_model->add([
'server_id' => $record_info['servers_id'],
'project_id' => $this->user['project_id'],
'domain_id' => $id,
'type' => DomainCreateTask::TYPE_BLOG
]);
//判断blog二级域名是否已经解析
if (!check_domain_record($blog_domain, $record_info)) {
$this->fail($blog_domain . '还未解析cname至' . $record);
}
DB::commit();
} catch (\Exception $e) {
DB::rollBack();
$this->fail('保存失败,请联系管理员');
DB::beginTransaction();
try {
//保存一条主域名记录
$setting_info = $this->model->read(['project_id' => $this->user['project_id']]);
if ($setting_info === false) {
$this->model->add(['seo_type' => WebSetting::SEO_TYPE_PUBLIC, 'seo_domain' => $domain, 'project_id' => $this->user['project_id']]);
} else {
$this->model->edit(['seo_type' => WebSetting::SEO_TYPE_PUBLIC, 'seo_domain' => $domain], ['id' => $setting_info['id']]);
}
//添加域名到域名管理
$info = $domain_model->read(['domain' => $blog_domain]);
if ($info === false) {
$id = $domain_model->addReturnId(['domain' => $blog_domain, 'project_id' => $this->user['project_id'], 'belong_to' => 2, 'status' => 1, 'remark' => $project_info['company']]);
//保存优化设置
$optimize_model->edit(['domain' => $id], ['project_id' => $this->user['project_id']]);
//保存项目ip
$project_model->edit(['serve_id' => $record_info['id']], ['id' => $this->user['project_id']]);
//变更ip使用数量
$server_ip_model->edit(['total' => $record_info['total'] + 1], ['id' => $record_info['id']]);
$server_model->edit(['being_number' => $record_info['total'] + 1], ['id' => $record_info['servers_id']]);
//创建建站任务
$domain_create_model = new DomainCreateTask();
$domain_create_model->add([
'server_id' => $record_info['servers_id'],
'project_id' => $this->user['project_id'],
'domain_id' => $id,
'type' => DomainCreateTask::TYPE_BLOG
]);
}
DB::commit();
} catch (\Exception $e) {
DB::rollBack();
$this->fail('保存失败,请联系管理员');
}
} else {
//个人服务器
$ftp = $this->param['ftp'] ?? [];
if (empty($ftp) || empty($ftp['url']) || empty($ftp['username']) || empty($ftp['password']) || empty($ftp['port'])) {
$this->fail('ftp信息填写未完整');
}
//获取自建站服务器详情
$record_info = $server_ip_model->read(['servers_id' => ServerConfig::SELF_SITE_ID], ['id', 'servers_id', 'total']);
if (!$record_info) {
$this->fail('解析记录不存在');
}
DB::beginTransaction();
try {
//保存一条主域名记录
$setting_info = $this->model->read(['project_id' => $this->user['project_id']]);
if ($setting_info === false) {
$this->model->add(['seo_type' => WebSetting::SEO_TYPE_OWN, 'seo_domain' => $domain, 'seo_ftp' => Arr::a2s($ftp), 'project_id' => $this->user['project_id']]);
} else {
$this->model->edit(['seo_type' => WebSetting::SEO_TYPE_OWN, 'seo_domain' => $domain, 'seo_ftp' => Arr::a2s($ftp)], ['id' => $setting_info['id']]);
}
//添加域名到域名管理
$info = $domain_model->read(['domain' => $domain]);
if ($info === false) {
$id = $domain_model->addReturnId(['domain' => $domain, 'project_id' => $this->user['project_id'], 'belong_to' => 2, 'status' => 1, 'remark' => $project_info['company']]);
//保存优化设置
$optimize_model->edit(['domain' => $id], ['project_id' => $this->user['project_id']]);
//保存项目ip
$project_model->edit(['serve_id' => $record_info['id']], ['id' => $this->user['project_id']]);
//变更ip使用数量
$server_ip_model->edit(['total' => $record_info['total'] + 1], ['id' => $record_info['id']]);
$server_model->edit(['being_number' => $record_info['total'] + 1], ['id' => $record_info['servers_id']]);
}
DB::commit();
} catch (\Exception $e) {
DB::rollBack();
$this->fail('保存失败,请联系管理员');
}
}
return $this->success();
}
}
... ...
<?php
/**
* @remark :
* @name :GoogleKeywordInsightService.php
* @name :GoogleSearchService.php
* @author :lyh
* @method :post
* @time :2025/3/25 11:36
... ... @@ -11,12 +11,12 @@ namespace App\Services;
/**
* @remark :google关键字扩展
* @name :GoogleKeywordInsightService
* @name :GoogleSearchService
* @author :lyh
* @method :post
* @time :2025/3/25 11:38
*/
class GoogleKeywordInsightService
class GoogleSearchService
{
public $url = "";
... ... @@ -54,4 +54,28 @@ class GoogleKeywordInsightService
return json_decode($response,true);
}
}
/**
* @remark :google搜索
* @name :googleSearch
* @author :lyh
* @method :post
* @time :2025/3/27 11:18
* @param :date,query,page,device,country/时间、聚合、前页、设备、国家
*/
public function googleSearch($domain,$search){
$data = [
1=>'date',
2=>'query',
3=>'page',
4=>'device',
5=>'country'
];
$this->url = 'https://www.cmer.site/api/google/search';
$url = $this->url.'?domain='.$domain.'&q='.$data[$search];
return http_get($url);
}
}
... ...