This commit is contained in:
aozhiwei 2020-07-08 19:31:29 +08:00
parent 1a72d40b49
commit 797fa7c657
4 changed files with 60 additions and 7 deletions

View File

@ -208,6 +208,7 @@ class HangController{
$rank = 0; $rank = 0;
$rank_score = 0; $rank_score = 0;
$max_rank_score = 0; $max_rank_score = 0;
$min_rank_score = 0;
$reward = array(); $reward = array();
$week_reward = array(); $week_reward = array();
$row = $conn->execQueryOne('SELECT integral, pass_status, score FROM user WHERE accountid=:accountid;', $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'] if ($row['integral'] >= $seaPoint['min'] && $row['integral'] <= $seaPoint['max']
|| $row['integral'] >= $seaPoint['min'] && $seaPoint['max'] == -1) || $row['integral'] >= $seaPoint['min'] && $seaPoint['max'] == -1)
{ {
$delim1 = '|'; $delim1 = '|';
$drop_multiply = explode($delim1, $season['weekreward']); $drop_multiply = explode($delim1, $season['weekreward']);
@ -249,6 +249,7 @@ class HangController{
)); ));
} }
$rank = $ii; $rank = $ii;
$min_rank_score = $seaPoint['min'];
$max_rank_score = $seaPoint['max'] + 1 - $seaPoint['min']; $max_rank_score = $seaPoint['max'] + 1 - $seaPoint['min'];
$rank_score = $row['integral'] - $seaPoint['min'] + 1; $rank_score = $row['integral'] - $seaPoint['min'] + 1;
if ($seaPoint['max'] == -1) { if ($seaPoint['max'] == -1) {
@ -483,7 +484,8 @@ class HangController{
'item_list' => $item_list, 'item_list' => $item_list,
'first_login' => $rowuser['first_login'] + 1, 'first_login' => $rowuser['first_login'] + 1,
'daily_first_login' => $rowuser['daily_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,
)); ));
} }
} }

View File

@ -136,6 +136,7 @@ class PassController{
$rank = 0; $rank = 0;
$rank_score = 0; $rank_score = 0;
$max_rank_score = 0; $max_rank_score = 0;
$min_rank_score = 0;
$reward = array(); $reward = array();
$week_reward = array(); $week_reward = array();
$row = $conn->execQueryOne('SELECT integral, pass_status, score FROM user WHERE accountid=:accountid;', $row = $conn->execQueryOne('SELECT integral, pass_status, score FROM user WHERE accountid=:accountid;',
@ -177,6 +178,7 @@ class PassController{
} }
$rank = $ii; $rank = $ii;
$max_rank_score = $seaPoint['max'] + 1 - $seaPoint['min']; $max_rank_score = $seaPoint['max'] + 1 - $seaPoint['min'];
$min_rank_score = $seaPoint['min'];
$rank_score = $row['integral'] - $seaPoint['min'] + 1; $rank_score = $row['integral'] - $seaPoint['min'] + 1;
if ($seaPoint['max'] == -1) { if ($seaPoint['max'] == -1) {
$max_rank_score = $seaPoint['min']; $max_rank_score = $seaPoint['min'];
@ -204,6 +206,7 @@ class PassController{
'reward' => $reward, 'reward' => $reward,
'week' => $week_reward, 'week' => $week_reward,
'seareward' => $sea_reward, 'seareward' => $sea_reward,
'min_rank_score' => $min_rank_score,
)); ));
} }

View File

@ -121,7 +121,7 @@ class RoleController{
'max' => $seaPoint_meta['max_point'], 'max' => $seaPoint_meta['max_point'],
'des' => $seaPoint_meta['des'], 'des' => $seaPoint_meta['des'],
'topoint' => $seaPoint_meta['topoint'], 'topoint' => $seaPoint_meta['topoint'],
//'weekreward' => $seaPoint_meta['week_reward'], 'is_protect' => $seaPoint_meta['is_protect'],
); );
return $seaPoint; return $seaPoint;
} }
@ -486,11 +486,26 @@ class RoleController{
} }
//更新排位积分信息时间 //更新排位积分信息时间
if ($integral != 0) { 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 ' . $inret = $conn->execScript('UPDATE user SET integral=:integral, rank_modifytime=:rank_modifytime ' .
' WHERE accountid=:accountid;', ' WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
':integral' => $row['integral'] + $integral, ':integral' => $update_score,
':rank_modifytime' => time(), ':rank_modifytime' => time(),
)); ));
if (!$inret) { if (!$inret) {

View File

@ -15,6 +15,19 @@ class TeamController{
return $r; 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() public function createTeam()
{ {
$node_id = 1; $node_id = 1;
@ -47,6 +60,12 @@ class TeamController{
if (isset($_REQUEST['equip_id'])) { if (isset($_REQUEST['equip_id'])) {
$equip_id = $_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_db = array(
'team_uuid' => $team_uuid, 'team_uuid' => $team_uuid,
@ -63,7 +82,10 @@ class TeamController{
'color_id' => $color_id, 'color_id' => $color_id,
'hat_id' => $hat_id, 'hat_id' => $hat_id,
'rank' => $rank, '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'], 'hat_id' => $member['hat_id'],
'rank' => $member['rank'], 'rank' => $member['rank'],
'equip_id' => $member['equip_id'], 'equip_id' => $member['equip_id'],
'game_times' => $member['game_times'],
'win_times' => $member['win_times'],
'kills' => $member['kills'],
)); ));
} }
echo json_encode(array( echo json_encode(array(
@ -187,7 +212,12 @@ class TeamController{
if (isset($_REQUEST['equip_id'])) { if (isset($_REQUEST['equip_id'])) {
$equip_id = $_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( array_push ($user_db['member_list'], array(
'idx' => $member_num + 1, 'idx' => $member_num + 1,
'account_id' => $_REQUEST['account_id'], 'account_id' => $_REQUEST['account_id'],
@ -198,7 +228,10 @@ class TeamController{
'color_id' => $color_id, 'color_id' => $color_id,
'hat_id' => $hat_id, 'hat_id' => $hat_id,
'rank' => $rank, '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->set(TEAMID_KEY . $team_uuid, json_encode($user_db));
$r -> pexpire(TEAMID_KEY . $team_uuid, 1000 * 600); $r -> pexpire(TEAMID_KEY . $team_uuid, 1000 * 600);