This commit is contained in:
aozhiwei 2019-11-12 16:17:46 +08:00
parent 20890dc0fc
commit 5a062a415e
4 changed files with 63 additions and 4 deletions

View File

@ -56,6 +56,9 @@ CREATE TABLE `user` (
`daily_reward` int(11) NOT NULL DEFAULT '0' COMMENT '每日奖励次数', `daily_reward` int(11) NOT NULL DEFAULT '0' COMMENT '每日奖励次数',
`cumul_coin` varchar(256) NOT NULL DEFAULT '' COMMENT '累计金币', `cumul_coin` varchar(256) NOT NULL DEFAULT '' COMMENT '累计金币',
`off_time` int(11) NOT NULL DEFAULT '0' 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`), PRIMARY KEY (`idx`),
UNIQUE KEY `accountid` (`accountid`) UNIQUE KEY `accountid` (`accountid`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

View File

@ -40,8 +40,8 @@ class RoleController{
':accountid' => $account_id ':accountid' => $account_id
)); ));
if (!$row) { 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) ' . $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)', ' 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( array(
':accountid' => $account_id, ':accountid' => $account_id,
':user_name' => $user_name, ':user_name' => $user_name,
@ -68,7 +68,10 @@ class RoleController{
'pass' => 0, 'pass' => 0,
'buy_list' => '', 'buy_list' => '',
'tank_list' => '', 'tank_list' => '',
'cumul_coin' => 0 'cumul_coin' => 0,
'battlecount' => 0,
'invite_status' => 0,
'life_times' => 0,
)); ));
} else { } else {
echo json_encode(array( echo json_encode(array(
@ -84,6 +87,9 @@ class RoleController{
'buy_list' => $row['buy_data'], 'buy_list' => $row['buy_data'],
'tank_list' => $row['tank_data'], 'tank_list' => $row['tank_data'],
'cumul_coin' => $row['cumul_coin'], '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, '没有这个玩家'); phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
return; return;
} }
error_log(time() - $row['off_time']);
echo json_encode(array( echo json_encode(array(
'errcode' => 0, 'errcode' => 0,
'errmsg' => '', 'errmsg' => '',

View File

@ -353,6 +353,15 @@ class SignController{
die(); 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();
}
} }
} }
?> ?>

View File

@ -168,6 +168,48 @@ class TankController{
die(); die();
return; 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( echo json_encode(array(
'errcode' => 0, 'errcode' => 0,
'errmsg' => '', 'errmsg' => '',