diff --git a/sql/gamedb.sql b/sql/gamedb.sql index 3e6e0e7..db49f12 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -56,6 +56,9 @@ CREATE TABLE `user` ( `daily_reward` int(11) NOT NULL DEFAULT '0' COMMENT '每日奖励次数', `cumul_coin` varchar(256) NOT NULL DEFAULT '' COMMENT '累计金币', `off_time` int(11) NOT NULL DEFAULT '0' COMMENT '离线时间', + `battlecount` int(11) NOT NULL DEFAULT '0' COMMENT '战斗次数', + `invite_status` int(11) NOT NULL DEFAULT '0' COMMENT '邀请奖励状态', + `life_times` 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 3745854..5cc2f14 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) ' . - ' VALUES(:accountid, :user_name, :avatar_url, 1000, :create_time, :modify_time, 0, 0, 0, 0, 0, 0, 0, :buy_data, :tank_data, 0, :off_time)', + $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) ' . + ' VALUES(:accountid, :user_name, :avatar_url, 1000, :create_time, :modify_time, 0, 0, 0, 0, 0, 0, 0, :buy_data, :tank_data, 0, :off_time, 0, 0, 0)', array( ':accountid' => $account_id, ':user_name' => $user_name, @@ -68,7 +68,10 @@ class RoleController{ 'pass' => 0, 'buy_list' => '', 'tank_list' => '', - 'cumul_coin' => 0 + 'cumul_coin' => 0, + 'battlecount' => 0, + 'invite_status' => 0, + 'life_times' => 0, )); } else { echo json_encode(array( @@ -84,6 +87,9 @@ class RoleController{ 'buy_list' => $row['buy_data'], 'tank_list' => $row['tank_data'], 'cumul_coin' => $row['cumul_coin'], + 'battlecount' => $row['battlecount'], + 'invite_status' => $row['invite_status'], + 'life_times' => $row['life_times'], )); } } @@ -114,7 +120,6 @@ class RoleController{ phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); return; } - error_log(time() - $row['off_time']); echo json_encode(array( 'errcode' => 0, 'errmsg' => '', diff --git a/webapp/controller/SignController.class.php b/webapp/controller/SignController.class.php index 5b88185..ba1ac12 100644 --- a/webapp/controller/SignController.class.php +++ b/webapp/controller/SignController.class.php @@ -353,6 +353,15 @@ class SignController{ die(); } //更新分享好友信息 + $ret = $conn->execScript('UPDATE user SET invite_status=0, life_times=0, ' . + ' modify_time=:modify_time WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':modify_time' => time() + )); + if (!$ret) { + die(); + } } } ?> diff --git a/webapp/controller/TankController.class.php b/webapp/controller/TankController.class.php index a7922d9..cc34e56 100644 --- a/webapp/controller/TankController.class.php +++ b/webapp/controller/TankController.class.php @@ -168,6 +168,48 @@ class TankController{ die(); return; } + if (isset($tankInfo['battlecount'])) { + $battlecount = $tankInfo['battlecount']; + $ret = $conn->execScript('UPDATE user SET battlecount=:battlecount, modify_time=:modify_time ' . + ' WHERE accountid=:account_id;', + array( + ':account_id' => $account_id, + ':battlecount' => $battlecount, + ':modify_time' => time() + )); + if (!$ret) { + die(); + return; + } + } + if (isset($tankInfo['invite_status'])) { + $invite_status = $tankInfo['invite_status']; + $ret = $conn->execScript('UPDATE user SET invite_status=:invite_status, modify_time=:modify_time ' . + ' WHERE accountid=:account_id;', + array( + ':account_id' => $account_id, + ':invite_status' => $invite_status, + ':modify_time' => time() + )); + if (!$ret) { + die(); + return; + } + } + if (isset($tankInfo['life_times'])) { + $life_times = $tankInfo['life_times']; + $ret = $conn->execScript('UPDATE user SET life_times=:life_times, modify_time=:modify_time ' . + ' WHERE accountid=:account_id;', + array( + ':account_id' => $account_id, + ':life_times' => $life_times, + ':modify_time' => time() + )); + if (!$ret) { + die(); + return; + } + } echo json_encode(array( 'errcode' => 0, 'errmsg' => '',