Ver código fonte

视频APP任务 三方接口对接

chen 1 ano atrás
pai
commit
22bef5773f
1 arquivos alterados com 46 adições e 1 exclusões
  1. 46 1
      application/api/controller/Index.php

+ 46 - 1
application/api/controller/Index.php

@@ -14,7 +14,7 @@ use app\common\library\Token;
  */
 class Index extends Api
 {
-    protected $noNeedLogin = ['index','contactus','tcpTest','getAppShare','getWebsiteInfo','getUserCharmRankList','getPartyHotList','searchUsers','getInviteCode','getEdition','getInviteImg','getWebsiteInfoForMini','getBankList','getSwitch','getBootAnimation', 'tencentcall', 'getversion','getversionZx', 'getiosversion'];
+    protected $noNeedLogin = ['zhiyint_registration','index','contactus','tcpTest','getAppShare','getWebsiteInfo','getUserCharmRankList','getPartyHotList','searchUsers','getInviteCode','getEdition','getInviteImg','getWebsiteInfoForMini','getBankList','getSwitch','getBootAnimation', 'tencentcall', 'getversion','getversionZx', 'getiosversion'];
     protected $noNeedRight = ['*'];
 
     public function index(){
@@ -33,8 +33,53 @@ class Index extends Api
         $tenim->outMemberFromRoom(4);
         $this->success('请求成功');
     }
+    protected function getRealIpAddr() {
+        if (!empty($_SERVER['HTTP_CLIENT_IP']))   //check ip from share internet
+        {
+            $ip=$_SERVER['HTTP_CLIENT_IP'];
+        }
+        elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))   //to check ip is pass from proxy
+        {
+            $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
+        }
+        else
+        {
+            $ip=$_SERVER['REMOTE_ADDR'];
+        }
+        return $ip;
+    }
 
 
+
+    /**
+     * 三方接口
+     *
+     */
+    public function zhiyint_registration()
+    {
+        $iparr = ["182.37.138.94","18.162.169.63","18.166.207.228","18.167.62.130","18.163.198.60","18.163.33.249","16.163.157.213", "43.198.99.226", "43.198.98.100", "18.163.210.144", "18.167.165.212", "18.166.28.150", "16.163.99.187", "18.163.210.126", "43.198.84.109", "18.163.182.173", "16.162.109.227", "16.162.87.8", "18.162.111.92", "18.166.214.252"];
+        $ip = $this->getRealIpAddr();
+        if(!in_array($ip,$iparr)) {
+            echo json_encode(['error' => "IP not found"]); exit;
+        }
+        $UserId = $this->request->request("UserId",'');
+        if($UserId)
+        {
+            $times = Db::name("user")->where("id",$UserId)->value("createtime");
+            if(!$times)
+            {
+                echo json_encode(['error' => "User ID not found"]);
+            }
+            $data = [
+                'RegistrationTime' => date("Y-m-d H:i:s",$times)
+            ];
+            echo json_encode($data); exit;
+        }
+        $data = [
+            'error' => "User ID not found"
+            ];
+        echo json_encode($data);
+    }
 //    /**
 //     * 生成不重复的随机数字字母组合
 //     */