$mysql_conf['host'], 'port' => $mysql_conf['port'], 'user' => $mysql_conf['user'], 'passwd' => $mysql_conf['passwd'], 'dbname' => DBNAME_PREFIX . $mysql_conf['instance_id'] )); return $conn; } protected function getSeasonPoint($seaPoint_id) { $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); $seaPoint_meta = getSeasonPointConfig($seaPoint_meta_table, $seaPoint_id); $seaPoint = array( 'id' => $seaPoint_meta['id'], 'min' => $seaPoint_meta['min_point'], 'max' => $seaPoint_meta['max_point'], 'des' => $seaPoint_meta['des'], ); return $seaPoint; } public function selectUserInfo() { $account_id = $_REQUEST['account_id']; $conn = $this->getMysql($account_id); if(!$conn){ phpcommon\sendError(ERR_USER_BASE + 1, '玩家不存在'); return; } $row = $conn->execQueryOne('SELECT accountid, user_name, avatar_url, game_times, win_times, kill_his, kills, harm_his, harm, integral, modify_time, alive_time, add_HP FROM user WHERE accountid=:account_id;', array( ':account_id' => $account_id, )); if (!$row) { phpcommon\sendError(ERR_USER_BASE + 1, '玩家不存在'); return; } $rank = 1; $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); for ($ii = 1; $ii <= count($seaPoint_meta_table); $ii++) { $seaPoint = $this->getSeasonPoint($ii); if ($row['integral'] >= $seaPoint['min'] && $row['integral'] <= $seaPoint['max'] || $seaPoint['max'] == -1) { $rank = $ii; break; } } $avatar_url = $row['avatar_url']; if (phpcommon\extractChannel($row['accountid']) != 6001) { $avatar_url = "https://wx.qlogo.cn/mmopen/vi_32/q4oRsMFYBwPEVAeVI7tiasWSqaibr0GPQia432JhibGRYhqqEJofpWDYxJPq6q0hQ0j7icdACdHL78hrjYYHSjZQ3YA/132"; } echo json_encode(array( 'errcode' => 0, 'errmsg' => '', 'accountid' => $row['accountid'], 'user_name' => $row['user_name'], 'avatar_url' => $avatar_url, 'game_times' => $row['game_times'], 'win_times' => $row['win_times'], 'kill_his' => $row['kill_his'], 'kills' => $row['kills'], 'harm_his' => $row['harm_his'], 'harm' => $row['harm'], 'level' => $rank, 'modify_time' => $row['modify_time'], 'alive_time' => $row['alive_time'], 'add_HP' => $row['add_HP'], )); } public function selectUser() { $account_id = $_REQUEST['account_id']; $conn = $this->getMysql($account_id); if(!$conn){ phpcommon\sendError(ERR_USER_BASE + 1, '玩家不存在'); return; } $row = $conn->execQueryOne('SELECT user_name FROM user WHERE accountid=:account_id;', array( ':account_id' => $account_id, )); if (!$row) { phpcommon\sendError(ERR_USER_BASE + 1, '玩家不存在'); return; } echo json_encode(array( 'errcode' => 0, 'errmsg' => '', 'name' => $row['user_name'], )); } } ?>