getOAuthCredentialsFile($this->_oAuthCredentialsFile); if (!$oauth_credentials) dd('CredentialsFile not exists'); $httpClient = new Client(['verify' => false]); $client = new Google_Client(); $client->setHttpClient($httpClient); $client->setAuthConfig($oauth_credentials); $client->addScope([Google_Service_Webmasters::WEBMASTERS]); if ($request->input('code')) { $token = $client->fetchAccessTokenWithAuthCode($request->input('code')); dd($token); $client->setAccessToken($token); $service = new Google_Service_Webmasters($client); $this->makeSearchConsoleData($service); dd('success'); } else { dd('google 授权授权失败'); } } /** * 授权 * @throws \Google_Exception */ public function oauth() { $oauth_credentials = $this->getOAuthCredentialsFile($this->_oAuthCredentialsFile); if (!$oauth_credentials) dump('CredentialsFile not exists'); $httpClient = new Client([ 'verify' => false ]); $client = new Google_Client(); $client->setHttpClient($httpClient); $client->setAuthConfig($oauth_credentials); $client->setRedirectUri($this->_redirectUrl); $client->addScope([Google_Service_Webmasters::WEBMASTERS]); $authUrl = $client->createAuthUrl(); return redirect($authUrl); // header('Location: ' . $authUrl); // exit; } protected function getOAuthCredentialsFile($file) { if (file_exists($file)) { return $file; } return false; } protected $_webmasterStartTime; /** * 生成webmaster数据 * @param $service */ public function makeSearchConsoleData($service) { ignore_user_abort(true); set_time_limit(0); $body = new Google_Service_Webmasters_SearchAnalyticsQueryRequest(); $ym = date('Ym', strtotime('-1 month'));//默认读取上个月的数据 $this->_webmasterStartTime = strtotime($ym . '01'); $sites = Site::query()->where([])->get(); foreach ($sites as $key => $item) { if (empty($item['webmaster_domain'])) { continue; } if (empty($item['report_day'])) { continue; } if (!WebmasterFlow::query()->where(['flow_ym' => $ym, 'site_id' => $item->id])->exists()) { $isFirst = 0; if (!WebmasterFlow::query()->where(['site_id' => $item->id])->exists()) { $isFirst = 1; } $flow = WebmasterFlow::query()->create([ //提前记录此项目已生成webmaster数据 'project_id' => $item['id'], 'flow_ym' => $ym, 'create_time' => time(), 'webmaster_domain' => $item['webmaster_domain'], 'status' => 1 ]); $finalResult = 1; $this->traffic($body, $item, $service, $finalResult, $isFirst); $this->homepageKeywords($body, $item, $service, $finalResult, $isFirst); $this->countryTraffic($body, $item, $service, $finalResult, $isFirst); $this->includePage($body, $item, $service, $finalResult, $isFirst); $flow->update(['status' => $finalResult]); } } } /** * time 1号的时间戳 * @param $time * @return false|int */ public function getEndDate($time) { return date('Y-m-d', strtotime('+1 month -1 day', $time)); } /** * webmaster 效果 * @param Google_Service_Webmasters_SearchAnalyticsQueryRequest $body * @param $project * @param $service * @param $finalResult * @param $isFirst //是否是第一次 * @return mixed */ public function traffic(Google_Service_Webmasters_SearchAnalyticsQueryRequest $body, $project, $service, &$finalResult, $isFirst) { $frequency = 1; if ($isFirst) { $frequency = 6; //如果是第一次查6次 } for ($count = 0; $count < $frequency; $count++) { $startTime = strtotime('-' . $count . ' month', $this->_webmasterStartTime); $body->setDimensions(['date']); $body->setStartDate(date('Y-m-d', $startTime)); $body->setEndDate($this->getEndDate($startTime)); try { $results = $service->searchanalytics->query($project['webmaster_domain'], $body); } catch (\Throwable $exception) { $finalResult = 0; //如果有发现查询错误直接终止 return WebmasterLog::query()->create([ 'project_id' => $project['id'], 'domain' => $project['webmaster_domain'], 'ym' => date('Ym', $startTime), 'create_time' => time(), 'method' => __METHOD__, 'detail' => $exception->getMessage() ]); } if (!empty($results->rows)) { foreach ($results->rows as $item) { if (empty($item['keys'][0])) continue; WebmasterEffect::query()->create([ 'project_id' => $project['id'], 'domain' => $project['webmaster_domain'], 'date_key' => $item['keys'][0], 'clicks' => $item['clicks'], 'impressions' => $item['impressions'], 'ctr' => $item['ctr'], 'position' => $item['position'], 'create_time' => time(), 'ym' => date('Ym', $startTime) ]); } } } } /** * 整站关键词首页量=>排名小于10的 个数相加 query * @param Google_Service_Webmasters_SearchAnalyticsQueryRequest $body * @param $project * @param $service * @param $finalResult * @param $isFirst * @return mixed */ public function homepageKeywords(Google_Service_Webmasters_SearchAnalyticsQueryRequest $body, $project, $service, &$finalResult, $isFirst) { $frequency = 1; if ($isFirst) { $frequency = 6; //如果是第一次查6次 } for ($count = 0; $count < $frequency; $count++) { $startTime = strtotime('-' . $count . ' month', $this->_webmasterStartTime); $body->setStartDate(date('Y-m-d', $startTime)); $body->setEndDate($this->getEndDate($startTime)); $body->setDimensions(['query']); try { $results = $service->searchanalytics->query($project['webmaster_domain'], $body); } catch (\Throwable $exception) { $finalResult = 0; return WebmasterLog::query()->create([ 'project_id' => $project['id'], 'webmaster_domain' => $project['webmaster_domain'], 'ym' => date('Ym', $startTime), 'create_time' => time(), 'method' => __METHOD__, 'detail' => $exception->getMessage() ]); } if (!empty($results->rows)) { $total = 0; foreach ($results->rows as $item) { if ($item['position'] < 10) { WebmasterKeywordInfo::query()->create([ 'domain' => $project['webmaster_domain'], 'project_id' => $project['id'], 'query' => $item['keys'][0] ? $item['keys'][0] : '', 'clicks' => $item['clicks'], 'impressions' => $item['impressions'], 'ctr' => $item['ctr'], 'position' => $item['position'], 'ym' => date('Ym', $startTime), 'create_time' => time() ]); $total++; } } WebmasterKeyword::query()->create([ 'project_id' => $project['id'], 'ym' => date('Ym', $startTime), 'domain' => $project['webmaster_domain'], 'total' => $total, 'create_time' => time() ]); } } } /** * webmaster 覆盖率 有效网页 * @param Google_Service_Webmasters_SearchAnalyticsQueryRequest $body * @param $project * @param $service * @param $finalResult * @param $isFirst * @return mixed */ public function includePage(Google_Service_Webmasters_SearchAnalyticsQueryRequest $body, $project, $service, &$finalResult, $isFirst) { $frequency = 1; if ($isFirst) { $frequency = 6; //如果是第一次查6次 } for ($count = 0; $count < $frequency; $count++) { $body->setDimensions(['page']); $startTime = strtotime('-' . $count . ' month', $this->_webmasterStartTime); $body->setStartDate(date('Y-m-d', $startTime)); $body->setEndDate($this->getEndDate($startTime)); try { $results = $service->searchanalytics->query($project['webmaster_domain'], $body); } catch (\Throwable $exception) { $finalResult = 0; return WebmasterLog::query()->create([ 'project_id' => $project['id'], 'webmaster_domain' => $project['webmaster_domain'], 'ym' => date('Ym', $startTime), 'create_time' => time(), 'method' => __METHOD__, 'detail' => $exception->getMessage() ]); } if (!empty($results->rows)) { WebmasterInclude::query()->create([ 'project_id' => $project['id'], 'domain' => $project['webmaster_domain'], 'total' => count($results->rows), 'create_time' => time(), 'ym' => date('Ym', $startTime) ]); } } } /** * 国家地区分布 * @param Google_Service_Webmasters_SearchAnalyticsQueryRequest $body * @param $project * @param $service * @param $finalResult * @param $isFirst * @return mixed */ public function countryTraffic(Google_Service_Webmasters_SearchAnalyticsQueryRequest $body, $project, $service, &$finalResult, $isFirst) { $frequency = 1; if ($isFirst) { $frequency = 6; //如果是第一次查6次 } for ($count = 0; $count < $frequency; $count++) { $regions = $this->regions(); $body->setDimensions(['country']); $startTime = strtotime('-' . $count . ' month', $this->_webmasterStartTime); $body->setStartDate(date('Y-m-d', $startTime)); $body->setEndDate($this->getEndDate($startTime)); try { $results = $service->searchanalytics->query($project['webmaster_domain'], $body); } catch (\Throwable $exception) { $finalResult = 0; return WebmasterLog::query()->create([ 'project_id' => $project['id'], 'webmaster_domain' => $project['webmaster_domain'], 'ym' => date('Ym', $startTime), 'create_time' => time(), 'method' => __METHOD__, 'detail' => $exception->getMessage() ]); } if (!empty($results->rows)) { $rows = $this->objectToArray($results->rows); $clicksList = array_column($rows, 'clicks'); array_multisort($clicksList, SORT_DESC, $rows); $totalClicks = array_sum($clicksList); $fiveTotalRate = $fiveTotalClicks = 0; for ($count = 0; $count < 5; $count++) { $rate = $rows[$count]['clicks'] / $totalClicks; $fiveTotalRate += $rate; $fiveTotalClicks += $rows[$count]['clicks']; WebmasterCountry::query()->create([ 'project_id' => $project['id'], 'domain' => $project['webmaster_domain'], 'clicks' => $rows[$count]['clicks'], 'rate' => $rate, 'country_code' => $rows[$count]['keys'][0], 'country_zh' => $regions[strtoupper($rows[$count]['keys'][0])]['zh'], 'create_time' => time(), 'ym' => date('Ym', $startTime) ]); } WebmasterCountry::query()->create([ 'project_id' => $project['id'], 'domain' => $project['webmaster_domain'], 'clicks' => $totalClicks - $fiveTotalClicks, 'rate' => 1 - $fiveTotalRate, 'country_code' => '', 'country_zh' => '其他', 'create_time' => time(), 'ym' => date('Ym', $startTime) ]); } } } /** * 将二维数组下的对象转为数组 * @param $data * @return mixed */ protected function objectToArray($data) { foreach ($data as &$item) { $item = (array)$item; } return $data; } protected function regions() { return [ 'ABW' => [ 'en' => 'Aruba', 'zh' => '阿鲁巴岛' ], 'AFG' => [ 'en' => 'Afghanistan', 'zh' => '阿富汗' ], 'AGO' => [ 'en' => 'Angola', 'zh' => '安哥拉' ], 'AIA' => [ 'en' => 'Anguilla', 'zh' => '安圭拉岛' ], 'ALA' => [ 'en' => 'Aland Islands',//Åland Islands 'zh' => '阿兰群岛' ], 'ALB' => [ 'en' => 'Albania', 'zh' => '阿尔巴尼亚' ], 'AND' => [ 'en' => 'Andorra', 'zh' => '安道尔' ], 'ARE' => [ 'en' => 'United Arab Emirates', 'zh' => '阿拉伯联合酋长国' ], 'ARG' => [ 'en' => 'Argentina', 'zh' => '阿根廷' ], 'ARM' => [ 'en' => 'Armenia', 'zh' => '亚美尼亚' ], 'ASM' => [ 'en' => 'American Samoa', 'zh' => '美属萨摩亚' ], 'ATA' => [ 'en' => 'Antarctica', 'zh' => '南极洲' ], 'ATF' => [ 'en' => 'French Southern Territories', 'zh' => '法国南部地区' ], 'ATG' => [ 'en' => 'Antigua and Barbuda', 'zh' => '安提瓜和巴布达' ], 'AUS' => [ 'en' => 'Australia', 'zh' => '澳大利亚' ], 'AUT' => [ 'en' => 'Austria', 'zh' => '奥地利' ], 'AZE' => [ 'en' => 'Azerbaijan', 'zh' => '阿塞拜疆' ], 'BDI' => [ 'en' => 'Burundi', 'zh' => '布隆迪' ], 'BEL' => [ 'en' => 'Belgium', 'zh' => '比利时' ], 'BEN' => [ 'en' => 'Benin', 'zh' => '贝宁' ], 'BES' => [ 'en' => 'Bonaire, Sint Eustatius and Saba', 'zh' => '博奈尔,圣尤斯塔修斯和示巴' ], 'BFA' => [ 'en' => 'Burkina Faso', 'zh' => '布吉纳法索' ], 'BGD' => [ 'en' => 'Bangladesh', 'zh' => '孟加拉国' ], 'BGR' => [ 'en' => 'Bulgaria', 'zh' => '保加利亚' ], 'BHR' => [ 'en' => 'Bahrain', 'zh' => '巴林' ], 'BHS' => [ 'en' => 'Bahamas', 'zh' => '巴哈马群岛' ], 'BIH' => [ 'en' => 'Bosnia and Herzegovina', 'zh' => '波斯尼亚和黑塞哥维那' ], 'BLM' => [ 'en' => 'Saint Barthélemy', 'zh' => '圣巴特尔米' ], 'BLR' => [ 'en' => 'Belarus', 'zh' => '白俄罗斯' ], 'BLZ' => [ 'en' => 'Belize', 'zh' => '伯利兹' ], 'BMU' => [ 'en' => 'Bermuda', 'zh' => '百慕大' ], 'BOL' => [ 'en' => 'Bolivia(Plurinational State of)', 'zh' => '玻利维亚' ], 'BRA' => [ 'en' => 'Brazil', 'zh' => '巴西' ], 'BRB' => [ 'en' => 'Barbados', 'zh' => '巴巴多斯' ], 'BRN' => [ 'en' => 'Brunei Darussalam', 'zh' => '文莱' ], 'BTN' => [ 'en' => 'Bhutan', 'zh' => '不丹' ], 'BVT' => [ 'en' => 'Bouvet Island', 'zh' => '布维岛' ], 'BWA' => [ 'en' => 'Botswana', 'zh' => '博茨瓦纳' ], 'CAF' => [ 'en' => 'Central African Republic', 'zh' => '中非共和国' ], 'CAN' => [ 'en' => 'Canada', 'zh' => '加拿大' ], 'CCK' => [ 'en' => 'Cocos(Keeling) Islands', 'zh' => '科科斯(基林)群岛' ], 'CHE' => [ 'en' => 'Switzerland', 'zh' => '瑞士' ], 'CHL' => [ 'en' => 'Chile', 'zh' => '智利' ], 'CHN' => [ 'en' => 'China', 'zh' => '中国' ], 'CIV' => [ 'en' => 'Cote d\'Ivoire',//Côte d'Ivoire 'zh' => '科特迪瓦' ], 'CMR' => [ 'en' => 'Cameroon', 'zh' => '喀麦隆' ], 'COD' => [ 'en' => 'Congo, Democratic Republic of the', 'zh' => '刚果,民主共和国' ], 'COG' => [ 'en' => 'Congo', 'zh' => '刚果' ], 'COK' => [ 'en' => 'Congo', 'zh' => '库克群岛' ], 'COL' => [ 'en' => 'Colombia', 'zh' => '哥伦比亚' ], 'COM' => [ 'en' => 'Comoros', 'zh' => '科摩罗' ], 'CPV' => [ 'en' => 'Cabo Verde', 'zh' => '佛得角' ], 'CRI' => [ 'en' => 'Costa Rica', 'zh' => '哥斯达黎加' ], 'CUB' => [ 'en' => 'Cuba', 'zh' => '古巴' ], 'CUW' => [ 'en' => 'Curaçao', 'zh' => 'Curaçao' ], 'CXR' => [ 'en' => 'Christmas Island', 'zh' => '圣诞岛' ], 'CYM' => [ 'en' => 'Cayman Islands', 'zh' => '开曼群岛' ], 'CYP' => [ 'en' => 'Cyprus', 'zh' => '塞浦路斯' ], 'CZE' => [ 'en' => 'Czechia', 'zh' => '捷克' ], 'DEU' => [ 'en' => 'Germany', 'zh' => 'Germany' ], 'DJI' => [ 'en' => 'Djibouti', 'zh' => '吉布提' ], 'DMA' => [ 'en' => 'Dominica', 'zh' => '多米尼加' ], 'DNK' => [ 'en' => 'Denmark', 'zh' => '丹麦' ], 'DOM' => [ 'en' => 'Dominican Republic', 'zh' => '多米尼加共和国' ], 'DZA' => [ 'en' => 'Algeria', 'zh' => 'Algeria' ], 'ECU' => [ 'en' => 'Ecuador', 'zh' => 'Ecuador' ], 'EGY' => [ 'en' => 'Egypt', 'zh' => '埃及' ], 'ERI' => [ 'en' => 'Eritrea', 'zh' => '厄立特里亚' ], 'ESH' => [ 'en' => 'Western Sahara', 'zh' => '西撒哈拉' ], 'ESP' => [ 'en' => 'Spain', 'zh' => '西班牙' ], 'EST' => [ 'en' => 'Estonia', 'zh' => '爱沙尼亚' ], 'ETH' => [ 'en' => 'Ethiopia', 'zh' => '埃塞俄比亚' ], 'FIN' => [ 'en' => 'Finland', 'zh' => '芬兰' ], 'FJI' => [ 'en' => 'Fiji', 'zh' => '斐济' ], 'FLK' => [ 'en' => 'Falkland Islands(Malvinas)', 'zh' => '福克兰群岛(马尔维纳斯群岛)' ], 'FRA' => [ 'en' => 'France', 'zh' => '法国' ], 'FRO' => [ 'en' => 'Faroe Islands', 'zh' => 'Faroe Islands' ], 'FSM' => [ 'en' => 'Micronesia(Federated States of)', 'zh' => '密克罗尼西亚(联邦)' ], 'GAB' => [ 'en' => 'Gabon', 'zh' => '加蓬' ], 'GBR' => [ 'en' => 'United Kingdom of Great Britain and Northern Ireland', 'zh' => '英国' ], 'GEO' => [ 'en' => 'Georgias', 'zh' => '乔治亚州' ], 'GGY' => [ 'en' => 'Guernsey', 'zh' => '根西岛' ], 'GHA' => [ 'en' => 'Ghana', 'zh' => '加纳' ], 'GIB' => [ 'en' => 'Gibraltar', 'zh' => '直布罗陀' ], 'GIN' => [ 'en' => 'Guinea', 'zh' => '几内亚' ], 'GLP' => [ 'en' => 'Guadeloupe', 'zh' => '瓜德罗普岛' ], 'GMB' => [ 'en' => 'Gambia', 'zh' => '冈比亚' ], 'GNB' => [ 'en' => 'Guinea - Bissau', 'zh' => '几内亚-比绍' ], 'GNQ' => [ 'en' => 'Equatorial Guinea', 'zh' => '赤道几内亚' ], 'GRC' => [ 'en' => 'Greece', 'zh' => '希腊' ], 'GRD' => [ 'en' => 'Grenada', 'zh' => '格林纳达' ], 'GRL' => [ 'en' => 'Greenland', 'zh' => '格陵兰岛' ], 'GTM' => [ 'en' => 'Guatemala', 'zh' => '危地马拉' ], 'GUF' => [ 'en' => 'French Guiana', 'zh' => '法属圭亚那' ], 'GUM' => [ 'en' => 'Guam', 'zh' => '关岛' ], 'GUY' => [ 'en' => 'Guyana', 'zh' => '圭亚那' ], 'HKG' => [ 'en' => 'Hong Kong', 'zh' => '中国香港' ], 'HMD' => [ 'en' => 'Heard Island and McDonald Islands', 'zh' => '赫德岛和麦克唐纳岛' ], 'HND' => [ 'en' => 'Honduras', 'zh' => '洪都拉斯' ], 'HRV' => [ 'en' => 'Croatia', 'zh' => '克罗地亚' ], 'HTI' => [ 'en' => 'Haiti', 'zh' => '海地' ], 'HUN' => [ 'en' => 'Hungary', 'zh' => '匈牙利' ], 'IDN' => [ 'en' => 'Indonesia', 'zh' => '印度尼西亚' ], 'IMN' => [ 'en' => 'Isle of Man', 'zh' => '英国属地曼岛' ], 'IND' => [ 'en' => 'India', 'zh' => '印度' ], 'IOT' => [ 'en' => 'British Indian Ocean Territory', 'zh' => '英属印度洋领土' ], 'IRL' => [ 'en' => 'Ireland', 'zh' => '爱尔兰' ], 'IRN' => [ 'en' => 'Iran(Islamic Republic of)', 'zh' => '伊朗(伊斯兰共和国)' ], 'IRQ' => [ 'en' => 'Iraq', 'zh' => '伊拉克' ], 'ISL' => [ 'en' => 'Iceland', 'zh' => '冰岛' ], 'ISR' => [ 'en' => 'Israel', 'zh' => '以色列' ], 'ITA' => [ 'en' => 'Italy', 'zh' => '意大利' ], 'JAM' => [ 'en' => 'Jamaica', 'zh' => '牙买加' ], 'JEY' => [ 'en' => 'Jersey', 'zh' => '泽西岛' ], 'JOR' => [ 'en' => 'Jordan', 'zh' => '约旦' ], 'JPN' => [ 'en' => 'Japan', 'zh' => '日本' ], 'KAZ' => [ 'en' => 'Kazakhstan', 'zh' => '哈萨克斯坦' ], 'KEN' => [ 'en' => 'Kenya', 'zh' => '肯尼亚' ], 'KGZ' => [ 'en' => 'Kyrgyzstan', 'zh' => '吉尔吉斯斯坦' ], 'KHM' => [ 'en' => 'Cambodia', 'zh' => '柬埔寨' ], 'KIR' => [ 'en' => 'Kiribati', 'zh' => 'Kiribati' ], 'KNA' => [ 'en' => 'Saint Kitts and Nevis', 'zh' => '圣基茨和尼维斯' ], 'KOR' => [ 'en' => 'Korea, Republic of', 'zh' => '朝鲜共和国' ], 'KWT' => [ 'en' => 'Kuwait', 'zh' => '科威特' ], 'LAO' => [ 'en' => 'Lao People\'s Democratic Republic', 'zh' => '' ], 'LBN' => [ 'en' => 'Lebanon', 'zh' => '黎巴嫩' ], 'LBR' => [ 'en' => 'Liberia', 'zh' => '利比里亚' ], 'LBY' => [ 'en' => 'Libya', 'zh' => '利比亚' ], 'LCA' => [ 'en' => 'Saint Lucia', 'zh' => '圣卢西亚岛' ], 'LIE' => [ 'en' => 'Liechtenstein', 'zh' => '列支敦斯登' ], 'LKA' => [ 'en' => 'Sri Lanka', 'zh' => '斯里兰卡' ], 'LSO' => [ 'en' => 'Lesotho', 'zh' => '莱索托' ], 'LTU' => [ 'en' => 'Lithuania', 'zh' => '立陶宛' ], 'LUX' => [ 'en' => 'Luxembourg', 'zh' => '卢森堡' ], 'LVA' => [ 'en' => 'Latvia', 'zh' => '拉脱维亚' ], 'MAC' => [ 'en' => 'Macao', 'zh' => '中国澳门' ], 'MAF' => [ 'en' => 'Saint Martin(French part)', 'zh' => '圣马丁(法国)' ], 'MAR' => [ 'en' => 'Morocco', 'zh' => '摩洛哥' ], 'MCO' => [ 'en' => 'Monaco', 'zh' => '摩纳哥' ], 'MDA' => [ 'en' => 'Moldova, Republic of', 'zh' => '摩尔多瓦共和国' ], 'MDG' => [ 'en' => 'Madagascar', 'zh' => 'Madagascar' ], 'MDV' => [ 'en' => 'Maldives', 'zh' => '马尔代夫' ], 'MEX' => [ 'en' => 'Mexico', 'zh' => '墨西哥' ], 'MHL' => [ 'en' => 'Marshall Islands', 'zh' => '马绍尔群岛' ], 'MKD' => [ 'en' => 'Macedonia, the former Yugoslav Republic of', 'zh' => '马其顿,前南斯拉夫共和国' ], 'MLI' => [ 'en' => 'Mali', 'zh' => '马里' ], 'MLT' => [ 'en' => 'Malta', 'zh' => 'Malta' ], 'MMR' => [ 'en' => 'Myanmar', 'zh' => '缅甸' ], 'MNE' => [ 'en' => 'Montenegro', 'zh' => '黑山共和国' ], 'MNG' => [ 'en' => 'Mongolia', 'zh' => '蒙古' ], 'MNP' => [ 'en' => 'Northern Mariana Islands', 'zh' => '北马里亚纳群岛' ], 'MOZ' => [ 'en' => 'Mozambique', 'zh' => '莫桑比克' ], 'MRT' => [ 'en' => 'Mauritania', 'zh' => '毛利塔尼亚' ], 'MSR' => [ 'en' => 'Montserrat', 'zh' => '蒙特塞拉特' ], 'MTQ' => [ 'en' => 'Martinique', 'zh' => '马提尼克岛' ], 'MUS' => [ 'en' => 'Mauritius', 'zh' => '毛里求斯' ], 'MWI' => [ 'en' => 'Malawi', 'zh' => '马拉维' ], 'MYS' => [ 'en' => 'Malaysia', 'zh' => '马来西亚' ], 'MYT' => [ 'en' => 'Mayotte', 'zh' => '科摩罗马约特岛' ], 'NAM' => [ 'en' => 'Namibia', 'zh' => '纳米比亚' ], 'NCL' => [ 'en' => 'New Caledonia', 'zh' => '新喀里多尼亚' ], 'NER' => [ 'en' => 'Niger', 'zh' => '尼日尔' ], 'NFK' => [ 'en' => 'Norfolk Island', 'zh' => '诺福克岛' ], 'NGA' => [ 'en' => 'Nigeria', 'zh' => '尼日利亚' ], 'NIC' => [ 'en' => 'Nicaragua', 'zh' => '尼加拉瓜' ], 'NIU' => [ 'en' => 'Niue', 'zh' => '纽埃岛' ], 'NLD' => [ 'en' => 'Netherlands', 'zh' => '荷兰' ], 'NOR' => [ 'en' => 'Norway', 'zh' => '挪威' ], 'NPL' => [ 'en' => 'Nepal', 'zh' => '尼泊尔' ], 'NRU' => [ 'en' => 'Nauru', 'zh' => '瑙鲁' ], 'NZL' => [ 'en' => 'New Zealand', 'zh' => '新西兰' ], 'OMN' => [ 'en' => 'Oman', 'zh' => '阿曼' ], 'PAK' => [ 'en' => 'Pakistan', 'zh' => '巴基斯坦' ], 'PAN' => [ 'en' => 'Panama', 'zh' => '巴拿马' ], 'PCN' => [ 'en' => 'Pitcairn', 'zh' => '皮特克恩' ], 'PHL' => [ 'en' => 'Philippines', 'zh' => '菲律宾' ], 'PER' => [ 'en' => 'Peru', 'zh' => '秘鲁' ], 'PLW' => [ 'en' => 'Palau', 'zh' => '帕劳' ], 'PNG' => [ 'en' => 'Papua New Guinea', 'zh' => '巴布新几内亚' ], 'POL' => [ 'en' => 'Poland', 'zh' => '波兰' ], 'PRI' => [ 'en' => 'Puerto Rico', 'zh' => '波多黎各' ], 'PRK' => [ 'en' => 'Korea(Democratic People\'s Republic of)', 'zh' => '朝鲜(民主主义人民共和国)' ], 'PRT' => [ 'en' => 'Portugal', 'zh' => '葡萄牙' ], 'PRY' => [ 'en' => 'Paraguay', 'zh' => '巴拉圭' ], 'PSE' => [ 'en' => 'Palestine, State of', 'zh' => '巴勒斯坦' ], 'PYF' => [ 'en' => 'French Polynesia', 'zh' => '法属波利尼西亚' ], 'QAT' => [ 'en' => 'Qatar', 'zh' => '卡塔尔' ], 'REU' => [ 'en' => 'Réunion', 'zh' => '留尼汪' ], 'ROU' => [ 'en' => 'Romania', 'zh' => 'Romania' ], 'RUS' => [ 'en' => 'Russian Federation', 'zh' => '俄罗斯联邦' ], 'RWA' => [ 'en' => 'Rwanda', 'zh' => '卢旺达' ], 'SAU' => [ 'en' => 'Saudi Arabia', 'zh' => '沙特阿拉伯' ], 'SDN' => [ 'en' => 'Sudan', 'zh' => '苏丹' ], 'SEN' => [ 'en' => 'Senegal', 'zh' => '塞内加尔' ], 'SGP' => [ 'en' => 'Singapore', 'zh' => '新加坡' ], 'SGS' => [ 'en' => 'South Georgia and the South Sandwich Islands', 'zh' => '南乔治亚和南桑威奇群岛' ], 'SHN' => [ 'en' => 'Saint Helena, Ascension and Tristan da Cunha', 'zh' => '圣海伦娜,阿森松和特里斯坦·达库尼亚' ], 'SJM' => [ 'en' => 'Svalbard and Jan Mayen', 'zh' => '斯瓦尔巴特群岛和扬·马延' ], 'SLB' => [ 'en' => 'Solomon Islands', 'zh' => '所罗门群岛' ], 'SLE' => [ 'en' => 'Sierra Leone', 'zh' => '塞拉利昂' ], 'SLV' => [ 'en' => 'El Salvador', 'zh' => '萨尔瓦多' ], 'SMR' => [ 'en' => 'San Marino', 'zh' => '圣马力诺' ], 'SOM' => [ 'en' => 'Somalia', 'zh' => '索马里' ], 'SPM' => [ 'en' => 'Saint Pierre and Miquelon', 'zh' => '圣皮埃尔和密克隆' ], 'SRB' => [ 'en' => 'Serbia', 'zh' => '塞尔维亚' ], 'SSD' => [ 'en' => 'South Sudan', 'zh' => '南苏丹' ], 'STP' => [ 'en' => 'Sao Tome and Principe', 'zh' => '圣多美和普林西比' ], 'SUR' => [ 'en' => 'Suriname', 'zh' => '苏里南' ], 'SVK' => [ 'en' => 'Slovakia', 'zh' => '斯洛伐克' ], 'SVN' => [ 'en' => 'Slovenia', 'zh' => '斯洛文尼亚' ], 'SWE' => [ 'en' => 'Sweden', 'zh' => '瑞典' ], 'SWZ' => [ 'en' => 'Eswatini', 'zh' => '斯威士兰' ], 'SXM' => [ 'en' => 'Sint Maarten(Dutch part)', 'zh' => '荷属圣马丁' ], 'SYC' => [ 'en' => 'Seychelles', 'zh' => '塞舌尔' ], 'SYR' => [ 'en' => 'Syrian Arab Republic', 'zh' => '阿拉伯叙利亚共和国' ], 'TCA' => [ 'en' => 'Turks and Caicos Islands', 'zh' => '特克斯和凯科斯群岛' ], 'TCD' => [ 'en' => 'Chad', 'zh' => '乍得' ], 'TGO' => [ 'en' => 'Togo', 'zh' => '多哥' ], 'THA' => [ 'en' => 'Thailand', 'zh' => '泰国' ], 'TJK' => [ 'en' => 'Tajikistan', 'zh' => '塔吉克斯坦' ], 'TKL' => [ 'en' => 'Tokelau', 'zh' => '托克劳' ], 'TKM' => [ 'en' => 'Turkmenistan', 'zh' => '土库曼斯坦' ], 'TLS' => [ 'en' => 'Timor - Leste', 'zh' => '东帝汶' ], 'TON' => [ 'en' => 'Tonga', 'zh' => '汤加' ], 'TTO' => [ 'en' => 'Trinidad and Tobago', 'zh' => '特立尼达和多巴哥' ], 'TUN' => [ 'en' => 'Tunisia', 'zh' => '突尼斯' ], 'TUR' => [ 'en' => 'Turkey', 'zh' => '土耳其' ], 'TUV' => [ 'en' => 'Tuvalu', 'zh' => '图瓦卢' ], 'TWN' => [ 'en' => 'Taiwan, Province of China', 'zh' => '中国台湾' ], 'TZA' => [ 'en' => 'Tanzania, United Republic of', 'zh' => '坦桑尼亚' ], 'UGA' => [ 'en' => 'Uganda', 'zh' => '乌干达' ], 'UKR' => [ 'en' => 'Ukraine', 'zh' => '乌克兰' ], 'UMI' => [ 'en' => 'United States Minor Outlying Islands', 'zh' => '美国本土外小岛屿' ], 'URY' => [ 'en' => 'Uruguay', 'zh' => '乌拉圭' ], 'USA' => [ 'en' => 'United States of America', 'zh' => '美国' ], 'UZB' => [ 'en' => 'Uzbekistan', 'zh' => '乌兹别克斯坦' ], 'VAT' => [ 'en' => 'Holy See', 'zh' => '圣座' ], 'VCT' => [ 'en' => 'Saint Vincent and the Grenadines', 'zh' => '圣文森特和格林纳丁斯' ], 'VEN' => [ 'en' => 'Venezuela(Bolivarian Republic of)', 'zh' => '委内瑞拉(玻利瓦尔共和国)' ], 'VGB' => [ 'en' => 'Virgin Islands(British)', 'zh' => '维尔京群岛(英国)' ], 'VIR' => [ 'en' => 'Virgin Islands(U . S .)', 'zh' => '维尔京群岛' ], 'VNM' => [ 'en' => 'Viet Nam', 'zh' => 'Viet Nam' ], 'VUT' => [ 'en' => 'Vanuatu', 'zh' => '瓦努阿图' ], 'WLF' => [ 'en' => 'Wallis and Futuna', 'zh' => '瓦利斯群岛和富图纳群岛' ], 'WSM' => [ 'en' => 'Samoa', 'zh' => '萨摩亚' ], 'YEM' => [ 'en' => 'Yemen', 'zh' => '也门' ], 'ZAF' => [ 'en' => 'South Africa', 'zh' => '南非' ], 'ZMB' => [ 'en' => 'Zambia', 'zh' => '赞比亚' ], 'ZWE' => [ 'en' => 'Zimbabwe', 'zh' => '津巴布韦' ] ]; } }