1
This commit is contained in:
parent
2fda8442f2
commit
492edce525
@ -96,6 +96,7 @@ CREATE TABLE `user` (
|
||||
`newInfo` mediumblob NOT NULL COMMENT '新手引导信息',
|
||||
|
||||
`first_day_ad` 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;
|
||||
|
@ -89,6 +89,7 @@ define('NEWHAND_NUM2', 109); //新人奖励广告次数
|
||||
define('DAILYCOIN_DECAY', 130); //每日金币衰减比例
|
||||
define('DAILYCOIN_TIMES', 131); //每日金币领取次数
|
||||
define('DAILYCOIN_NUM', 132); //每日金币基准数
|
||||
define('SHARE_VIDEO_REWARD', 147); //分享视频奖励
|
||||
require 'config_loader.php';
|
||||
|
||||
|
||||
|
@ -167,9 +167,9 @@ class RoleController{
|
||||
break;
|
||||
}
|
||||
}
|
||||
$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, update_time, season_games, season_win, sea_max_kill, sea_max_hart, sea_avg_kill, free_lot_ticket, free_dou_lot_ticket, daily_order1, daily_order2, daily_order3, first_bee, newhand, coin_times, newInfo, first_day_ad) ' .
|
||||
' VALUES(:accountid, :user_name, :avatar_url, 0, 0, 0, 0, 0, 0, 200, 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, :season_time, 0, 0, 0, 0, 0, 0, 0, 0, 0, :daily_time, 0,:update_time,0,0,0,0,0,0,0,0,0,0,0,0,0,:newInfo,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=:season_time, 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, update_time=:update_time, season_games=0, season_win=0, sea_max_kill=0, sea_max_hart=0, sea_avg_kill=0, free_lot_ticket=0, free_dou_lot_ticket=0, daily_order1=0, daily_order2=0, daily_order3=0, first_bee=0, newhand=0, coin_times=0, newInfo=:newInfo, first_day_ad=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, update_time, season_games, season_win, sea_max_kill, sea_max_hart, sea_avg_kill, free_lot_ticket, free_dou_lot_ticket, daily_order1, daily_order2, daily_order3, first_bee, newhand, coin_times, newInfo, first_day_ad, share_video_times) ' .
|
||||
' VALUES(:accountid, :user_name, :avatar_url, 0, 0, 0, 0, 0, 0, 200, 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, :season_time, 0, 0, 0, 0, 0, 0, 0, 0, 0, :daily_time, 0,:update_time,0,0,0,0,0,0,0,0,0,0,0,0,0,:newInfo,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=:season_time, 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, update_time=:update_time, season_games=0, season_win=0, sea_max_kill=0, sea_max_hart=0, sea_avg_kill=0, free_lot_ticket=0, free_dou_lot_ticket=0, daily_order1=0, daily_order2=0, daily_order3=0, first_bee=0, newhand=0, coin_times=0, newInfo=:newInfo, first_day_ad=0, share_video_times=0;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':user_name' => $user_name,
|
||||
@ -225,6 +225,7 @@ class RoleController{
|
||||
'newInfo' => '',
|
||||
'first_day_ad' => 0,
|
||||
'integral' => 0,
|
||||
'share_video_times' => 0,
|
||||
));
|
||||
} else {
|
||||
if ($avatar_url != '') {
|
||||
@ -252,9 +253,10 @@ class RoleController{
|
||||
$coin_times = $row['coin_times'];
|
||||
$kefu_status = $row['kefu_status'];
|
||||
$first_day_ad = $row['first_day_ad'];
|
||||
$share_video_times = $row['share_video_times'];
|
||||
if ($row['update_time'] == 0 || ($nowTime - phpcommon\getdayseconds($row['update_time']) > 0)) {
|
||||
$ret = $conn->execScript('UPDATE user SET daily_first_login=0, kefu_status=0, coin_times=0, ' .
|
||||
'modify_time=:modify_time, first_day_ad=0 WHERE accountid=:accountid;',
|
||||
'modify_time=:modify_time, first_day_ad=0, share_video_times=0 WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':modify_time' => time(),
|
||||
@ -267,6 +269,7 @@ class RoleController{
|
||||
$kefu_status = 0;
|
||||
$coin_times = 0;
|
||||
$first_day_ad = 0;
|
||||
$share_video_times = 0;
|
||||
if (time() > $row['season_time'] && $row['season_time'] != 0) {
|
||||
$this->updateSeasonStatus($account_id);
|
||||
}
|
||||
@ -316,7 +319,8 @@ class RoleController{
|
||||
'coin_times' => $coin_times,
|
||||
'newInfo' => $row['newInfo'],
|
||||
'first_day_ad' => 0,
|
||||
'integral' => $row['integral']
|
||||
'integral' => $row['integral'],
|
||||
'share_video_times' => $share_video_times,
|
||||
));
|
||||
}
|
||||
}
|
||||
@ -1353,5 +1357,136 @@ class RoleController{
|
||||
'num' => $num
|
||||
));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
$p = $this->getParameter(SHARE_VIDEO_REWARD);
|
||||
$num = $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,
|
||||
|
||||
));
|
||||
}
|
||||
|
||||
public function getDeskReward()
|
||||
{
|
||||
$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 first_gift FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
));
|
||||
|
||||
if (!$rowUser) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
|
||||
$ret = $conn->execScript('UPDATE user SET first_gift=1, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':modify_time' => time()
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
|
||||
$addreward = new classes\AddReward();
|
||||
$item_list = array();
|
||||
$all_item_list = array();
|
||||
$items = $addreward->addReward(13003, 1, $account_id, 0, 0);
|
||||
array_push($item_list, array(
|
||||
'item_id' => 13003,
|
||||
'item_num' => 1,
|
||||
'time' => 0,
|
||||
|
||||
));
|
||||
array_push($item_list, array(
|
||||
'item_id' => 15003,
|
||||
'item_num' => 1,
|
||||
'time' => 0,
|
||||
|
||||
));
|
||||
|
||||
foreach($items as $i) {
|
||||
array_push($all_item_list, array(
|
||||
'item_id' => $i['item_id'],
|
||||
'item_num' => $i['item_num'],
|
||||
'time' => $i['time'],
|
||||
));
|
||||
}
|
||||
$items = $addreward->addReward(15003, 1, $account_id, 0, 0);
|
||||
foreach($items as $i) {
|
||||
array_push($all_item_list, array(
|
||||
'item_id' => $i['item_id'],
|
||||
'item_num' => $i['item_num'],
|
||||
'time' => $i['time'],
|
||||
));
|
||||
}
|
||||
|
||||
$diamond_num = $addreward->getDiamondNum($account_id);
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg'=> '',
|
||||
'item_list'=>$item_list,
|
||||
'all_item_list' => $all_item_list,
|
||||
'diamond_nums' => $diamond_num,
|
||||
'flag' => 1,
|
||||
));
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -427,7 +427,8 @@ class ShareController{
|
||||
':accountid' => $account_id
|
||||
));
|
||||
$share_meta_table = require('../res/share@share.php');
|
||||
if (count($rows) < count($share_meta_table)) {
|
||||
if (count($rows) == 0) {
|
||||
error_log(111111111);
|
||||
$num = count($rows) + 1;
|
||||
for ($i = $num; $i <= count($share_meta_table); $i++) {
|
||||
$id = $i;
|
||||
@ -527,7 +528,7 @@ class ShareController{
|
||||
}
|
||||
$item_list = array();
|
||||
$addreward = new classes\AddReward();
|
||||
if ($ach_id != 6) {
|
||||
//if ($ach_id != 6) {
|
||||
$array = $this->getExplode($sh['rewards']);
|
||||
array_push($item_list, array(
|
||||
'item_id' => $array[0][0],
|
||||
@ -535,14 +536,14 @@ class ShareController{
|
||||
'time' => $array[0][2],
|
||||
));
|
||||
$all_item_list = $addreward->addReward($array[0][0], $array[0][1], $account_id, $array[0][2], 0);
|
||||
} else if ($ach_id == 6) {
|
||||
array_push($item_list, array(
|
||||
'item_id' => 10003,
|
||||
'item_num' => 50,
|
||||
'time' => 0,
|
||||
));
|
||||
$addreward->addReward(10003, 50, $account_id, 0, 0);
|
||||
}
|
||||
//} else if ($ach_id == 6) {
|
||||
//array_push($item_list, array(
|
||||
// 'item_id' => 10003,
|
||||
// 'item_num' => 100,
|
||||
// 'time' => 0,
|
||||
//));
|
||||
//$addreward->addReward(10003, 100, $account_id, 0, 0);
|
||||
//}
|
||||
//更新状态
|
||||
$ret = $conn->execScript('UPDATE share_achievement SET status=1, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid AND ach_id=:ach_id;',
|
||||
|
@ -299,6 +299,8 @@ class SignController{
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
));
|
||||
|
||||
|
||||
//获得奖励
|
||||
//判断当前第几周
|
||||
$item_list = array();
|
||||
@ -364,6 +366,27 @@ class SignController{
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
$row = $conn->execQueryOne('SELECT signable FROM sign WHERE accountid=:accountid AND sign_id=:sign_id;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':sign_id' => $_REQUEST['sign_id'],
|
||||
));
|
||||
if (!$row || $row['signable'] == 1) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '已签到');
|
||||
return;
|
||||
}
|
||||
$ret = $conn->execScript('UPDATE sign SET sign_time=:sign_time, signable=1, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid AND sign_id=:sign_id;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':sign_id' => $_REQUEST['sign_id'],
|
||||
':sign_time' => time(),
|
||||
':modify_time' => time()
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
$rowUser = $conn->execQueryOne('SELECT sign_sum FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
@ -371,29 +394,56 @@ class SignController{
|
||||
//获得奖励
|
||||
//判断当前第几周
|
||||
$item_list = array();
|
||||
$week = ceil($rowUser['sign_sum'] / 7);
|
||||
$dayid = ($week - 1) * 7 + $_REQUEST['sign_id'];
|
||||
//如果大于配置表最后一周,按最后一周奖励
|
||||
$g_conf_sign_cluster = require('../res/signDaily@signDaily.php');
|
||||
if ($dayid > count($g_conf_sign_cluster)) {
|
||||
$dayid = count($g_conf_sign_cluster) - 7;
|
||||
|
||||
}
|
||||
//$dayid = $_REQUEST['sign_id'];
|
||||
$s = $this->getSign($dayid + 90000);
|
||||
$item_id_array = $this->getExplode($s['item_id']);
|
||||
$num_array = $this->getExplode($s['num']);
|
||||
$time_array = $this->getExplode($s['time']);
|
||||
$addreward = new classes\AddReward();
|
||||
for ($i = 0; i < count($item_id_array); $i++) {
|
||||
$all_item_list = array();
|
||||
for ($addtimes = 0; $addtimes < 2; $addtimes++) {
|
||||
for ($i = 0; $i < count($item_id_array); $i++) {
|
||||
$item_id = $item_id_array[$i][0];
|
||||
$num = $num_array[$i][0];
|
||||
$time = $time_array[$i][0];
|
||||
$addreward->addReward($item_id, $num, $account_id, $time,0);
|
||||
array_push($item_list, array(
|
||||
'item_id' => $item_id,
|
||||
'item_num' => $num,
|
||||
'time' => $time,
|
||||
));
|
||||
$items = $addreward->addReward($item_id, $num, $account_id, $time,0);
|
||||
|
||||
foreach($items as $j) {
|
||||
array_push($all_item_list, array(
|
||||
'item_id' => $j['item_id'],
|
||||
'item_num' => $j['item_num'],
|
||||
'time' => $j['time'],
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
//$addreward = new classes\AddReward();
|
||||
//$addreward->addReward($item_id, $num, $account_id);
|
||||
$coin_num = $addreward->getCoinNum($account_id);
|
||||
$diamond_num = $addreward->getDiamondNum($account_id);
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg' => '',
|
||||
'item_list' => $item_list,
|
||||
'coin_nums' => $coin_num,
|
||||
'diamond_nums' => $diamond_num
|
||||
'diamond_nums' => $diamond_num,
|
||||
'all_item_list' => $all_item_list
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
protected function updateSignSum($account_id, $sign_num)
|
||||
{
|
||||
$conn = $this->getMysql($account_id);
|
||||
|
Loading…
x
Reference in New Issue
Block a user