作者 赵彬吉

update

... ... @@ -370,11 +370,7 @@ class RelayInquiry extends Command
$this->output('获取转发ip');
// TODO 获取IP:如果是简码,查询数据库获取对应的国家, 如果是国家使用翻译, 再转化成IP
if (strlen($form->country) == 2) {
$country = $this->getCountry($form->country);
} else {
$country = Translate::tran($form->country, 'zh');
}
$country = $form->country_name;
// 有国家 通过国家查询, 如果没有获取到就随机获取
$where = [];
$country && $where['ip_area'] = $country;
... ... @@ -499,22 +495,6 @@ class RelayInquiry extends Command
}
/**
* 通过国家简码获取国家名称
* @param $code
* @return string
*/
public function getCountry($code)
{
$cache_key = 'inquiry_world_country';
$country_code = Cache::get($cache_key, function () use ($cache_key) {
$country_code = DB::table('gl_world_country_city')->where(['pid' => 0])->pluck('chinese_name', 'iso2')->toArray();
Cache::put($cache_key, $country_code, 86400);
return $country_code;
});
return empty($country_code[$code]) ? '' : $country_code[$code];
}
/**
* 获取头信息
* @param $ip_area
* @param $lang
... ...