|
@@ -1325,9 +1325,10 @@ class PublicController extends AbstractController
|
|
|
*/
|
|
|
public function getIpInfo()
|
|
|
{
|
|
|
- $comm = new CommonService();
|
|
|
- $ip = $comm->userIp();
|
|
|
- $result = $this->publicServiceClient->getIpInfo(['id'=>$ip]);
|
|
|
+
|
|
|
+ $ip = $this->request->getHeader('x-forwarded-for')[0] ?? $this->request->getHeader('x-real-ip')[0] ?? $this->request->getServerParams()['remote_addr'] ?? '0.0.0.0';
|
|
|
+ var_dump("========",$ip);
|
|
|
+ $result = $this->publicServiceClient->getIpInfo(['ip'=>$ip]);
|
|
|
var_dump("========",$result);
|
|
|
return $result['code'] == 200 ? Result::success($result['data']) : Result::error($result['message']);
|
|
|
}
|