作者 刘锟

update

@@ -147,6 +147,11 @@ class InquiryForwardLogic extends BaseLogic @@ -147,6 +147,11 @@ class InquiryForwardLogic extends BaseLogic
147 } 147 }
148 $is_v6 = $project_version->version == 6 ? 1 : 0; 148 $is_v6 = $project_version->version == 6 ? 1 : 0;
149 149
  150 + //获取国家
  151 + $country = $this->param['country'] ?? '';
  152 + if(!$country){
  153 + $country = file_get_contents("http://ip.globalso.com?ip=" . $this->param['ip']);
  154 + }
150 155
151 //获取发送时间 156 //获取发送时间
152 if (isset($this->param['inquiry_date']) && $this->param['inquiry_date']) { 157 if (isset($this->param['inquiry_date']) && $this->param['inquiry_date']) {
@@ -156,7 +161,7 @@ class InquiryForwardLogic extends BaseLogic @@ -156,7 +161,7 @@ class InquiryForwardLogic extends BaseLogic
156 //未填写时间 161 //未填写时间
157 //1.根据时差获取当地随机10-18点时间 162 //1.根据时差获取当地随机10-18点时间
158 $timezoneModel = new AreaTimezone(); 163 $timezoneModel = new AreaTimezone();
159 - $country_area = $timezoneModel->read(['name' => $info['country']], ['diff']); 164 + $country_area = $timezoneModel->read(['name' => $country], ['diff']);
160 $diff = $country_area ? $country_area['diff'] : 0; 165 $diff = $country_area ? $country_area['diff'] : 0;
161 if ($diff > 0) { 166 if ($diff > 0) {
162 $area_time = date('Y-m-d H:i:s', strtotime($now . ' +' . $diff . ' hours')); 167 $area_time = date('Y-m-d H:i:s', strtotime($now . ' +' . $diff . ' hours'));
@@ -196,7 +201,7 @@ class InquiryForwardLogic extends BaseLogic @@ -196,7 +201,7 @@ class InquiryForwardLogic extends BaseLogic
196 $start_at = $now; 201 $start_at = $now;
197 } 202 }
198 203
199 - InquiryRelayDetail::createInquiry($info['id'], $website, $info['country'], $this->param['ip'], $this->param['name'], $this->param['email'], $this->param['phone'] ?? '', $this->param['message'], $is_v6, json_encode([$url]), $start_at); 204 + InquiryRelayDetail::createInquiry($info['id'], $website, $country, $this->param['ip'], $this->param['name'], $this->param['email'], $this->param['phone'] ?? '', $this->param['message'], $is_v6, json_encode([$url]), $start_at);
200 205
201 $num += 1; 206 $num += 1;
202 } 207 }