Compare commits

...

1 Commits

Author SHA1 Message Date
aozhiwei
3780500060 1 2020-03-06 12:31:22 +08:00
3 changed files with 65 additions and 5 deletions

View File

@ -63,6 +63,9 @@ CREATE TABLE `user` (
`battle_re_times` int(11) NOT NULL COMMENT '每日战斗奖励次数',
`shop_flush_times` int(11) NOT NULL COMMENT '每日商店刷新次数',
`kefu_status` int(11) NOT NULL COMMENT '客服奖励状态(0:未领取,1:已领取)',
`online_time` int(11) NOT NULL DEFAULT '0' COMMENT '用户在线时长',
`idcard` int(11) NOT NULL DEFAULT '0' COMMENT '是否绑定身份证',
`isold` 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;

@ -1 +1 @@
Subproject commit 5fb5d7f6fcd174b9c4ad4e30e189e90e2b8c846e
Subproject commit c1eb6b3006cca677b7e7a06b2e2ac0e9d0108fd4

View File

@ -75,6 +75,59 @@ class RoleController{
return $p;
}
public function idcardInfo()
{
$account_id = $_REQUEST['account_id'];
$session_id = $_REQUEST['session_id'];
$idcard = $_REQUEST['idcard'];
//登录校验
$login = loginVerify($account_id, $_REQUEST['session_id']);
if (!$login) {
phpcommon\sendError(ERR_USER_BASE + 1, 'session无效');
return;
}
$conn = $this->getMysql($account_id);
if (!$conn) {
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
return;
}
if (empty($_REQUEST['account_id'])) {
phpcommon\sendError(ERR_USER_BASE + 1, 'session无效');
return;
}
$row = $conn->execQueryOne('SELECT idcard, online_time FROM user WHERE accountid=:accountid;',
array(
':accountid' => $account_id
));
if (!$row) {
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
return;
}
$year_old = 0;
$ret = $conn->execScript('UPDATE user SET idcard=1 WHERE accountid=:accountid;',
array(
':modify_time' => time()
));
if (!$ret) {
die();
return;
}
if ($year_old >= 18) {
$ret = $conn->execScript('UPDATE user SET isold=1 WHERE accountid=:accountid;',
array(
':modify_time' => time()
));
if (!$ret) {
die();
return;
}
}
echo json_encode(array(
'errcode' => 0,
'errmsg' => '',
));
}
public function roleInfo()
{
$account_id = $_REQUEST['account_id'];
@ -100,9 +153,9 @@ 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) ' .
' 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) ' .
' 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;',
$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, online_time, idcard, isold) ' .
' 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) ' .
' 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, online_time=0, idcard=0, isold=0;',
array(
':accountid' => $account_id,
':user_name' => $user_name,
@ -129,7 +182,9 @@ class RoleController{
'first_fight' => 0,
'collect_status' => 0,
'keys_num' => 0,
'kefu_status' => 0
'kefu_status' => 0,
'idcard' => 0,
'online_time' => 0,
));
} else {
echo json_encode(array(
@ -148,6 +203,8 @@ class RoleController{
'collect_status' => $row['collect_status'],
'keys_num' => $row['keys_num'],
'kefu_status' => $row['kefu_status'],
'idcard' => $row['idcard'],
'online_time' => $row['online_time'],
));
}
}