From b055f9a5adec0424ca2f31d6e145c8d1cca84258 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 10 Jun 2020 19:13:48 +0800 Subject: [PATCH] 1 --- sql/gamedb.sql | 1 + sql/gamedb2001_n_migrate_200610_02.sql | 6 ++ .../controller/ActivityController.class.php | 2 + webapp/controller/RoleController.class.php | 57 ++++++++++++++++--- webapp/controller/SignController.class.php | 2 +- 5 files changed, 60 insertions(+), 8 deletions(-) create mode 100644 sql/gamedb2001_n_migrate_200610_02.sql diff --git a/sql/gamedb.sql b/sql/gamedb.sql index d3b36d8..4356ccf 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -86,6 +86,7 @@ CREATE TABLE `user` ( `daily_time` int(11) NOT NULL DEFAULT '0' COMMENT '每日刷新时间', `free_box` int(11) NOT NULL DEFAULT '0' COMMENT '每日免费宝箱', `chapingcount` int(11) NOT NULL DEFAULT '0' COMMENT '每日插屏次数', + `aderrormaxcount` 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/gamedb2001_n_migrate_200610_02.sql b/sql/gamedb2001_n_migrate_200610_02.sql new file mode 100644 index 0000000..801ec78 --- /dev/null +++ b/sql/gamedb2001_n_migrate_200610_02.sql @@ -0,0 +1,6 @@ +begin; + +alter table user add column `aderrormaxcount` int(11) NOT NULL DEFAULT '0' COMMENT '每日插屏上限次数'; + +insert into version (version) values(2020061002); +commit; diff --git a/webapp/controller/ActivityController.class.php b/webapp/controller/ActivityController.class.php index 52c83ef..8ce1f06 100644 --- a/webapp/controller/ActivityController.class.php +++ b/webapp/controller/ActivityController.class.php @@ -210,6 +210,7 @@ class ActivityController{ phpcommon\sendError(ERR_USER_BASE + 1, 'session无效'); return; } + $conn = $this->getMysql($account_id); if (!$conn) { phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家'); @@ -219,6 +220,7 @@ class ActivityController{ array( ':accountid' => $account_id )); + if (!$row) { phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家'); return; diff --git a/webapp/controller/RoleController.class.php b/webapp/controller/RoleController.class.php index 09f2cac..4a6d6c5 100644 --- a/webapp/controller/RoleController.class.php +++ b/webapp/controller/RoleController.class.php @@ -115,9 +115,9 @@ class RoleController{ ':accountid' => $account_id )); if (!$row) { - $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, chapingcount) ' . - ' VALUES(:accountid, :user_name, :avatar_url, 0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, :daily_time, 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=0, 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, chapingcount=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, chapingcount, aderrormaxcount) ' . + ' VALUES(:accountid, :user_name, :avatar_url, 0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, :daily_time, 0, 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=0, 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, chapingcount=0, aderrormaxcount=0;', array( ':accountid' => $account_id, ':user_name' => $user_name, @@ -156,7 +156,8 @@ class RoleController{ 'first_login' => 0, 'daily_first_login' => 0, 'free_box' => 0, - 'chapingcount' => 0 + 'chapingcount' => 0, + 'aderrormaxcount' => 0, )); } else { $ret = $conn->execScript('UPDATE user SET first_login=1 ' . @@ -191,8 +192,9 @@ class RoleController{ $nowTime = phpcommon\getdayseconds(time()); $daily_first_login = $row['daily_first_login']; $chapingcount = $row['chapingcount']; + $aderrormaxcount = $row['aderrormaxcount']; if ($row['daily_time'] == 0 || ($nowTime - phpcommon\getdayseconds($row['daily_time']) > 0)) { - $ret = $conn->execScript('UPDATE user SET daily_first_login=0, chapingcount=0, ' . + $ret = $conn->execScript('UPDATE user SET daily_first_login=0, ' . 'modify_time=:modify_time WHERE accountid=:accountid;', array( ':accountid' => $account_id, @@ -203,7 +205,6 @@ class RoleController{ return; } $daily_first_login = 0; - $chapingcount = 0; } echo json_encode(array( 'errcode' => 0, @@ -234,7 +235,8 @@ class RoleController{ 'coin_nums' => $row['coin_num'], 'diamond_nums' => $row['diamond_num'], 'free_box' => $row['free_box'], - 'chapingcount' => $chapingcount + 'chapingcount' => $chapingcount, + 'aderrormaxcount' => $aderrormaxcount )); } } @@ -922,5 +924,46 @@ class RoleController{ 'chapingcount' => $chapingcount, )); } + + public function updateadErrorMaxCount() + { + $account_id = $_REQUEST['account_id']; + //登录校验 + $login = loginVerify($account_id, $_REQUEST['session_id']); + if (!$login) { + phpcommon\sendError(ERR_USER_BASE + 1, 'session无效'); + return; + } + $conn = $this->getMysql($account_id); + if (!$conn) { + phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); + return; + } + $row = $conn->execQueryOne('SELECT aderrormaxcount FROM user WHERE accountid=:accountid;', + array( + ':accountid' => $account_id + )); + if (!$row) { + phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); + return; + } + $aderrormaxcount = $row['aderrormaxcount'] + 1; + $ret = $conn->execScript('UPDATE user SET aderrormaxcount=:aderrormaxcount, modify_time=:modify_time ' . + ' WHERE accountid=:accountid;', + array( + ':modify_time' => time(), + ':accountid' => $account_id, + ':aderrormaxcount' => $aderrormaxcount + )); + if (!$ret) { + die(); + return; + } + echo json_encode(array( + 'errcode' => 0, + 'errmsg' => '', + 'aderrormaxcount' => $aderrormaxcount + )); + } } ?> diff --git a/webapp/controller/SignController.class.php b/webapp/controller/SignController.class.php index 6acfe0b..3b89597 100644 --- a/webapp/controller/SignController.class.php +++ b/webapp/controller/SignController.class.php @@ -380,7 +380,7 @@ class SignController{ } } //刷新战斗结算奖励次数,商店刷新次数,客服, 每日免费金币钻石 - $battle_ret = $conn->execScript('UPDATE user SET battle_re_times=0, diamond_shop_flush_times=0, shop_flush_times=0, kefu_status=0, free_coin=0, free_diamond=0, modify_time=:modify_time, free_box=0 ' . + $battle_ret = $conn->execScript('UPDATE user SET battle_re_times=0, diamond_shop_flush_times=0, shop_flush_times=0, kefu_status=0, free_coin=0, free_diamond=0, modify_time=:modify_time, free_box=0, chapingcount=0, aderrormaxcount=0 ' . ' WHERE accountid=:accountid;', array( ':accountid' => $account_id,