From 41a30b699adeb5958fd70dd5bd18400fbee1bd6a Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 30 Dec 2019 19:33:14 +0800 Subject: [PATCH] 1 --- sql/gamedb.sql | 1 + tools/rankserver/game2003rank.py | 8 +++++--- webapp/controller/RoleController.class.php | 10 ++++++--- webapp/controller/TankController.class.php | 24 ++++++++++++++++++---- 4 files changed, 33 insertions(+), 10 deletions(-) diff --git a/sql/gamedb.sql b/sql/gamedb.sql index 429452b..b1bacf1 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -63,6 +63,7 @@ CREATE TABLE `user` ( `daily_buy_times` int(11) NOT NULL DEFAULT '0' COMMENT '每日购买次数', `daily_time` int(11) NOT NULL DEFAULT '0' COMMENT '每日刷新时间', `pass_reward` mediumblob NOT NULL COMMENT '通关奖励信息', + `demotank` 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/tools/rankserver/game2003rank.py b/tools/rankserver/game2003rank.py index be0a546..287068d 100644 --- a/tools/rankserver/game2003rank.py +++ b/tools/rankserver/game2003rank.py @@ -231,9 +231,11 @@ if __name__ == "__main__": app = make_app() app.listen(conf['listen_port']) - conf['rushtime'] = 300 - tornado.ioloop.IOLoop.current().call_later(conf['rushtime'], - lambda : readMysqlData(conf['rushtime']) + rushtime = 300 + if conf['rushtime']: + rushtime = conf['rushtime'] + tornado.ioloop.IOLoop.current().call_later(rushtime, + lambda : readMysqlData(rushtime) ) conf['day_rushtime'] = 5 * 3600 diff --git a/webapp/controller/RoleController.class.php b/webapp/controller/RoleController.class.php index 413e69f..5cfe3ac 100644 --- a/webapp/controller/RoleController.class.php +++ b/webapp/controller/RoleController.class.php @@ -40,8 +40,8 @@ class RoleController{ ':accountid' => $account_id )); if (!$row) { - $ret = $conn->execScript('INSERT INTO user(accountid, user_name, avatar_url, coin_num, create_time, modify_time, collect_status, kefu_status, sign_sum, diamond_num, pass_status, pass, energy, buy_data, tank_data, cumul_coin, off_time, battlecount, invite_status, life_times, new_info, daily_buy_times, daily_time, pass_reward) ' . - ' VALUES(:accountid, :user_name, :avatar_url, 100, :create_time, :modify_time, 0, 0, 0, 0, 0, 0, 0, :buy_data, :tank_data, 0, :off_time, 0, 0, 0, :new_info, 0, 0, :pass_reward)', + $ret = $conn->execScript('INSERT INTO user(accountid, user_name, avatar_url, coin_num, create_time, modify_time, collect_status, kefu_status, sign_sum, diamond_num, pass_status, pass, energy, buy_data, tank_data, cumul_coin, off_time, battlecount, invite_status, life_times, new_info, daily_buy_times, daily_time, pass_reward, demotank) ' . + ' VALUES(:accountid, :user_name, :avatar_url, 100, :create_time, :modify_time, 0, 0, 0, 0, 0, 0, 0, :buy_data, :tank_data, 0, :off_time, 0, 0, 0, :new_info, 0, 0, :pass_reward, 0)', array( ':accountid' => $account_id, ':user_name' => $user_name, @@ -77,6 +77,7 @@ class RoleController{ 'new_info' => '', 'daily_buy_times' => 0, 'pass_reward' => '', + 'demotank' => 0, )); } else { if ($user_name != $row['user_name']) { @@ -102,12 +103,14 @@ class RoleController{ $life_times = $row['life_times']; $daily_buy_times = $row['daily_buy_times']; $kefu_status = $row['kefu_status']; + $demotank = $row['demotank']; if ($nowTime - phpcommon\getdayseconds($row['daily_time']) > 0) { $this->updateDaily($account_id); $invite_status = 0; $life_times = 0; $daily_buy_times = 0; $kefu_status = 0; + $demotank = 0; } echo json_encode(array( 'errcode' => 0, @@ -128,6 +131,7 @@ class RoleController{ 'new_info' => $row['new_info'], 'daily_buy_times' => $daily_buy_times, 'pass_reward' => $row['pass_reward'], + 'demotank' => $demotank )); } } @@ -229,7 +233,7 @@ class RoleController{ } //更新人物信息 $ret = $conn->execScript('UPDATE user SET invite_status=0, life_times=0, daily_buy_times=0, ' . - ' modify_time=:modify_time, daily_time=:daily_time, kefu_status=0 WHERE accountid=:accountid;', + ' modify_time=:modify_time, daily_time=:daily_time, kefu_status=0, demotank=0 WHERE accountid=:accountid;', array( ':accountid' => $account_id, ':modify_time' => time(), diff --git a/webapp/controller/TankController.class.php b/webapp/controller/TankController.class.php index 3482ea6..917fc91 100644 --- a/webapp/controller/TankController.class.php +++ b/webapp/controller/TankController.class.php @@ -238,10 +238,6 @@ class TankController{ return; } } - echo json_encode(array( - 'errcode' => 0, - 'errmsg' => '', - )); if (isset($tankInfo['pass_reward'])) { $pass_reward = $tankInfo['pass_reward']; @@ -257,6 +253,26 @@ class TankController{ return; } } + + if (isset($tankInfo['demotank'])) { + $demotank = $tankInfo['demotank']; + $ret = $conn->execScript('UPDATE user SET demotank=:demotank, modify_time=:modify_time ' . + ' WHERE accountid=:account_id;', + array( + ':account_id' => $account_id, + ':demotank' => $demotank, + ':modify_time' => time() + )); + if (!$ret) { + die(); + return; + } + } + echo json_encode(array( + 'errcode' => 0, + 'errmsg' => '', + )); + } } ?>