Exemplo n.º 1
0
 public function run()
 {
     $sessions = $this->redis()->keys("sess:sid:*");
     $online_num = count($sessions);
     #临时
     $cc = shell_exec("netstat -natp |grep :19707 |grep -c ESTABLISHED");
     $cc = trim($cc);
     $online_num = (int) $cc;
     #
     $ip = array();
     if ($sessions) {
         foreach ($sessions as $val) {
             $data = $this->redis()->hash_get($val);
             $ip[$data['client_ip']] = 1;
         }
     }
     #上报在线人数
     $arrData = array();
     $arrData['gameid'] = GAME_ID;
     $arrData['type'] = 'online';
     $arrData['appid'] = 3248;
     $arrData['appkey'] = 'd2f83a02a38e0a7c027b8bc7dccf4628';
     $arrData['timeline'] = time();
     $arrData['value'][] = array('opid' => OPERATOR_ID, 'server' => SERVER_ID ? SERVER_ID : 0, 'area' => AREA_ID ? AREA_ID : 0, 'value' => $online_num);
     $url = "http://monitor.uuzuonline.com/onlineReport";
     Com_System::open_url($url, 'post', json_encode(array($arrData)));
     $ip_num = count($ip);
     $now = time();
     $sql = "INSERT INTO `log_online` (`num`, `ip_num`, `add_time`) VALUES ( '{$online_num}', '{$ip_num}', '{$now}')";
     $result = Com_Db::factory('log')->query($sql);
     echo "time:{$now} result:" . var_export($result, true) . "\n";
     Com_DataCenter::getInstance()->publish_data(0, 'ser', array('time' => $now, 'online_num' => $online_num));
 }
Exemplo n.º 2
0
 public function send()
 {
     $this->auth = $this->_parseData;
     $zoneid = $this->auth['zoneid'];
     $url = 'http://s' . $zoneid . '.app' . $this->get_game('Tencent')->appid . '.qqopenapp.com/tencentApi.php';
     $result = Com_System::open_url($url, 'post', $this->auth);
     echo $result;
 }
Exemplo n.º 3
0
 public function sendMessageSuning($dataArr, $type, $nowTime, $ip)
 {
     $server_url = 'http://openesb.suning.com/esbadapter/SNGamingPlatformMgmt/createGameRole';
     // 		$dataArr['server_id'] = 406080001;
     $server_code = $dataArr['server_id'] - 406080000;
     $server_code = 'UDXZs' . $server_code;
     $time = substr(microtime(true) * 1000, 0, -2);
     $loginTime = date('Y-m-d H:i:s', $nowTime);
     $reqId = $server_code . $dataArr['player_id'];
     $reqStr = 'serverCode=' . $server_code . '&custNum=' . $dataArr['account'] . '&roleUid=' . $dataArr['account'] . '&roleName=' . $dataArr['player_name'] . '&roleLevel=1&balance=0&loginTime=' . $loginTime . '&reqId=' . $reqId . '&timestamp=' . $time;
     $req = base64_encode($reqStr);
     $sign = md5($req . 'F94PK5IJT0WP0JTNHYLGSGHAYHV43IDDIK9CH6LJYIEIHEQDU4IIN1X95LZXRVUZOPDKM2SJM4LGHHLYGJ5XTGFAKJ8GQYA9DF35MJYIMPD8FPGRPEXOI0DS8R30RPA6MF1WQRD2JQISHTVHRK8SCB1N05YT89M705JMIRHA223PCMJ7W4RSQZKHFVTXCPE8GJMCQZIIRGVPOWF5B0K8VSPH1FAUN6EF28LPPOSHPEJYA31XE92UJ5IUF4EIGKK9');
     $data = 'req=' . $req . '&sign=' . $sign;
     // 		file_put_contents(PROJECT_ROOT.'/uuzudo.log' , $server_url . "\n" . $data . "\n" , FILE_APPEND);
     $result = Com_System::open_url($server_url, 'post', $data, 300);
     // 		file_put_contents(PROJECT_ROOT.'/uuzudo.log',$result."\n",FILE_APPEND);
     return $result;
 }
Exemplo n.º 4
0
 public function run()
 {
     if (1 == OPERATOR_ID && SERVER_ID > 2) {
         $url = "http://api.uuzu.com/platform/user/info";
         $oPlayer = new Data_Player();
         $oAccount = new Data_Account();
         $sql = 'select * from account where plat_reg_time=-1;';
         $oAccount->query($sql);
         $records = array();
         while ($oAccount->next_record()) {
             $records[] = $oAccount->get_record();
         }
         foreach ($records as $user) {
             $arrData = array();
             $arrData['account'] = $user['user_account'];
             $arrData['game_id'] = 1;
             $arrData['fields'] = 'reg_time';
             ksort($arrData);
             $auth = $this->createAuth($arrData);
             $arrData['verify'] = md5($auth . 'NBg5akoBBLiiqKsW');
             $dataArr = json_decode(Com_System::open_url($url, 'post', $arrData, 5), true);
             if ($dataArr['status'] == 0 && isset($dataArr['userinfo']) && isset($dataArr['userinfo']['reg_time']) && !empty($dataArr['userinfo']['reg_time'])) {
                 $oPlayer->start_trans();
                 if (date('Ymd', $user['add_time']) == date('Ymd', $dataArr['userinfo']['reg_time'])) {
                     $new_acc = 1;
                 } else {
                     $new_acc = 0;
                 }
                 $arr = array('plat_reg_time' => $dataArr['userinfo']['reg_time'], 'new_plat_account' => $new_acc);
                 $sql = 'update account set  plat_reg_time=' . $arr['plat_reg_time'] . ' , new_plat_account=' . $new_acc . ' where player_id=' . $user['player_id'];
                 $ret = $oAccount->query($sql);
                 if ($ret) {
                     if ($user['name'] && $user['new_plat_account'] != $new_acc) {
                         $ret = $oPlayer->update_player_info($user['player_id'], $arr);
                         if ($ret) {
                             $sql = 'update player set plat_reg_time=' . $arr['plat_reg_time'] . ' , new_plat_account=' . $new_acc . ' where player_id=' . $user['player_id'];
                             $oPlayer->query($sql);
                             if ($oPlayer->affected_rows() > 0) {
                                 $ret = true;
                             } else {
                                 $ret = false;
                             }
                         }
                     }
                 }
                 if ($ret) {
                     $oPlayer->commit();
                 } else {
                     $oPlayer->rollback();
                 }
             } else {
                 $arr = array('plat_reg_time' => 1, 'new_plat_account' => 0);
                 $oPlayer->start_trans();
                 $sql = 'update account set  plat_reg_time=' . $arr['plat_reg_time'] . ' , new_plat_account=0 where player_id=' . $user['player_id'];
                 $ret = $oAccount->query($sql);
                 if ($ret) {
                     if ($user['name']) {
                         $ret = $oPlayer->update_player_info($user['player_id'], $arr);
                         if ($ret) {
                             $sql = 'update player set plat_reg_time=' . $arr['plat_reg_time'] . ' , new_plat_account=0 where player_id=' . $user['player_id'];
                             $oPlayer->query($sql);
                             if ($oPlayer->affected_rows() > 0) {
                                 $ret = true;
                             } else {
                                 $ret = false;
                             }
                         } else {
                             $ret = false;
                         }
                     }
                 }
                 if ($ret) {
                     $oPlayer->commit();
                 } else {
                     $oPlayer->rollback();
                 }
             }
             $rd = rand(1, 10);
             if (1 == $rd) {
                 sleep(1);
             }
         }
     }
 }
Exemplo n.º 5
0
 public function curlDate($account, $type, $nowTime, $ip)
 {
     $server_url = 'http://adapi.uuzu.com/api.php';
     $adKey = '3a3ea00cfc35332cedf6e5e9a32e94da';
     $postString = 'm=' . $type;
     $arrAuth = array();
     $arrAuth['project_id'] = OPERATOR_ID;
     $arrAuth['game_id'] = GAME_ID;
     $arrAuth['account'] = $account['user_account'];
     if (empty($arrAuth['project_id']) || empty($arrAuth['game_id'])) {
         return false;
     }
     switch ($type) {
         case 'active':
             $arrAuth['game_zone'] = SERVER_ID;
             $arrAuth['activetime'] = $nowTime;
             $arrAuth['ip'] = $ip;
             break;
         case 'login':
             $arrAuth['logintime'] = $nowTime;
             $arrAuth['ip'] = $ip;
             $arrAuth['origin'] = 1;
             break;
         case 'level':
             $arrAuth['game_zone'] = SERVER_ID;
             $arrAuth['level'] = $account['level'];
             $arrAuth['pushtime'] = $nowTime;
             break;
     }
     ksort($arrAuth);
     $auth = '';
     foreach ($arrAuth as $key => $value) {
         $auth .= $key . '=' . $value . '&';
     }
     $auth = base64_encode(rtrim($auth, '&'));
     $postString .= '&auth=' . $auth;
     $postString .= '&verify=' . md5($auth . $adKey);
     $result = Com_System::open_url($server_url . '?' . $postString, 'get', array(), 300);
     return $result;
 }
Exemplo n.º 6
0
 /**
  * 预处理队列回调方法
  * @param $data
  */
 public function do_async_online_stat($data)
 {
     if (empty($data)) {
         return;
     }
     $data = json_decode($data, true);
     #上报在线人数
     $arrData = array();
     $arrData['gameid'] = GAME_ID;
     $arrData['type'] = 'online';
     $arrData['appid'] = 3248;
     $arrData['appkey'] = 'd2f83a02a38e0a7c027b8bc7dccf4628';
     $arrData['timeline'] = $data['add_time'];
     $arrData['value'][] = array('opid' => OPERATOR_ID, 'server' => SERVER_ID ? SERVER_ID : 0, 'area' => AREA_ID ? AREA_ID : 0, 'value' => $data['num']);
     $url = "http://monitor.uuzuonline.com/onlineReport";
     Com_System::open_url($url, 'post', json_encode(array($arrData)));
     $sql = "INSERT INTO `log_online` (`num`, `ip_num`, `add_time`) VALUES ( '" . $data['num'] . "', '" . $data['ip_num'] . "', '" . $data['add_time'] . "')";
     $result = Com_Db::factory('log')->query($sql);
 }
Exemplo n.º 7
0
 public static function get_360_televel($qid, $level)
 {
     $server_url = 'http://hd.wan.360.cn/check_privi.html';
     #以下参数360提供
     $privkey = "360send*test";
     $data['aid'] = 1219;
     $data['gkey'] = 'fhl';
     $data['skey'] = 'S1';
     $data['type'] = 'privi';
     #
     $data['time'] = time();
     $data['level'] = (int) $level;
     $data['qid'] = $qid;
     $sign = md5($data['aid'] . "|" . $data['gkey'] . "|" . $data['qid'] . "|" . $data['type'] . "|" . $data['time'] . $privkey);
     $data['sign'] = $sign;
     $postString = http_build_query($data);
     $result = Com_System::open_url($server_url . '?' . $postString, 'get', array(), 300);
     return $result;
 }
Exemplo n.º 8
0
 private function bind_phone($player_id, $phone_num, $sms_code, $session_id)
 {
     $player_info = $this->get_data('Player')->get_player_info($player_id);
     $query_string_arr = array('account' => $player_info['user_account'], 'mobile' => $phone_num, 'app_id' => $this->app_id_bind, 'code' => $sms_code, 'session_id' => $session_id, 'time' => $this->current_time);
     ksort($query_string_arr);
     $sign_string = "";
     foreach ($query_string_arr as $key => $value) {
         if (empty($sign_string)) {
             $sign_string .= $key . "=" . $value;
         } else {
             $sign_string .= "&" . $key . "=" . $value;
         }
     }
     $verify = md5($sign_string . $this->secret_key_bind);
     $query_string_arr['verify'] = $verify;
     $url = $this->url_bind . "?" . $sign_string . "&verify={$verify}";
     # 平台要求以GET方式请求
     $return_json = Com_System::open_url($url);
     $result = json_decode($return_json, true);
     # 记录行为
     Com_Log::write('xgame.authreward', "{$player_id}\t" . "bind_phone\t" . "{$phone_num}\t" . "{$sms_code}\t" . "{$session_id}\t" . "{$return_json}\t");
     return $result;
 }
Exemplo n.º 9
0
 private function CheckAccount($player_id, $time, $user_account, $session_id)
 {
     //$player_info = $this->get_data('Player')->get_player_info($player_id, array('user_account', 'session_id'));
     //$session_info = $this->get_game('Online')->get_session($player_info['session_id']);
     $arrData = array();
     $arrData['account'] = $user_account;
     $arrData['game_id'] = 1;
     $arrData['fields'] = 'reg_time';
     ksort($arrData);
     $auth = $this->createAuth($arrData);
     $arrData['verify'] = md5($auth . 'NBg5akoBBLiiqKsW');
     $url = "http://api.uuzu.com/platform/user/info";
     $dataArr = json_decode(Com_System::open_url($url, 'post', $arrData, 5), true);
     $ret = false;
     if ($dataArr['status'] == 0) {
         if (isset($dataArr['userinfo']) && isset($dataArr['userinfo']['reg_time']) && !empty($dataArr['userinfo']['reg_time']) && $dataArr['userinfo']['reg_time'] <= $time) {
             $ret = true;
         }
     }
     return $ret;
 }