作者 lyh

gx

@@ -51,14 +51,17 @@ class GoogleKeywordInsightController extends BaseController @@ -51,14 +51,17 @@ class GoogleKeywordInsightController extends BaseController
51 * @time :2025/4/1 9:12 51 * @time :2025/4/1 9:12
52 */ 52 */
53 public function getOptimizeList(){ 53 public function getOptimizeList(){
  54 + $this->request->validate([
  55 + 'field' => 'required'
  56 + ],[
  57 + 'field.required' => 'field不能为空',
  58 + ]);
54 $projectKeywordModel = new ProjectKeyword(); 59 $projectKeywordModel = new ProjectKeyword();
55 - $info = $projectKeywordModel->read(['project_id'=>$this->user['project_id']],['main_keyword','customer_keywords']); 60 + $info = $projectKeywordModel->read(['project_id'=>$this->user['project_id']],[$this->param['filed']]);
56 if($info === false){ 61 if($info === false){
57 $this->response('success'); 62 $this->response('success');
58 } 63 }
59 - $main_keyword = explode("\r\n", $info['main_keyword']);  
60 - $customer_keywords = explode("\r\n", $info['customer_keywords']);  
61 - $array = array_merge($main_keyword, $customer_keywords); 64 + $array = explode("\r\n", $info[$this->param['filed']]);
62 $detailModel = new GoogleKeywordInsightDetail(); 65 $detailModel = new GoogleKeywordInsightDetail();
63 $resultData = []; 66 $resultData = [];
64 if(!empty($array)){ 67 if(!empty($array)){
@@ -10,6 +10,8 @@ @@ -10,6 +10,8 @@
10 namespace App\Http\Controllers\Bside\GoogleKeyword; 10 namespace App\Http\Controllers\Bside\GoogleKeyword;
11 11
12 use App\Enums\Common\Code; 12 use App\Enums\Common\Code;
  13 +use App\Helper\Country;
  14 +use App\Helper\Translate;
13 use App\Http\Controllers\Bside\BaseController; 15 use App\Http\Controllers\Bside\BaseController;
14 use App\Models\Com\NoticeLog; 16 use App\Models\Com\NoticeLog;
15 use App\Models\GoogleSearch\GoogleSearch; 17 use App\Models\GoogleSearch\GoogleSearch;
@@ -35,6 +37,14 @@ class GoogleSearchController extends BaseController @@ -35,6 +37,14 @@ class GoogleSearchController extends BaseController
35 $searchDetailModel = new GoogleSearchDetail(); 37 $searchDetailModel = new GoogleSearchDetail();
36 $this->map['project_id']= $this->user['project_id']; 38 $this->map['project_id']= $this->user['project_id'];
37 $data = $searchDetailModel->lists($this->map,$this->page,$this->row); 39 $data = $searchDetailModel->lists($this->map,$this->page,$this->row);
  40 +
  41 + if($this->param['type'] == 'country'){
  42 + $country = [];
  43 + foreach ($data as $key => $val){
  44 + $country[] = Country::getCountryNameByAlpha3($val['keys']);
  45 + }
  46 + $route = Translate::tran($country, 'en');
  47 + }
38 $this->response('success',Code::SUCCESS,$data); 48 $this->response('success',Code::SUCCESS,$data);
39 } 49 }
40 } 50 }