diff --git a/sql/gamedb.sql b/sql/gamedb.sql index b38dcd9..7d771d3 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -74,6 +74,7 @@ CREATE TABLE `user` ( `daily_first_login` int(11) NOT NULL DEFAULT '0' COMMENT '每天是否第一次登陆', `daily_time` int(11) NOT NULL DEFAULT '0' COMMENT '每日刷新时间', `free_box` int(11) NOT NULL DEFAULT '0' COMMENT '每日免费宝箱', + `update_time` 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/webapp/controller/RoleController.class.php b/webapp/controller/RoleController.class.php index 9f77b32..c8720b4 100644 --- a/webapp/controller/RoleController.class.php +++ b/webapp/controller/RoleController.class.php @@ -116,15 +116,15 @@ 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) ' . - ' 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) ' . - ' 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;', + $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) ' . + ' 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, update_time=0;', array( ':accountid' => $account_id, ':user_name' => $user_name, ':avatar_url' => $avatar_url, ':create_time' => time(), - ':modify_time' => 0, + ':modify_time' => time(), ':daily_time' => 0 )); if (!$ret) { diff --git a/webapp/controller/SignController.class.php b/webapp/controller/SignController.class.php index 4aa3ed6..c885cc7 100644 --- a/webapp/controller/SignController.class.php +++ b/webapp/controller/SignController.class.php @@ -129,18 +129,19 @@ class SignController{ $last_sign_id = $row['sign_id']; } } - $rowuser = $conn->execQueryOne('SELECT modify_time FROM user WHERE accountid=:accountid;', + $rowuser = $conn->execQueryOne('SELECT update_time FROM user WHERE accountid=:accountid;', array( ':accountid' => $account_id )); - if ($nowTime - phpcommon\getdayseconds($rowuser['modify_time']) > 0) { + if ($nowTime - phpcommon\getdayseconds($rowuser['update_time']) > 0) { //每日刷新 $this->updateDaily($account_id); $this->updateSeasonStatus($account_id); - if (phpcommon\getMondayseconds(time()) - phpcommon\getMondayseconds($rowuser['modify_time']) > 0) { + if (phpcommon\getMondayseconds(time()) - phpcommon\getMondayseconds($rowuser['update_time']) > 0) { $this->updateWeekReward($account_id); } $passed_days = floor(($nowTime - phpcommon\getdayseconds($last_sign_time)) / (3600 * 24)); + if ($passed_days > 7 - $last_sign_id) { //跨周时删除老数据 $num = 0; @@ -409,11 +410,12 @@ 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, update_time=:update_time ' . ' WHERE accountid=:accountid;', array( ':accountid' => $account_id, - ':modify_time' => time() + ':modify_time' => time(), + ':update_time' => time() )); if (!$battle_ret) { die();