diff --git a/webapp/controller/HangController.class.php b/webapp/controller/HangController.class.php index feb7682..554fea8 100644 --- a/webapp/controller/HangController.class.php +++ b/webapp/controller/HangController.class.php @@ -208,6 +208,7 @@ class HangController{ $rank = 0; $rank_score = 0; $max_rank_score = 0; + $min_rank_score = 0; $reward = array(); $week_reward = array(); $row = $conn->execQueryOne('SELECT integral, pass_status, score FROM user WHERE accountid=:accountid;', @@ -226,7 +227,6 @@ class HangController{ if ($row['integral'] >= $seaPoint['min'] && $row['integral'] <= $seaPoint['max'] || $row['integral'] >= $seaPoint['min'] && $seaPoint['max'] == -1) { - $delim1 = '|'; $drop_multiply = explode($delim1, $season['weekreward']); @@ -249,6 +249,7 @@ class HangController{ )); } $rank = $ii; + $min_rank_score = $seaPoint['min']; $max_rank_score = $seaPoint['max'] + 1 - $seaPoint['min']; $rank_score = $row['integral'] - $seaPoint['min'] + 1; if ($seaPoint['max'] == -1) { @@ -483,7 +484,8 @@ class HangController{ 'item_list' => $item_list, 'first_login' => $rowuser['first_login'] + 1, 'daily_first_login' => $rowuser['daily_first_login'] + 1, - 'game_times' => $rowuser['game_times'] + 'game_times' => $rowuser['game_times'], + 'min_rank_score' => $min_rank_score, )); } } diff --git a/webapp/controller/PassController.class.php b/webapp/controller/PassController.class.php index 6a08d2a..8931e79 100644 --- a/webapp/controller/PassController.class.php +++ b/webapp/controller/PassController.class.php @@ -136,6 +136,7 @@ class PassController{ $rank = 0; $rank_score = 0; $max_rank_score = 0; + $min_rank_score = 0; $reward = array(); $week_reward = array(); $row = $conn->execQueryOne('SELECT integral, pass_status, score FROM user WHERE accountid=:accountid;', @@ -177,6 +178,7 @@ class PassController{ } $rank = $ii; $max_rank_score = $seaPoint['max'] + 1 - $seaPoint['min']; + $min_rank_score = $seaPoint['min']; $rank_score = $row['integral'] - $seaPoint['min'] + 1; if ($seaPoint['max'] == -1) { $max_rank_score = $seaPoint['min']; @@ -204,6 +206,7 @@ class PassController{ 'reward' => $reward, 'week' => $week_reward, 'seareward' => $sea_reward, + 'min_rank_score' => $min_rank_score, )); } diff --git a/webapp/controller/RoleController.class.php b/webapp/controller/RoleController.class.php index 6aa09ee..e2f2439 100644 --- a/webapp/controller/RoleController.class.php +++ b/webapp/controller/RoleController.class.php @@ -121,7 +121,7 @@ class RoleController{ 'max' => $seaPoint_meta['max_point'], 'des' => $seaPoint_meta['des'], 'topoint' => $seaPoint_meta['topoint'], - //'weekreward' => $seaPoint_meta['week_reward'], + 'is_protect' => $seaPoint_meta['is_protect'], ); return $seaPoint; } @@ -486,11 +486,26 @@ class RoleController{ } //更新排位积分信息时间 if ($integral != 0) { + $min_score = 0; + $update_score = $integral + $row['integral']; + $is_pro = 0; + $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'] + || $row['integral'] >= $seaPoint['min'] && $seaPoint['max'] == -1) { + $is_pro = $seaPoint['is_protect']; + $min_score = $seaPoint['min']; + } + } + if ($is_pro == 1 && $min_score > $update_score) { + $update_score = $min_score; + } $inret = $conn->execScript('UPDATE user SET integral=:integral, rank_modifytime=:rank_modifytime ' . ' WHERE accountid=:accountid;', array( ':accountid' => $account_id, - ':integral' => $row['integral'] + $integral, + ':integral' => $update_score, ':rank_modifytime' => time(), )); if (!$inret) { diff --git a/webapp/controller/TeamController.class.php b/webapp/controller/TeamController.class.php index 202484e..eb7ed48 100644 --- a/webapp/controller/TeamController.class.php +++ b/webapp/controller/TeamController.class.php @@ -15,6 +15,19 @@ class TeamController{ return $r; } + protected function getMysql($account_id) + { + $mysql_conf = getMysqlConfig(crc32($account_id)); + $conn = new phpcommon\Mysql(array( + 'host' => $mysql_conf['host'], + 'port' => $mysql_conf['port'], + 'user' => $mysql_conf['user'], + 'passwd' => $mysql_conf['passwd'], + 'dbname' => 'gamedb2004_' . $mysql_conf['instance_id'] + )); + return $conn; + } + public function createTeam() { $node_id = 1; @@ -47,6 +60,12 @@ class TeamController{ if (isset($_REQUEST['equip_id'])) { $equip_id = $_REQUEST['equip_id']; } + $account_id = $_REQUEST['account_id']; + $conn = $this->getMysql($account_id); + $row = $conn->execQueryOne('SELECT game_times, win_times, kills FROM user WHERE accountid=:accountid;', + array( + 'accountid' => $account_id, + )); $team_db = array( 'team_uuid' => $team_uuid, @@ -63,7 +82,10 @@ class TeamController{ 'color_id' => $color_id, 'hat_id' => $hat_id, 'rank' => $rank, - 'equip_id' => $equip_id + 'equip_id' => $equip_id, + 'game_times' => $row['game_times'], + 'win_times' => $row['win_times'], + 'kills' => $row['kills'], ) )); @@ -112,6 +134,9 @@ class TeamController{ 'hat_id' => $member['hat_id'], 'rank' => $member['rank'], 'equip_id' => $member['equip_id'], + 'game_times' => $member['game_times'], + 'win_times' => $member['win_times'], + 'kills' => $member['kills'], )); } echo json_encode(array( @@ -187,7 +212,12 @@ class TeamController{ if (isset($_REQUEST['equip_id'])) { $equip_id = $_REQUEST['equip_id']; } - + $accountid = $_REQUEST['account_id']; + $conn = $this->getMysql($account_id); + $row = $conn->execQueryOne('SELECT game_times, win_times, kills FROM user WHERE accountid=:accountid;', + array( + 'accountid' => $accountid, + )); array_push ($user_db['member_list'], array( 'idx' => $member_num + 1, 'account_id' => $_REQUEST['account_id'], @@ -198,7 +228,10 @@ class TeamController{ 'color_id' => $color_id, 'hat_id' => $hat_id, 'rank' => $rank, - 'equip_id' => $member['equip_id'], + 'equip_id' => $equip_id, + 'game_times' => $row['game_times'], + 'game_times' => $row['game_times'], + 'game_times' => $row['game_times'], )); $r->set(TEAMID_KEY . $team_uuid, json_encode($user_db)); $r -> pexpire(TEAMID_KEY . $team_uuid, 1000 * 600);