作者 李宇航

合并分支 'lyh-server' 到 'master'

Lyh server



查看合并请求 !1597
@@ -269,6 +269,16 @@ class SyncProject extends Command @@ -269,6 +269,16 @@ class SyncProject extends Command
269 } 269 }
270 270
271 /** 271 /**
  272 + * @remark :生成唯一的13位数字
  273 + * @name :stringTo13DigitNumber
  274 + * @author :lyh
  275 + * @method :post
  276 + * @time :2025/3/27 15:09
  277 + */
  278 + public function generateUniqueString($input) {
  279 + return substr(md5($input), 0, 13);
  280 + }
  281 + /**
272 * @remark :设置post_id 282 * @remark :设置post_id
273 * @name :setPostId 283 * @name :setPostId
274 * @author :lyh 284 * @author :lyh
@@ -299,6 +309,9 @@ class SyncProject extends Command @@ -299,6 +309,9 @@ class SyncProject extends Command
299 $param['channel'] = Arr::a2s(["user_id"=>"", "zone_id"=>"", "channel_id"=>""]); 309 $param['channel'] = Arr::a2s(["user_id"=>"", "zone_id"=>"", "channel_id"=>""]);
300 } 310 }
301 $projectModel = new Project(); 311 $projectModel = new Project();
  312 + if(empty($param['from_order_id'])){
  313 + $param['from_order_id'] = $this->generateUniqueString($param['notice_order_id']);
  314 + }
302 $info = $projectModel->read(['from_order_id'=>$param['from_order_id'],'delete_status'=>0]); 315 $info = $projectModel->read(['from_order_id'=>$param['from_order_id'],'delete_status'=>0]);
303 if($info !== false){ 316 if($info !== false){
304 unset($param['type']); //更新的 不更新状态了 317 unset($param['type']); //更新的 不更新状态了
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :GoogleSearchController.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/3/27 13:53
  8 + */
  9 +
  10 +namespace App\Http\Controllers\Bside\GoogleKeywordInsight;
  11 +
  12 +use App\Enums\Common\Code;
  13 +use App\Http\Controllers\Bside\BaseController;
  14 +use App\Services\GoogleSearchService;
  15 +
  16 +class GoogleSearchController extends BaseController
  17 +{
  18 + /**
  19 + * @remark :google搜索数据
  20 + * @name :searchList
  21 + * @author :lyh
  22 + * @method :post
  23 + * @time :2025/3/27 13:59
  24 + */
  25 + public function searchList(){
  26 + $this->request->validate([
  27 + 'search' => 'required'
  28 + ],[
  29 + 'search.required' => '搜索类型不能为空',
  30 + ]);
  31 + //获取当前项目域名
  32 + $domain = parse_url($this->user['domain'], PHP_URL_HOST);
  33 + $googleService = new GoogleSearchService();
  34 + $googleService->googleSearch();
  35 + $data = [];
  36 + $this->response('success',Code::SUCCESS,$data);
  37 + }
  38 +}
@@ -55,17 +55,26 @@ class GoogleSearchService @@ -55,17 +55,26 @@ class GoogleSearchService
55 } 55 }
56 } 56 }
57 57
  58 +
  59 +
58 /** 60 /**
59 * @remark :google搜索 61 * @remark :google搜索
60 * @name :googleSearch 62 * @name :googleSearch
61 * @author :lyh 63 * @author :lyh
62 * @method :post 64 * @method :post
63 * @time :2025/3/27 11:18 65 * @time :2025/3/27 11:18
64 - * @param :date,query,page,device,country 66 + * @param :date,query,page,device,country/时间、聚合、前页、设备、国家
65 */ 67 */
66 - public function googleSearch($data){  
67 - $this->url = 'https://www.cmer.site/api/google/search?domain=www.suertetextile.com&q=';  
68 - $url = $this->url.$data; 68 + public function googleSearch($domain,$search){
  69 + $data = [
  70 + 1=>'date',
  71 + 2=>'query',
  72 + 3=>'page',
  73 + 4=>'device',
  74 + 5=>'country'
  75 + ];
  76 + $this->url = 'https://www.cmer.site/api/google/search';
  77 + $url = $this->url.'?domain='.$domain.'&q='.$data[$search];
69 return http_get($url); 78 return http_get($url);
70 } 79 }
71 80