作者 lyh

gx

@@ -980,7 +980,7 @@ class Country @@ -980,7 +980,7 @@ class Country
980 * @method :post 980 * @method :post
981 * @time :2025/3/27 10:38 981 * @time :2025/3/27 10:38
982 */ 982 */
983 -public function getCountryNameByAlpha3($alpha3) { 983 +public static function getCountryNameByAlpha3($alpha3) {
984 // ISO 3166-1 alpha-3 国家码与国家名称的映射 984 // ISO 3166-1 alpha-3 国家码与国家名称的映射
985 $countries = [ 985 $countries = [
986 'AFG' => 'Afghanistan', 986 'AFG' => 'Afghanistan',
@@ -9,6 +9,8 @@ @@ -9,6 +9,8 @@
9 9
10 namespace App\Services; 10 namespace App\Services;
11 11
  12 +use App\Helper\Country;
  13 +
12 /** 14 /**
13 * @remark :google关键字扩展 15 * @remark :google关键字扩展
14 * @name :GoogleSearchService 16 * @name :GoogleSearchService
@@ -75,7 +77,14 @@ class GoogleSearchService @@ -75,7 +77,14 @@ class GoogleSearchService
75 ]; 77 ];
76 $this->url = 'https://www.cmer.site/api/google/search'; 78 $this->url = 'https://www.cmer.site/api/google/search';
77 $url = $this->url.'?domain='.$domain.'&q='.$data[$search]; 79 $url = $this->url.'?domain='.$domain.'&q='.$data[$search];
78 - return http_get($url); 80 + $data = http_get($url);
  81 + if(!empty($data) && ($search == 5)){
  82 + foreach ($data as $key => $val){
  83 + $val['keys_country'] = Country::getCountryNameByAlpha3($val['keys'][0]);
  84 + $data[$key] = $val;
  85 + }
  86 + }
  87 + return $data;
79 } 88 }
80 89
81 } 90 }