|
@@ -370,11 +370,7 @@ class RelayInquiry extends Command |
|
@@ -370,11 +370,7 @@ class RelayInquiry extends Command |
|
370
|
|
370
|
|
|
371
|
$this->output('获取转发ip');
|
371
|
$this->output('获取转发ip');
|
|
372
|
// TODO 获取IP:如果是简码,查询数据库获取对应的国家, 如果是国家使用翻译, 再转化成IP
|
372
|
// TODO 获取IP:如果是简码,查询数据库获取对应的国家, 如果是国家使用翻译, 再转化成IP
|
|
373
|
- if (strlen($form->country) == 2) {
|
|
|
|
374
|
- $country = $this->getCountry($form->country);
|
|
|
|
375
|
- } else {
|
|
|
|
376
|
- $country = Translate::tran($form->country, 'zh');
|
|
|
|
377
|
- }
|
373
|
+ $country = $form->country_name;
|
|
378
|
// 有国家 通过国家查询, 如果没有获取到就随机获取
|
374
|
// 有国家 通过国家查询, 如果没有获取到就随机获取
|
|
379
|
$where = [];
|
375
|
$where = [];
|
|
380
|
$country && $where['ip_area'] = $country;
|
376
|
$country && $where['ip_area'] = $country;
|
|
@@ -499,22 +495,6 @@ class RelayInquiry extends Command |
|
@@ -499,22 +495,6 @@ class RelayInquiry extends Command |
|
499
|
}
|
495
|
}
|
|
500
|
|
496
|
|
|
501
|
/**
|
497
|
/**
|
|
502
|
- * 通过国家简码获取国家名称
|
|
|
|
503
|
- * @param $code
|
|
|
|
504
|
- * @return string
|
|
|
|
505
|
- */
|
|
|
|
506
|
- public function getCountry($code)
|
|
|
|
507
|
- {
|
|
|
|
508
|
- $cache_key = 'inquiry_world_country';
|
|
|
|
509
|
- $country_code = Cache::get($cache_key, function () use ($cache_key) {
|
|
|
|
510
|
- $country_code = DB::table('gl_world_country_city')->where(['pid' => 0])->pluck('chinese_name', 'iso2')->toArray();
|
|
|
|
511
|
- Cache::put($cache_key, $country_code, 86400);
|
|
|
|
512
|
- return $country_code;
|
|
|
|
513
|
- });
|
|
|
|
514
|
- return empty($country_code[$code]) ? '' : $country_code[$code];
|
|
|
|
515
|
- }
|
|
|
|
516
|
-
|
|
|
|
517
|
- /**
|
|
|
|
518
|
* 获取头信息
|
498
|
* 获取头信息
|
|
519
|
* @param $ip_area
|
499
|
* @param $ip_area
|
|
520
|
* @param $lang
|
500
|
* @param $lang
|