1
This commit is contained in:
parent
26566d84f9
commit
20890dc0fc
@ -55,6 +55,7 @@ CREATE TABLE `user` (
|
||||
`tank_data` mediumblob NOT NULL COMMENT '坦克信息',
|
||||
`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 '离线时间',
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY `accountid` (`accountid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
2
third_party/phpcommon
vendored
2
third_party/phpcommon
vendored
@ -1 +1 @@
|
||||
Subproject commit d00056a7ea77d281991ae4f826a1d13b5ddd990b
|
||||
Subproject commit 8453d4b26e65ad7cee91d26b1a2ede39910c7117
|
@ -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) ' .
|
||||
' VALUES(:accountid, :user_name, :avatar_url, 1000, :create_time, :modify_time, 0, 0, 0, 0, 0, 0, 0, :buy_data, :tank_data, 0)',
|
||||
$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)',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':user_name' => $user_name,
|
||||
@ -49,7 +49,8 @@ class RoleController{
|
||||
':tank_data' => '',
|
||||
':buy_data' => '',
|
||||
':create_time' => time(),
|
||||
':modify_time' => time()
|
||||
':modify_time' => time(),
|
||||
':off_time' => time()
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
@ -105,7 +106,7 @@ class RoleController{
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, 'session无效');
|
||||
return;
|
||||
}
|
||||
$row = $conn->execQueryOne('SELECT modify_time FROM user WHERE accountid=:accountid;',
|
||||
$row = $conn->execQueryOne('SELECT off_time FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
));
|
||||
@ -113,10 +114,11 @@ class RoleController{
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
error_log(time() - $row['off_time']);
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg' => '',
|
||||
'time' => time() - $row['modify_time'],
|
||||
'time' => time() - $row['off_time'],
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -157,6 +157,17 @@ class TankController{
|
||||
return;
|
||||
}
|
||||
}
|
||||
$ret = $conn->execScript('UPDATE user SET off_time=:off_time, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:account_id;',
|
||||
array(
|
||||
':account_id' => $account_id,
|
||||
':off_time' => time(),
|
||||
':modify_time' => time(),
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg' => '',
|
||||
|
Loading…
x
Reference in New Issue
Block a user