コード例 #1
0
 /**
  * 返回数据
  */
 public function getRaw()
 {
     return $this->_httpDown->GetRaw();
     if ($this->_httpDown->IsGetOK()) {
         return $this->_httpDown->GetRaw();
     }
     return false;
 }
コード例 #2
0
 /**
  * 从后端的公共接口获得玩家的数据
  */
 private function _getDefaultUser()
 {
     $sendUrl = C('SEND_ORDER_URL');
     $getData = array('c' => 'InterfaceWorkOrder', 'a' => 'GetPlayerDataByAccount', 'game_id_from_uwan' => $this->_gameTypeId, 'player_account' => urlencode($this->_userAccount), 'server_id' => $this->_serverId, '_verifycode' => C('CURRENT_TIME'), '_sign' => md5(C('SEND_KEY') . C('CURRENT_TIME')));
     if (!$sendUrl) {
         return false;
     }
     if (strpos($sendUrl, '?')) {
         $sendUrl .= '&' . http_build_query($getData);
     } else {
         $sendUrl .= '?' . http_build_query($getData);
     }
     import('@.Util.Httpdown');
     $httpDown = new Httpdown();
     $httpDown->OpenUrl($sendUrl);
     if (!$httpDown->IsGetOK()) {
         return false;
     }
     $data = $httpDown->GetRaw();
     if ($data && ($data = json_decode($data, true)) && $data['status'] == 1) {
         $playerInfo = $data['data'];
         $this->_userDetail = array('user_id' => $playerInfo['user_id'], 'user_account' => $this->_userAccount, 'user_nickname' => $playerInfo['user_nickname'], 'money_total' => $playerInfo['money_total'], 'money_month' => $playerInfo['money_month'], 'register_date' => $playerInfo['register_date'], 'ip' => $playerInfo['ip']);
     }
 }