作者 lyh
... ... @@ -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
... ...
... ... @@ -56,10 +56,12 @@ class MessagePush extends Base
return false;
}
//特殊处理, 要求任何时候收到询盘都要及时推送到群里面
$special_project_ids = [650];
//9-21 点,每条消息及时通知
//21-第二天 9 点,整合一起通知
$hour = date('H', strtotime($submit_at));
if($hour >= 9 && $hour < 21) {
if(($hour >= 9 && $hour < 21) || in_array($project_id, $special_project_ids)) {
$model = new self();
$model->project_id = $project_id;
$model->friend_id = $friend_id;
... ...