用户工具

站点工具


转账钱包phpdemo

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

转账钱包phpdemo [2019/12/15 17:32] – 创建 admin转账钱包phpdemo [2019/12/17 22:39] (当前版本) – 外部编辑 127.0.0.1
行 1: 行 1:
 <file php phpDemo.php> <file php phpDemo.php>
-    <?php +<?php 
-    header("content-type:text/html;charset=utf-8"); +header("content-type:text/html;charset=utf-8"); 
-    date_default_timezone_set('PRC');+date_default_timezone_set('PRC');
  
-    /** +  /** 
-     * 转账钱包 PHP Demo +  * 转账钱包 PHP Demo 
-     * Class ngapi +  * Class ngapi 
-     * @version (PHP 5 >= 5.3.0, PHP 7) +  * @version (PHP 5 >= 5.3.0, PHP 7) 
-     */ +  * www.neapi.com 
-    class newGamingDemo{+  */ 
 +class newngapiDemo{
  
  
  
-        protected  $sign_key = '**********';     // API帐号 + protected  $sign_key = '**********';     // API帐号 
-        protected  $api_account = '**********';  // KEY密钥+ protected  $api_account = '**********';  // KEY密钥
  
-        /** + /** 
-         * @var string +  * @var string 
-         * 接口地址 +  * 接口地址 
-         */ +  */ 
-        protected  $register_url = 'http://域名/v1/user/register';    // 创建会员账户 + protected  $register_url = 'http://域名/v1/user/register';    // 创建会员账户 
-        protected  $login_live_url = 'http://域名/v1/user/login';     // 获取游戏登录地址 + protected  $login_live_url = 'http://域名/v1/user/login';     // 获取游戏登录地址 
-        protected  $trans_url = 'http://域名/v1/user/trans';          // 额度转换 + protected  $trans_url = 'http://域名/v1/user/trans';          // 额度转换 
-        protected  $balance_url = 'http://域名/v1/user/balance';      // 会员游戏平台余额查询 + protected  $balance_url = 'http://域名/v1/user/balance';      // 会员游戏平台余额查询 
-        protected  $all_credit_url = 'http://域名/v1/user/all-credit';// 全部平台余额查询 + protected  $all_credit_url = 'http://域名/v1/user/all-credit';// 全部平台余额查询 
-        protected  $status_url = 'http://域名/v1/user/status';        // 额度转换状态查询 + protected  $status_url = 'http://域名/v1/user/status';        // 额度转换状态查询 
-        protected  $collect_url = 'http://域名/v1/user/record';       // 获取游戏记录+ protected  $collect_url = 'http://域名/v1/user/record';       // 获取游戏记录
  
  
-        //游戏平台类型 小写 + //游戏平台类型 小写 
-        protected  $plat_type = 'ag';+ protected  $plat_type = 'ag';
  
-        protected  $game_type_live = '1';     // 真人娱乐 + protected  $game_type_live = '1';     // 真人娱乐 
-        protected  $game_type_slot = '2';     // 老虎机 + protected  $game_type_slot = '2';     // 老虎机 
-        protected  $game_type_lottery = '3';  // 彩票 + protected  $game_type_lottery = '3';  // 彩票 
-        protected  $game_type_sports = '4';   // 体育 + protected  $game_type_sports = '4';   // 体育 
-        protected  $game_type_esports = '5';  // 电竞 + protected  $game_type_esports = '5';  // 电竞 
-        protected  $game_type_fishing = '6';  // 捕鱼 + protected  $game_type_fishing = '6';  // 捕鱼 
-        protected  $game_type_poker = '7';    // 棋牌+ protected  $game_type_poker = '7';    // 棋牌
  
  
-        /** + /** 
-         * @param $username +  * @param $username 
-         * @return mixed +  * @return mixed 
-         * 注册 +  * 注册 
-         */ +  */ 
-        public function register($username){ + public function register($username){ 
-            $code = md5($this->sign_key.$this->api_account.$this->plat_type.$username); + $code = md5($this->sign_key.$this->api_account.$this->plat_type.$username); 
-            $data = array( + $data = array( 
-                "username"=>$username, + "username"=>$username, 
-                "plat_type"=>$this->plat_type, + "plat_type"=>$this->plat_type, 
-                "sign_key"=>$this->sign_key, + "sign_key"=>$this->sign_key, 
-                "code"=>$code + "code"=>$code 
-            ); + ); 
-            $res = $this->sendRequest($this->register_url, $data); + $res = $this->sendRequest($this->register_url, $data); 
-            return $res; + return $res; 
-        }+ }
  
-        /** + /** 
-         * @param $username +  * @param $username 
-         * @param int $isMobileUrl +  * @param int $isMobileUrl 
-         * @param string $gameCode +  * @param string $gameCode 
-         * @return mixed +  * @return mixed 
-         * 获取游戏登录地址 +  * 获取游戏登录地址 
-         */ +  */ 
-        public function login($username,$isMobileUrl=0,$gameCode=""){ + public function login($username,$isMobileUrl=0,$gameCode=""){ 
-            $code = md5($this->sign_key.$this->api_account.$username.$this->plat_type.$isMobileUrl); + $code = md5($this->sign_key.$this->api_account.$username.$this->plat_type.$isMobileUrl); 
-            $data = array( + $data = array( 
-                "username"=>$username, + "username"=>$username, 
-                "plat_type"=>$this->plat_type, + "plat_type"=>$this->plat_type, 
-                "game_type"=>$this->game_type_live, + "game_type"=>$this->game_type_live, 
-                "game_code"=>$gameCode, + "game_code"=>$gameCode, 
-                "sign_key"=>$this->sign_key, + "sign_key"=>$this->sign_key, 
-                "is_mobile_url"=>$isMobileUrl, + "is_mobile_url"=>$isMobileUrl, 
-                "code"=>$code + "code"=>$code 
-            ); + ); 
-            $res = $this->sendRequest($this->login_live_url, $data); + $res = $this->sendRequest($this->login_live_url, $data); 
-            return $res; + return $res; 
-        }+ }
  
-        /** + /** 
-         * @param $username +  * @param $username 
-         * @param $money +  * @param $money 
-         * @param $client_transfer_id +  * @param $client_transfer_id 
-         * @return mixed +  * @return mixed 
-         * 额度转换 +  * 额度转换 
-         */ +  */ 
-        public function trans($username,$money,$client_transfer_id){ + public function trans($username,$money,$client_transfer_id){ 
-            $code = md5($this->sign_key.$this->api_account.$username.$this->plat_type.$money.$client_transfer_id); + $code = md5($this->sign_key.$this->api_account.$username.$this->plat_type.$money.$client_transfer_id); 
-            $data = array( + $data = array( 
-                "username"=>$username, + "username"=>$username, 
-                "plat_type"=>$this->plat_type, + "plat_type"=>$this->plat_type, 
-                "money"=>$money, + "money"=>$money, 
-                "client_transfer_id"=>$client_transfer_id, + "client_transfer_id"=>$client_transfer_id, 
-                "sign_key"=>$this->sign_key, + "sign_key"=>$this->sign_key, 
-                "code"=>$code + "code"=>$code 
-            );+ );
  
-            $res = $this->sendRequest($this->trans_url, $data); + $res = $this->sendRequest($this->trans_url, $data); 
-            return $res; + return $res; 
-        }+ }
  
  
  
-        /** + /** 
-         * @param $username +  * @param $username 
-         * @param $client_transfer_id +  * @param $client_transfer_id 
-         * @return mixed +  * @return mixed 
-         * 查询转账状态 +  * 查询转账状态 
-         */ +  */ 
-        public function status($username,$client_transfer_id){ + public function status($username,$client_transfer_id){ 
-            $code = md5($this->sign_key.$this->api_account.$username.$this->plat_type.$client_transfer_id); + $code = md5($this->sign_key.$this->api_account.$username.$this->plat_type.$client_transfer_id); 
-            $data = array( + $data = array( 
-                "username"=>$username, + "username"=>$username, 
-                "client_transfer_id"=>$client_transfer_id, + "client_transfer_id"=>$client_transfer_id, 
-                "plat_type"=>$this->plat_type, + "plat_type"=>$this->plat_type, 
-                "sign_key"=>$this->sign_key, + "sign_key"=>$this->sign_key, 
-                "code"=>$code + "code"=>$code 
-            ); + ); 
-            $res = $this->sendRequest($this->status_url, $data); + $res = $this->sendRequest($this->status_url, $data); 
-            return $res; + return $res; 
-        }+ }
  
-        /** + /** 
-         * @param $username +  * @param $username 
-         * @return mixed +  * @return mixed 
-         * 获取用户余额 +  * 获取用户余额 
-         */ +  */ 
-        public function balance($username){ + public function balance($username){ 
-            $code = md5($this->sign_key.$this->api_account.$username.$this->plat_type); + $code = md5($this->sign_key.$this->api_account.$username.$this->plat_type); 
-            $data = array( + $data = array( 
-                "username"=>$username, + "username"=>$username, 
-                "plat_type"=>$this->plat_type, + "plat_type"=>$this->plat_type, 
-                "sign_key"=>$this->sign_key, + "sign_key"=>$this->sign_key, 
-                "code"=>$code + "code"=>$code 
-            ); + ); 
-            $res = $this->sendRequest($this->balance_url, $data); + $res = $this->sendRequest($this->balance_url, $data); 
-            return $res; + return $res; 
-        }+ }
  
-        /** + /** 
-         * @return mixed +  * @return mixed 
-         * 获取全部平台额度 +  * 获取全部平台额度 
-         */ +  */ 
-        public function credit(){ + public function credit(){ 
-            $code = md5($this->sign_key.$this->api_account); + $code = md5($this->sign_key.$this->api_account); 
-            $data = array( + $data = array( 
-                "sign_key"=>$this->sign_key, + "sign_key"=>$this->sign_key, 
-                "code"=>$code + "code"=>$code 
-            ); + ); 
-            $res = $this->sendRequest($this->all_credit_url, $data); + $res = $this->sendRequest($this->all_credit_url, $data); 
-            return $res; + return $res; 
-        }+ }
  
-        /** + /** 
-         * @param $startTime +  * @param $startTime 
-         * @param $endTime +  * @param $endTime 
-         * @param int $page +  * @param int $page 
-         * @param int $limit +  * @param int $limit 
-         * @return mixed +  * @return mixed 
-         * 获取下注记录 +  * 获取下注记录 
-         */ +  */ 
-        public function record($startTime,$endTime,$page=1,$limit=15){ + public function record($startTime,$endTime,$page=1,$limit=15){ 
-            $code = md5($this->sign_key.$this->api_account.$this->plat_type.$startTime.$endTime); + $code = md5($this->sign_key.$this->api_account.$this->plat_type.$startTime.$endTime); 
-            $data = array( + $data = array( 
-                "plat_type"=>$this->plat_type, + "plat_type"=>$this->plat_type, 
-                "page"=>$page, + "page"=>$page, 
-                "limit"=>$limit, + "limit"=>$limit, 
-                "startTime"=>$startTime, + "startTime"=>$startTime, 
-                "endTime"=>$endTime, + "endTime"=>$endTime, 
-                "game_type"=>$this->game_type_slot, + "game_type"=>$this->game_type_slot, 
-                "sign_key"=>$this->sign_key, + "sign_key"=>$this->sign_key, 
-                "code"=>$code + "code"=>$code 
-            ); + ); 
-            $res = $this->sendRequest($this->collect_url, $data); + $res = $this->sendRequest($this->collect_url, $data); 
-            return $res; + return $res; 
-        }+ }
  
-        private function sendRequest($url,$post_data=array()){ + private function sendRequest($url,$post_data=array()){ 
-            $ch = curl_init(); + $ch = curl_init(); 
-            curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_URL, $url); 
-            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
-            curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POST, 1); 
-            curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); + curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); 
-            curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60); + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60); 
-            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); 
-            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); 
-            $contents = curl_exec($ch); + $contents = curl_exec($ch); 
-            curl_close($ch);+ curl_close($ch);
  
-            print_r($contents); + print_r($contents); 
-            exit(); + exit(); 
-            return json_decode ($contents, TRUE); + return json_decode ($contents, TRUE); 
-        }+ }
  
-    }+}
  
-    //使用demo +//使用demo 
-    $api = new newGamingDemo(); +$api = new newngapiDemo(); 
-    $res = $api->login("username"); +$res = $api->login("username"); 
-    print_r($res); +print_r($res); 
-    ?>+?>
  
  
 </file> </file>
转账钱包phpdemo.1576402364.txt.gz · 最后更改: 2019/12/15 17:32 由 admin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki