Browse Source

接口优化

lizhen_gitee 11 months ago
parent
commit
60b0e78b45
2 changed files with 9 additions and 6 deletions
  1. 2 2
      application/api/controller/Pay.php
  2. 7 4
      application/common/controller/Api.php

+ 2 - 2
application/api/controller/Pay.php

@@ -36,7 +36,7 @@ class Pay extends Api
         }
 
         if(!$this->user_auth_limit()){
-            $this->error('请先完成实名认证');
+            //$this->error('请先完成实名认证');
         }
 
 
@@ -118,7 +118,7 @@ class Pay extends Api
         }
 
         if(!$this->user_auth_limit()){
-            $this->error('请先完成实名认证');
+            //$this->error('请先完成实名认证');
         }
 
         //赋值money

+ 7 - 4
application/common/controller/Api.php

@@ -440,6 +440,11 @@ class Api
     //ip获取地址
     private function ip_to_address(){
 
+        $data = [
+            'provincename' => '',
+            'cityname' => '',
+        ];
+
         try{
             $ip = request()->ip();
             //$ip = '182.37.138.94';
@@ -447,8 +452,6 @@ class Api
             // http协议:http://api.ip138.com/ip/
             // https协议:https://api.ip138.com/ip/
 
-            $data = [];
-
             $url = 'http://api.ip138.com/ip/?ip='.$ip.'&datatype=jsonp&token=693bf2e1fd44fdf7e58e7fc32ea9890e';
             $result = json_decode(curl_get($url),true);
             //dump($result);exit;
@@ -470,10 +473,10 @@ class Api
             //dump($data);
             return $data;
         }catch (Exception $e) {
-            return [];
+            return $data;
         }
 
-        return [];
+        return $data;
     }