diff --git a/sql/gamedb2004_n_migrate_200716_01.sql b/sql/gamedb2004_n_migrate_200716_01.sql new file mode 100644 index 0000000..027a914 --- /dev/null +++ b/sql/gamedb2004_n_migrate_200716_01.sql @@ -0,0 +1,8 @@ +begin; + +update equip set id=12137, lv=10 where accountid='6003_2004_oTR6b5T-P8edzzRo0aofeluxDb7Y'; +update equip set id=12137, lv=10 where accountid='6001_2004_oTR6b5Sav4dvPct0YMuFd8ZJdY2I'; + +insert into version (version) values(20200716); + +commit; diff --git a/webapp/controller/RoleController.class.php b/webapp/controller/RoleController.class.php index e2f2439..b9e7bdb 100644 --- a/webapp/controller/RoleController.class.php +++ b/webapp/controller/RoleController.class.php @@ -400,6 +400,174 @@ class RoleController{ return $daily_first_login; } + public function clientBattleReport() + { + $account_id = $_REQUEST['account_id']; //账号 + $conn = $this->getMysql($account_id); + if (!$conn) { + phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); + return; + } + $rank = $_REQUEST['rank']; //排名 + $kills = $_REQUEST['kills']; //击杀数 + $harm = $_REQUEST['harm']; //伤害 + $alive_time = $_REQUEST['alive_time']; //存活时间 + $team_status = $_REQUEST['team_status']; //是否是组队状态 + $kill_his = $kills; + $harm_his = $harm; + $alive_time_his = $alive_time; + $coin_num = $_REQUEST['coin_num']; //金币 + $integral = $_REQUEST['rank_score']; //排位积分 + $team_status = $_REQUEST['team_status']; + $row = $conn->execQueryOne('SELECT * FROM user WHERE accountid=:accountid;', + array( + ':accountid' => $account_id + )); + if (!$row) { + phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家1'); + return; + } + //更新排位积分信息时间 + 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' => $update_score, + ':rank_modifytime' => time(), + )); + if (!$inret) { + die(); + return; + } + } + //更新击杀信息时间 + $k = 0; + if ($row['game_times'] != 0) { + $k = $row['kill_his'] / $row['game_times']; + } + if (($row['kill_his'] + $kills) / ($row['game_times'] + 1) != $k) { + $killret = $conn->execScript('UPDATE user SET kill_modifytime=:kill_modifytime ' . + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':kill_modifytime' => time(), + )); + if (!$killret) { + die(); + return; + } + } + //更新胜场信息时间 + if ($rank == 1) { + $winret = $conn->execScript('UPDATE user SET win_times=:win_times, season_win=:season_win, win_modifytime=:win_modifytime ' . + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':win_times' => $row['win_times'] + 1, + ':season_win' => $row['season_win'] + 1, + ':win_modifytime' => time(), + )); + if (!$winret) { + die(); + return; + } + } + //更新历史最高信息 + if ($kill_his < $row['kill_his']) { + $kill_his = $row['kill_his']; + } + if ($harm_his < $row['harm_his']) { + $harm_his = $row['harm_his']; + } + + $sea_max_hart = $harm; + if ($sea_max_hart < $row['sea_max_hart']) { + $sea_max_hart = $row['sea_max_hart']; + } + + $sea_max_kill = $kills; + if ($sea_max_kill < $row['sea_max_kill']) { + $sea_max_kill = $row['sea_max_kill']; + } + + if ($alive_time_his < $row['alive_time_his']) { + $alive_time_his = $row['alive_time_his']; + } + $nowTime = phpcommon\getdayseconds(time()); + $daily_time = $row['daily_time']; + if ($daily_time == 0 || ($nowTime - phpcommon\getdayseconds($daily_time) > 0)) { + $daily_time = time(); + } + $daily_first_login = $row['daily_first_login']; + $newhand = $row['newhand']; + $p1 = $this->getParameter(NEWHAND_NUM1); + $fight_times = $p1['param_value']; + $p2 = $this->getParameter(NEWHAND_NUM2); + $view_times = $p2['param_value']; + if ($row['game_times'] + 1 == $fight_times && $row['vip_score'] >= $view_times) { + $newhand = 1; + } + + $ret = $conn->execScript('UPDATE user SET game_times=:game_times, kills=:kills, harm=:harm, alive_time=:alive_time, kill_his=:kill_his, alive_time_his=:alive_time_his, harm_his=:harm_his, coin_num=:coin_num, modify_time=:modify_time, first_fight=1, daily_time=:daily_time, season_games=:season_games, sea_max_kill=:sea_max_kill, sea_max_hart=:sea_max_hart, sea_avg_kill=:sea_avg_kill, newhand=:newhand ' . + 'WHERE accountid=:accountid;', + array( + ':game_times' => $row['game_times'] + 1, + ':kill_his' => $kill_his, + ':kills' => $row['kills'] + $kills, + ':harm_his' => $harm_his, + ':harm' => $row['harm'] + $harm, + ':alive_time' => $row['alive_time'] + $alive_time, + ':alive_time_his' => $alive_time_his, + ':accountid' => $account_id, + ':coin_num' => $row['coin_num'] + $coin_num, + ':modify_time' => time(), + ':daily_time' => $daily_time, + ':season_games' => $row['season_games'] + 1, + ':sea_max_kill' => $sea_max_kill, + ':sea_max_hart' => $sea_max_hart, + ':sea_avg_kill' => $row['sea_avg_kill'] + $kills, + ':newhand' => $newhand, + )); + if (!$ret) { + die(); + return; + } + //刷新任务 + $quest = new classes\Quest(); + $quest->triggerQuest(QUEST_DAY_FIGHT, 1, 1, $account_id); + $quest->triggerQuest(QUEST_DAY_ALIVE, 1, (int)($alive_time / 1000 / 60), $account_id); + $quest->triggerQuest(QUEST_DAY_HARM, 1, $harm, $account_id); + $quest->triggerQuest(QUEST_DAY_KILL, 1, $kills, $account_id); + if ($team_status == 1 && $rank <= 5) { + $quest->triggerQuest(QUEST_DAY_RANK, 1, 1, $account_id); + } + if ($team_status == 1) { + $quest->triggerQuest(QUEST_DAY_TEAM, 1, 1, $account_id); + } + + echo json_encode(array( + 'errcode' => 0, + 'errmsg' => '', + )); + + } + public function battleReport() { $account_id = $_REQUEST['account_id']; //账号