This commit is contained in:
aozhiwei 2020-07-24 15:40:31 +08:00
parent 7548403175
commit 208624346b
3 changed files with 70 additions and 6 deletions

View File

@ -87,6 +87,7 @@ CREATE TABLE `user` (
`free_box` int(11) NOT NULL DEFAULT '0' COMMENT '每日免费宝箱',
`chapingcount` int(11) NOT NULL DEFAULT '0' COMMENT '每日插屏次数',
`aderrormaxcount` int(11) NOT NULL DEFAULT '0' COMMENT '每日插屏上限次数',
`share_video_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;

View File

@ -239,7 +239,8 @@ class EquipController{
return;
}
$e = $this->getEquip($equip_id);
if (!$e) {
if (!$e || $e['equip_id'] == null) {
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个装备');
return;
}

View File

@ -115,9 +115,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, sign_sum, box_num, diamond_num, sum_coin, pass_status, score, season_status, recharge_times_total, first_gift, season_time, free_coin, free_diamond, season_end_score, kill_modifytime, win_modifytime, rank_modifytime, vip_score, first_login, daily_first_login, daily_time, free_box, chapingcount, aderrormaxcount) ' .
' 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, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, :daily_time, 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, sign_sum=0, box_num=0, diamond_num=0, sum_coin=0, pass_status=0, score=0, season_status=1, recharge_times_total=0, first_gift=0, season_time=0, free_coin=0, free_diamond=0, season_end_score=0, kill_modifytime=0, win_modifytime=0, rank_modifytime=0, vip_score=0, first_login=0, daily_first_login=0, daily_time=:daily_time, free_box=0, chapingcount=0, aderrormaxcount=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, sign_sum, box_num, diamond_num, sum_coin, pass_status, score, season_status, recharge_times_total, first_gift, season_time, free_coin, free_diamond, season_end_score, kill_modifytime, win_modifytime, rank_modifytime, vip_score, first_login, daily_first_login, daily_time, free_box, chapingcount, aderrormaxcount, share_video_times) ' .
' 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, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, :daily_time, 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, sign_sum=0, box_num=0, diamond_num=0, sum_coin=0, pass_status=0, score=0, season_status=1, recharge_times_total=0, first_gift=0, season_time=0, free_coin=0, free_diamond=0, season_end_score=0, kill_modifytime=0, win_modifytime=0, rank_modifytime=0, vip_score=0, first_login=0, daily_first_login=0, daily_time=:daily_time, free_box=0, chapingcount=0, aderrormaxcount=0, share_video_times=0;',
array(
':accountid' => $account_id,
':user_name' => $user_name,
@ -158,6 +158,7 @@ class RoleController{
'free_box' => 0,
'chapingcount' => 0,
'aderrormaxcount' => 0,
'share_video_times' => 0,
));
} else {
$ret = $conn->execScript('UPDATE user SET first_login=1 ' .
@ -193,8 +194,9 @@ class RoleController{
$daily_first_login = $row['daily_first_login'];
$chapingcount = $row['chapingcount'];
$aderrormaxcount = $row['aderrormaxcount'];
$share_video_times = $row['share_video_times'];
if ($row['daily_time'] == 0 || ($nowTime - phpcommon\getdayseconds($row['daily_time']) > 0)) {
$ret = $conn->execScript('UPDATE user SET daily_first_login=0, ' .
$ret = $conn->execScript('UPDATE user SET daily_first_login=0, share_video_times=0, ' .
'modify_time=:modify_time WHERE accountid=:accountid;',
array(
':accountid' => $account_id,
@ -236,7 +238,8 @@ class RoleController{
'diamond_nums' => $row['diamond_num'],
'free_box' => $row['free_box'],
'chapingcount' => $chapingcount,
'aderrormaxcount' => $aderrormaxcount
'aderrormaxcount' => $aderrormaxcount,
'share_video_times' => $share_video_times
));
}
}
@ -965,5 +968,64 @@ class RoleController{
'aderrormaxcount' => $aderrormaxcount
));
}
public function getVideoReward()
{
$account_id = $_REQUEST['account_id'];
//登录校验
$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;
}
$rowUser = $conn->execQueryOne('SELECT diamond_num, share_video_times FROM user WHERE accountid=:accountid;',
array(
':accountid' => $account_id,
));
if (!$rowUser) {
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
return;
}
if ($rowUser['share_video_times'] >= 3) {
phpcommon\sendError(ERR_USER_BASE + 2, '今日领取奖励次数已达上限');
return;
}
//$p = $this->getParameter(SHARE_VIDEO_REWARD);
$num = 50;//$p['param_value'];
$ret = $conn->execScript('UPDATE user SET diamond_num=:diamond_num, share_video_times=:share_video_times, modify_time=:modify_time ' .
' WHERE accountid=:accountid;',
array(
':accountid' => $account_id,
':diamond_num' => $rowUser['diamond_num'] + $num,
':share_video_times' => $rowUser['share_video_times'] + 1,
':modify_time' => time()
));
if (!$ret) {
die();
return;
}
$addreward = new classes\AddReward();
$diamond_num = $addreward->getDiamondNum($account_id);
echo json_encode(array(
'errcode' => 0,
'errmsg'=> '',
'diamond_nums' => $diamond_num,
));
}
}
?>