1
This commit is contained in:
parent
c044ec1b32
commit
cca86a8ec4
@ -61,6 +61,7 @@ CREATE TABLE `user` (
|
|||||||
`life_times` int(11) NOT NULL DEFAULT '0' COMMENT '复活次数',
|
`life_times` int(11) NOT NULL DEFAULT '0' COMMENT '复活次数',
|
||||||
`new_info` mediumblob NOT NULL COMMENT '新手信息',
|
`new_info` mediumblob NOT NULL COMMENT '新手信息',
|
||||||
`daily_buy_times` int(11) NOT NULL DEFAULT '0' COMMENT '每日购买次数',
|
`daily_buy_times` int(11) NOT NULL DEFAULT '0' COMMENT '每日购买次数',
|
||||||
|
`daily_time` 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;
|
||||||
|
@ -22,9 +22,9 @@ class RoleController{
|
|||||||
$avatar_url = $_REQUEST['avatar_url'];
|
$avatar_url = $_REQUEST['avatar_url'];
|
||||||
//登录校验()
|
//登录校验()
|
||||||
$login = loginVerify($account_id, $_REQUEST['session_id']);
|
$login = loginVerify($account_id, $_REQUEST['session_id']);
|
||||||
if (!$login) {
|
if (!$login) {
|
||||||
phpcommon\sendError(ERR_USER_BASE + 1, 'session无效');
|
phpcommon\sendError(ERR_USER_BASE + 1, 'session无效');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$conn = $this->getMysql($account_id);
|
$conn = $this->getMysql($account_id);
|
||||||
if (!$conn) {
|
if (!$conn) {
|
||||||
@ -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, battlecount, invite_status, life_times, new_info, daily_buy_times) ' .
|
$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, new_info, daily_buy_times, daily_time) ' .
|
||||||
' VALUES(:accountid, :user_name, :avatar_url, 100, :create_time, :modify_time, 0, 0, 0, 0, 0, 0, 0, :buy_data, :tank_data, 0, :off_time, 0, 0, 0, :new_info, 0)',
|
' VALUES(:accountid, :user_name, :avatar_url, 100, :create_time, :modify_time, 0, 0, 0, 0, 0, 0, 0, :buy_data, :tank_data, 0, :off_time, 0, 0, 0, :new_info, 0, 0)',
|
||||||
array(
|
array(
|
||||||
':accountid' => $account_id,
|
':accountid' => $account_id,
|
||||||
':user_name' => $user_name,
|
':user_name' => $user_name,
|
||||||
@ -77,6 +77,25 @@ class RoleController{
|
|||||||
'daily_buy_times' => 0,
|
'daily_buy_times' => 0,
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
|
if ($user_name != $row['user_name']) {
|
||||||
|
$ret = $conn->execScript('UPDATE user SET user_name=:user_name, modify_time=:modify_time ' .
|
||||||
|
' WHERE accountid=:accountid;',
|
||||||
|
array(
|
||||||
|
':accountid' => $account_id,
|
||||||
|
':user_name' => $user_name,
|
||||||
|
':modify_time' => time()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
if ($avatar_url != $row['avatar_url']) {
|
||||||
|
$ret = $conn->execScript('UPDATE user SET avatar_url=:avatar_url, modify_time=:modify_time ' .
|
||||||
|
' WHERE accountid=:accountid;',
|
||||||
|
array(
|
||||||
|
':accountid' => $account_id,
|
||||||
|
':avatar_url' => $avatar_url,
|
||||||
|
':modify_time' => time()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
$this->updateDaily($account_id, $row['daily_time']);
|
||||||
echo json_encode(array(
|
echo json_encode(array(
|
||||||
'errcode' => 0,
|
'errcode' => 0,
|
||||||
'errmsg' => '',
|
'errmsg' => '',
|
||||||
@ -164,5 +183,50 @@ class RoleController{
|
|||||||
'diamond_num' => $row['diamond_num'],
|
'diamond_num' => $row['diamond_num'],
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function updateDaily($account_id, $daily_time)
|
||||||
|
{
|
||||||
|
$conn = $this->getMysql($account_id);
|
||||||
|
$nowTime = phpcommon\getdayseconds(time());
|
||||||
|
if ($nowTime - phpcommon\getdayseconds($daily_time) > 0) {
|
||||||
|
//更新每日奖励次数
|
||||||
|
$ret = $conn->execScript('UPDATE daily_reward SET free_coin_time=0, free_jewel_time=0, free_power_time=0, ' .
|
||||||
|
' modify_time=:modify_time WHERE accountid=:accountid;',
|
||||||
|
array(
|
||||||
|
':accountid' => $account_id,
|
||||||
|
':modify_time' => time()
|
||||||
|
));
|
||||||
|
if (!$ret) {
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
//更新每日任务
|
||||||
|
$ret = $conn->execScript('DELETE FROM quest WHERE accountid=:accountid;',
|
||||||
|
array(
|
||||||
|
':accountid' => $account_id,
|
||||||
|
));
|
||||||
|
if (!$ret) {
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
//更新试玩次数
|
||||||
|
$ret = $conn->execScript('DELETE FROM try_play WHERE accountid=:accountid;',
|
||||||
|
array(
|
||||||
|
':accountid' => $account_id,
|
||||||
|
));
|
||||||
|
if (!$ret) {
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
//更新人物信息
|
||||||
|
$ret = $conn->execScript('UPDATE user SET invite_status=0, life_times=0, daily_buy_times=0, ' .
|
||||||
|
' modify_time=:modify_time, daily_time=:daily_time WHERE accountid=:accountid;',
|
||||||
|
array(
|
||||||
|
':accountid' => $account_id,
|
||||||
|
':modify_time' => time(),
|
||||||
|
':daily_time' => time()
|
||||||
|
));
|
||||||
|
if (!$ret) {
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -115,7 +115,6 @@ class SignController{
|
|||||||
|
|
||||||
if ($nowTime - phpcommon\getdayseconds($last_sign_time) > 0) {
|
if ($nowTime - phpcommon\getdayseconds($last_sign_time) > 0) {
|
||||||
//每日刷新
|
//每日刷新
|
||||||
$this->updateDaily($account_id);
|
|
||||||
$passed_days = floor(($nowTime - phpcommon\getdayseconds($last_sign_time)) / (3600 * 24));
|
$passed_days = floor(($nowTime - phpcommon\getdayseconds($last_sign_time)) / (3600 * 24));
|
||||||
if ($passed_days > 7 - $last_sign_id) {
|
if ($passed_days > 7 - $last_sign_id) {
|
||||||
//跨周时删除老数据
|
//跨周时删除老数据
|
||||||
@ -322,45 +321,5 @@ class SignController{
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function updateDaily($account_id)
|
|
||||||
{
|
|
||||||
$conn = $this->getMysql($account_id);
|
|
||||||
//更新每日奖励次数
|
|
||||||
$ret = $conn->execScript('UPDATE daily_reward SET free_coin_time=0, free_jewel_time=0, free_power_time=0, ' .
|
|
||||||
' modify_time=:modify_time WHERE accountid=:accountid;',
|
|
||||||
array(
|
|
||||||
':accountid' => $account_id,
|
|
||||||
':modify_time' => time()
|
|
||||||
));
|
|
||||||
if (!$ret) {
|
|
||||||
die();
|
|
||||||
}
|
|
||||||
//更新每日任务
|
|
||||||
$ret = $conn->execScript('DELETE FROM quest WHERE accountid=:accountid;',
|
|
||||||
array(
|
|
||||||
':accountid' => $account_id,
|
|
||||||
));
|
|
||||||
if (!$ret) {
|
|
||||||
die();
|
|
||||||
}
|
|
||||||
//更新试玩次数
|
|
||||||
$ret = $conn->execScript('DELETE FROM try_play WHERE accountid=:accountid;',
|
|
||||||
array(
|
|
||||||
':accountid' => $account_id,
|
|
||||||
));
|
|
||||||
if (!$ret) {
|
|
||||||
die();
|
|
||||||
}
|
|
||||||
//更新分享好友信息
|
|
||||||
$ret = $conn->execScript('UPDATE user SET invite_status=0, life_times=0, daily_buy_times=0, ' .
|
|
||||||
' modify_time=:modify_time WHERE accountid=:accountid;',
|
|
||||||
array(
|
|
||||||
':accountid' => $account_id,
|
|
||||||
':modify_time' => time()
|
|
||||||
));
|
|
||||||
if (!$ret) {
|
|
||||||
die();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user