From bf9b9f68c0a162c2afe5ea2fbaf5b45d4b455a1f Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 25 Dec 2020 13:42:44 +0800 Subject: [PATCH] 1 --- sql/gamedb.sql | 2 + sql/gamedb2005_n_migrate_201225_01 | 7 ++ third_party/phpcommon | 2 +- webapp/controller/FriendController.class.php | 117 +++++++++++++----- .../controller/GameOverController.class.php | 11 +- webapp/controller/HangController.class.php | 13 +- webapp/controller/PassController.class.php | 11 +- webapp/controller/RoleController.class.php | 22 +++- 8 files changed, 133 insertions(+), 52 deletions(-) create mode 100644 sql/gamedb2005_n_migrate_201225_01 diff --git a/sql/gamedb.sql b/sql/gamedb.sql index 4aadba7..d93d2d9 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -113,6 +113,8 @@ CREATE TABLE `user` ( `create_user` int(11) NOT NULL DEFAULT '0' COMMENT '是否创角', `sex` int(11) NOT NULL DEFAULT '0' COMMENT '性别', `sumlot_coin` double NOT NULL DEFAULT '0' COMMENT '累计抽奖剩余金额', + + `max_integral` int(11) NOT NULL DEFAULT '0' COMMENT '最高积分', PRIMARY KEY (`idx`), UNIQUE KEY `accountid` (`accountid`) ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; diff --git a/sql/gamedb2005_n_migrate_201225_01 b/sql/gamedb2005_n_migrate_201225_01 new file mode 100644 index 0000000..99c63c5 --- /dev/null +++ b/sql/gamedb2005_n_migrate_201225_01 @@ -0,0 +1,7 @@ +begin; + +alter table user add column `max_integral` int(11) NOT NULL DEFAULT '0' COMMENT '最高积分'; + +insert into version (version) values(2020122501); + +commit; diff --git a/third_party/phpcommon b/third_party/phpcommon index d56fa02..baf2d41 160000 --- a/third_party/phpcommon +++ b/third_party/phpcommon @@ -1 +1 @@ -Subproject commit d56fa02411e557908dc2f4f319877a0af70c7957 +Subproject commit baf2d41d8879a4e90927eec65976759cc631bcb3 diff --git a/webapp/controller/FriendController.class.php b/webapp/controller/FriendController.class.php index 5f67782..da7676f 100644 --- a/webapp/controller/FriendController.class.php +++ b/webapp/controller/FriendController.class.php @@ -51,43 +51,79 @@ class FriendController{ public function selectUserInfo() { $account_id = $_REQUEST['account_id']; - $conn = $this->getMysql($account_id); - if(!$conn){ - phpcommon\sendError(ERR_USER_BASE + 1, '玩家不存在'); + $conns = $this->getAllMysql(); + if (!$conns) { + 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, head_kuang_id FROM user WHERE accountid=:account_id;', - array( - ':account_id' => $account_id, - )); - if (!$row) { - phpcommon\sendError(ERR_USER_BASE + 1, '玩家不存在'); - return; - } - + $flag = 0; + $max_rank = 1; $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; + $avatar_url = 18001; + $vip_level = 0; + foreach ($conns as $conn) { + $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, head_kuang_id, max_integral, sex FROM user WHERE accountid=:account_id;', + array( + ':account_id' => $account_id, + )); + if ($row) { + $flag = 1; + } + + $rowbags = $conn->execQuery('SELECT id, color_id FROM bag WHERE accountid=:account_id AND status=0;', + array( + ':account_id' => $account_id, + )); + if ($rowbags) { + $flag = 1; + } + + $rowequip = $conn->execQueryOne('SELECT using_id FROM equip WHERE accountid=:account_id;', + array( + ':account_id' => $account_id, + )); + $rowlv = $conn->execQueryOne('SELECT using_id, lv FROM equip WHERE accountid=:account_id AND id=:id;', + array( + ':account_id' => $account_id, + ':id' => $rowequip['using_id'] + )); + if ($rowequip || $rowlv) { + $flag = 1; + } + if ($flag == 1) { break; } + $max_rank = 1; + $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; + } + if ($row['max_integral'] >= $seaPoint['min'] && $row['max_integral'] <= $seaPoint['max'] + || $seaPoint['max'] == -1) { + $max_rank = $ii; + break; + } + } + $addreward = new classes\Addreward(); + $vip_level = $addreward->getVipLevel($account_id); + $avatar_url = $row['avatar_url']; } - $addreward = new classes\Addreward(); - $vip_level = $addreward->getVipLevel($account_id); - $avatar_url = $row['avatar_url']; - // if (phpcommon\extractChannel($row['accountid']) != 6001) { - // $avatar_url = 1; - // } + if ($flag == 0) { + phpcommon\sendError(ERR_USER_BASE + 1, '玩家不存在'); + return; + } echo json_encode(array( 'errcode' => 0, 'errmsg' => '', 'accountid' => $row['accountid'], 'user_name' => $row['user_name'], - 'avatar_url' => $avatar_url, + 'avatar_url' => $row['avatar_url'], 'game_times' => $row['game_times'], 'win_times' => $row['win_times'], 'kill_his' => $row['kill_his'], @@ -100,22 +136,35 @@ class FriendController{ 'add_HP' => $row['add_HP'], 'head_kuang_id' => $row['head_kuang_id'], 'vip_level' => $vip_level, + 'max_rank' => $max_rank, + 'bags' => $rowbags, + 'equip' => $rowlv, + 'sex' => $row['sex'], )); } public function selectUser() { $account_id = $_REQUEST['account_id']; - $conn = $this->getMysql($account_id); - if(!$conn){ - phpcommon\sendError(ERR_USER_BASE + 1, '玩家不存在'); + $conns = $this->getAllMysql(); + if (!$conns) { + 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) { + $flag = 0; + $name = ''; + foreach ($conns as $conn) { + $row = $conn->execQueryOne('SELECT user_name FROM user WHERE accountid=:account_id;', + array( + ':account_id' => $account_id, + )); + if ($row) { + $flag = 1; + $name = $row['user_name']; + break; + } + } + if ($flag == 0) { phpcommon\sendError(ERR_USER_BASE + 1, '玩家不存在'); return; } @@ -123,7 +172,7 @@ class FriendController{ echo json_encode(array( 'errcode' => 0, 'errmsg' => '', - 'name' => $row['user_name'], + 'name' => $name, )); } diff --git a/webapp/controller/GameOverController.class.php b/webapp/controller/GameOverController.class.php index c0b03a9..ffd747b 100644 --- a/webapp/controller/GameOverController.class.php +++ b/webapp/controller/GameOverController.class.php @@ -164,18 +164,13 @@ class GameOverController{ } //道具物品 $first_list = array(); - if (phpcommon\extractChannel($account_id) == 6001 || - phpcommon\extractChannel($account_id) == 6000) { - array_push($first_list, array( + array_push($first_list, array( 'item_id' => 10010, 'item_num' => $num, 'time' => 0, )); - $first_list = $this->randomBox($first_list, 8); - $first_list = $this->randomBox($first_list, 9); - } else { - $first_list = $this->randomReward($rank, $type); - } + $first_list = $this->randomBox($first_list, 8); + $first_list = $this->randomBox($first_list, 9); $first_db = array( 'first_uuid' => $first_uuid, 'first_list' => $first_list, diff --git a/webapp/controller/HangController.class.php b/webapp/controller/HangController.class.php index faf4556..6d3b5e1 100644 --- a/webapp/controller/HangController.class.php +++ b/webapp/controller/HangController.class.php @@ -189,13 +189,14 @@ class HangController{ return; } //当前段位及积分 - $rank = 0; + $rank = 1; $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;', + $max_rank = 1; + $row = $conn->execQueryOne('SELECT integral, pass_status, score, max_integral FROM user WHERE accountid=:accountid;', array( ':accountid' => $account_id, )); @@ -220,6 +221,13 @@ class HangController{ $rank_score = $row['integral']; } } + + if ($row['max_integral'] >= $seaPoint['min'] && $row['max_integral'] <= $seaPoint['max'] + || $row['max_integral'] >= $seaPoint['min'] && $seaPoint['max'] == -1) + { + + $max_rank = $ii; + } } //等级积分 @@ -492,6 +500,7 @@ class HangController{ 'cost' => $cost, 'pass_array' => $pass_array, 'onlinenum' => $num, + 'max_rank' => $max_rank, )); } diff --git a/webapp/controller/PassController.class.php b/webapp/controller/PassController.class.php index 5feac04..bc7db96 100644 --- a/webapp/controller/PassController.class.php +++ b/webapp/controller/PassController.class.php @@ -150,7 +150,8 @@ class PassController{ $min_rank_score = 0; $reward = array(); $week_reward = array(); - $row = $conn->execQueryOne('SELECT integral, pass_status, score FROM user WHERE accountid=:accountid;', + $max_rank = 0; + $row = $conn->execQueryOne('SELECT integral, pass_status, score, max_integral FROM user WHERE accountid=:accountid;', array( ':accountid' => $account_id, )); @@ -175,6 +176,13 @@ class PassController{ $rank_score = $row['integral']; } } + + if ($row['max_integral'] >= $seaPoint['min'] && $row['max_integral'] <= $seaPoint['max'] + || $row['max_integral'] >= $seaPoint['min'] && $seaPoint['max'] == -1) + { + + $max_rank = $ii; + } } if ($rank == 0) { @@ -225,6 +233,7 @@ class PassController{ 'seareward2' => $sea_reward2, 'cost' => $cost, 'pass_array' => $pass_array, + 'max_rank' => $max_rank, )); } diff --git a/webapp/controller/RoleController.class.php b/webapp/controller/RoleController.class.php index 26a87c4..b5a814e 100644 --- a/webapp/controller/RoleController.class.php +++ b/webapp/controller/RoleController.class.php @@ -201,9 +201,9 @@ class RoleController{ break; } } - $ret = $conn->execScript('INSERT INTO user(accountid, user_name, avatar_url, game_times, win_times, kills, harm, add_HP, alive_time, coin_num, integral, kill_his, alive_time_his, harm_his, add_HP_his, act_share_time, act_share_status, create_time, modify_time, first_fight, collect_status, keys_num, battle_re_times, shop_flush_times, kefu_status, sign_sum, box_num, diamond_num, sum_coin, pass_status, score, season_status, recharge_times_total, first_gift, season_time, free_coin, free_diamond, season_end_score, kill_modifytime, win_modifytime, rank_modifytime, vip_score, first_login, daily_first_login, daily_time, free_box, update_time, season_games, season_win, sea_max_kill, sea_max_hart, sea_avg_kill, free_lot_ticket, free_dou_lot_ticket, daily_order1, daily_order2, daily_order3, first_bee, newhand, coin_times, newInfo, first_day_ad, share_video_times, share_video_sums, act_video_status, act_ad_status, biogame_times, shop_view_times, new_first_equip, newhand2,game_times2, view_times2, guildcoin_num, new_second_equip, rmb_num, max_single_recharge, passcard, rmb_lot_ticket, daily_max_single, head_kuang_id, daily_score, daily_offline, create_user, sex, sumlot_coin) ' . - ' VALUES(:accountid, :user_name, :avatar_url, 0, 0, 0, 0, 0, 0, 10000, 0, 0, 0, 0, 0, 0, 0, :create_time, :modify_time, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, :season_time, 0, 0, 0, 0, 0, 0, 0, 0, 0, :daily_time, 0,:update_time,0,0,0,0,0,0,0,0,0,0,0,0,0,:newInfo,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0, 0, 0, 0, 0, 0, 0, 2, 0) ' . - ' ON DUPLICATE KEY UPDATE accountid=:accountid, user_name=:user_name, avatar_url=:avatar_url, game_times=0, win_times=0, kills=0, harm=0, add_HP=0, alive_time=0, coin_num=0, integral=0, kill_his=0, alive_time_his=0, harm_his=0, add_HP_his=0, act_share_time=0, act_share_status=0, modify_time=:modify_time, first_fight=0, collect_status=0, keys_num=0, battle_re_times=0, shop_flush_times=0, kefu_status=0, sign_sum=0, box_num=0, diamond_num=0, sum_coin=0, pass_status=0, score=0, season_status=1, recharge_times_total=0, first_gift=0, season_time=:season_time, free_coin=0, free_diamond=0, season_end_score=0, kill_modifytime=0, win_modifytime=0, rank_modifytime=0, vip_score=0, first_login=0, daily_first_login=0, daily_time=:daily_time, free_box=0, update_time=:update_time, season_games=0, season_win=0, sea_max_kill=0, sea_max_hart=0, sea_avg_kill=0, free_lot_ticket=0, free_dou_lot_ticket=0, daily_order1=0, daily_order2=0, daily_order3=0, first_bee=0, newhand=0, coin_times=0, newInfo=:newInfo, first_day_ad=0, share_video_times=0, share_video_sums=0, act_video_status=0, act_ad_status=0, biogame_times=0, shop_view_times=0, new_first_equip=0, newhand2=0, game_times2=0,view_times2=0, guildcoin_num=0, new_second_equip=2, rmb_num=0, max_single_recharge=0, passcard=0, rmb_lot_ticket=0, daily_max_single=0, head_kuang_id=0, daily_score=0, daily_offline=0, create_user=0, sex=2, sumlot_coin=0;', + $ret = $conn->execScript('INSERT INTO user(accountid, user_name, avatar_url, game_times, win_times, kills, harm, add_HP, alive_time, coin_num, integral, kill_his, alive_time_his, harm_his, add_HP_his, act_share_time, act_share_status, create_time, modify_time, first_fight, collect_status, keys_num, battle_re_times, shop_flush_times, kefu_status, sign_sum, box_num, diamond_num, sum_coin, pass_status, score, season_status, recharge_times_total, first_gift, season_time, free_coin, free_diamond, season_end_score, kill_modifytime, win_modifytime, rank_modifytime, vip_score, first_login, daily_first_login, daily_time, free_box, update_time, season_games, season_win, sea_max_kill, sea_max_hart, sea_avg_kill, free_lot_ticket, free_dou_lot_ticket, daily_order1, daily_order2, daily_order3, first_bee, newhand, coin_times, newInfo, first_day_ad, share_video_times, share_video_sums, act_video_status, act_ad_status, biogame_times, shop_view_times, new_first_equip, newhand2,game_times2, view_times2, guildcoin_num, new_second_equip, rmb_num, max_single_recharge, passcard, rmb_lot_ticket, daily_max_single, head_kuang_id, daily_score, daily_offline, create_user, sex, sumlot_coin, max_integral) ' . + ' VALUES(:accountid, :user_name, :avatar_url, 0, 0, 0, 0, 0, 0, 10000, 0, 0, 0, 0, 0, 0, 0, :create_time, :modify_time, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, :season_time, 0, 0, 0, 0, 0, 0, 0, 0, 0, :daily_time, 0,:update_time,0,0,0,0,0,0,0,0,0,0,0,0,0,:newInfo,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0, 0, 0, 0, 0, 0, 0, 2, 0, 0) ' . + ' ON DUPLICATE KEY UPDATE accountid=:accountid, user_name=:user_name, avatar_url=:avatar_url, game_times=0, win_times=0, kills=0, harm=0, add_HP=0, alive_time=0, coin_num=0, integral=0, kill_his=0, alive_time_his=0, harm_his=0, add_HP_his=0, act_share_time=0, act_share_status=0, modify_time=:modify_time, first_fight=0, collect_status=0, keys_num=0, battle_re_times=0, shop_flush_times=0, kefu_status=0, sign_sum=0, box_num=0, diamond_num=0, sum_coin=0, pass_status=0, score=0, season_status=1, recharge_times_total=0, first_gift=0, season_time=:season_time, free_coin=0, free_diamond=0, season_end_score=0, kill_modifytime=0, win_modifytime=0, rank_modifytime=0, vip_score=0, first_login=0, daily_first_login=0, daily_time=:daily_time, free_box=0, update_time=:update_time, season_games=0, season_win=0, sea_max_kill=0, sea_max_hart=0, sea_avg_kill=0, free_lot_ticket=0, free_dou_lot_ticket=0, daily_order1=0, daily_order2=0, daily_order3=0, first_bee=0, newhand=0, coin_times=0, newInfo=:newInfo, first_day_ad=0, share_video_times=0, share_video_sums=0, act_video_status=0, act_ad_status=0, biogame_times=0, shop_view_times=0, new_first_equip=0, newhand2=0, game_times2=0,view_times2=0, guildcoin_num=0, new_second_equip=2, rmb_num=0, max_single_recharge=0, passcard=0, rmb_lot_ticket=0, daily_max_single=0, head_kuang_id=0, daily_score=0, daily_offline=0, create_user=0, sex=2, sumlot_coin=0, max_integral=0;', array( ':accountid' => $account_id, ':user_name' => $user_name, @@ -438,7 +438,7 @@ class RoleController{ die(); } $ret1 = $conn->execScript('INSERT INTO bag(accountid, id, color_id, status, num, active_time, create_time, modify_time) ' . - ' VALUES(:account_id, :id, 0, :status, 200, :active_time, :create_time, :modify_time) ' . + ' VALUES(:account_id, :id, 0, :status, 300, :active_time, :create_time, :modify_time) ' . ' ON DUPLICATE KEY UPDATE accountid=:account_id, id=:id, color_id=0, status=:status, num=200, active_time=:active_time, modify_time=:modify_time;', array( ':account_id' => $account_id, @@ -574,6 +574,10 @@ class RoleController{ //更新排位积分信息时间 if ($integral != 0) { $min_score = 0; + $update_maxscore = $row['max_integral']; + if ($integral > 0) { + $update_maxscore = $integral + $row['max_integral']; + } $update_score = $integral + $row['integral']; $is_pro = 0; $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); @@ -588,12 +592,13 @@ class RoleController{ 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, max_integral=:max_integral, rank_modifytime=:rank_modifytime ' . ' WHERE accountid=:accountid;', array( ':accountid' => $account_id, ':integral' => $update_score, ':rank_modifytime' => phpcommon\getNowTime(), + ':max_integral' => $update_maxscore, )); if (!$inret) { die(); @@ -904,6 +909,10 @@ class RoleController{ //更新排位积分信息时间 if ($integral != 0) { $min_score = 0; + $update_maxscore = $row['max_integral']; + if ($integral > 0) { + $update_maxscore = $integral + $row['max_integral']; + } $update_score = $integral + $row['integral']; $is_pro = 0; $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); @@ -918,12 +927,13 @@ class RoleController{ 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, max_integral=:max_integral, rank_modifytime=:rank_modifytime ' . ' WHERE accountid=:accountid;', array( ':accountid' => $account_id, ':integral' => $update_score, ':rank_modifytime' => phpcommon\getNowTime(), + ':max_integral' => $update_maxscore, )); if (!$inret) { die();