1
This commit is contained in:
parent
82a7e42ab9
commit
bcecdaf38e
@ -88,9 +88,13 @@ CREATE TABLE `user` (
|
||||
`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 '每日分享视频次数',
|
||||
|
||||
`daily_skin_times` int(11) NOT NULL DEFAULT '0' COMMENT '每日兑换碎片次数',
|
||||
`share_equip_times` int(11) NOT NULL DEFAULT '0' COMMENT '每日武器分享次数',
|
||||
|
||||
`daily_diamond_times` int(11) NOT NULL DEFAULT '0' COMMENT '每日兑换钻石次数',
|
||||
`newhand` int(11) NOT NULL DEFAULT '0' COMMENT '字节活动礼包领取状态',
|
||||
`game_times2` int(11) NOT NULL DEFAULT '0' COMMENT '字节活动礼包战斗场次',
|
||||
`view_times2` 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;
|
||||
|
10
sql/gamedb2001_n_migrate_200918_01.sql
Normal file
10
sql/gamedb2001_n_migrate_200918_01.sql
Normal file
@ -0,0 +1,10 @@
|
||||
begin;
|
||||
|
||||
alter table user add column `daily_diamond_times` int(11) NOT NULL DEFAULT '0' COMMENT '每日兑换钻石次数';
|
||||
alter table user add column `newhand` int(11) NOT NULL DEFAULT '0' COMMENT '字节活动礼包领取状态';
|
||||
alter table user add column `game_times2` int(11) NOT NULL DEFAULT '0' COMMENT '字节活动礼包战斗场次';
|
||||
alter table user add column `view_times2` int(11) NOT NULL DEFAULT '0' COMMENT '字节活动礼包视频场次';
|
||||
|
||||
insert into version (version) values(2020091801);
|
||||
|
||||
commit;
|
@ -82,6 +82,14 @@ define('COINREWARD', 82);
|
||||
define('SUIPIANREWARD', 83);
|
||||
define('SUIPIANTIME', 84);
|
||||
define('SHAREWUQILV', 85);
|
||||
|
||||
define('ZIJIE_ACTIVITY_FIGHT',86);
|
||||
define('ZIJIE_ACTIVITY_ADS',87);
|
||||
define('ZIJIE_ACTIVITY_REWARD',88);
|
||||
define('ZIJIE_DIAMONDREWARD',89);
|
||||
define('ZIJIE_DIAMONDREWARD_TIMES',90);
|
||||
define('ZIJIE_LUCKYLVUP_NUM',92);
|
||||
|
||||
require 'config_loader.php';
|
||||
|
||||
|
||||
|
@ -100,11 +100,11 @@ class AddReward {
|
||||
break;
|
||||
case 4:
|
||||
//添加角色
|
||||
$this->addSkin($item['itemid'], $item['itemnum'], $account_id);
|
||||
$item_list = $this->addSkin($item['itemid'], $item['itemnum'], $account_id);
|
||||
break;
|
||||
case 6:
|
||||
//添加表情
|
||||
$this->addEmoji($item['itemid'], $account_id, $it['dprice']);
|
||||
$item_list = $this->addEmoji($item['itemid'], $account_id, $it['dprice']);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -311,19 +311,17 @@ class AddReward {
|
||||
protected function addSkin($item_id, $item_num, $accountid)
|
||||
{
|
||||
$item_list = array();
|
||||
$item_id = 0;
|
||||
$item_num = 0;
|
||||
$conn = $this->getMysql($accountid);
|
||||
if (!$conn) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
die();
|
||||
}
|
||||
$rowSkin = $conn->execQueryOne('SELECT fragment_num FROM skin WHERE accountid=:accountid AND fragment_id=:fragment_id;',
|
||||
$rowSkin = $conn->execQueryOne('SELECT fragment_num, skin_status FROM skin WHERE accountid=:accountid AND fragment_id=:fragment_id;',
|
||||
array(
|
||||
':accountid' => $accountid,
|
||||
':fragment_id' => $item_id - 1000
|
||||
));
|
||||
if (!$rowSkin) {
|
||||
if (!$rowSkin || $rowSkin['skin_status'] == 2) {
|
||||
$ret = $conn->execScript('INSERT INTO skin(accountid, skin_id, skin_status, fragment_id, fragment_num, active_time, fragment_status, skin_type, skin_level, skin_experience_level, skin_experience_type, create_time, modify_time) ' .
|
||||
' VALUES(:account_id, :skin_id, :skin_status, :fragment_id, 0, 0, 0, :skin_type, 1, 0, 0, :create_time, :modify_time) ' .
|
||||
' ON DUPLICATE KEY UPDATE accountid=:account_id, skin_id=:skin_id, skin_status=:skin_status, fragment_id=:fragment_id, fragment_num=0, active_time=0, fragment_status=0, skin_type=:skin_type, skin_level=1, skin_experience_level=0, skin_experience_type=0, modify_time=:modify_time;',
|
||||
@ -342,15 +340,17 @@ class AddReward {
|
||||
$item_id = $item_id;
|
||||
$item_num = 1;
|
||||
} else {
|
||||
$i = $this->getItem($item_id);
|
||||
$item_id = 10003;
|
||||
$item_num = $dprice;
|
||||
$item_num = $i['dprice'];
|
||||
$this->addDiamond($item_id, $item_num, $accountid);
|
||||
}
|
||||
|
||||
array_push($item_list, array(
|
||||
'itemid' => $item_id,
|
||||
'itemnum' => $item_num,
|
||||
'item_id' => $item_id,
|
||||
'item_num' => $item_num,
|
||||
));
|
||||
return $item_list;
|
||||
}
|
||||
//添加通行证
|
||||
protected function addPass($item_id, $item_num, $accountid)
|
||||
|
@ -149,7 +149,58 @@ class EquipController{
|
||||
'equip_list' => $equip_list
|
||||
));
|
||||
}
|
||||
public function freeGunEquip()
|
||||
{
|
||||
$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);
|
||||
$skin_list = array();
|
||||
if (!$conn) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
$equip_id = $_REQUEST['id'];
|
||||
$row = $conn->execQueryOne('SELECT * FROM equip WHERE accountid=:account_id AND equip_id=:equip_id;',
|
||||
array(
|
||||
':account_id' => $account_id,
|
||||
':equip_id' => $equip_id
|
||||
));
|
||||
if(!$row) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个装备');
|
||||
return;
|
||||
}
|
||||
$p = $this->getParameter(ZIJIE_LUCKYLVUP_NUM);
|
||||
$e = $this->getEquip($equip_id);
|
||||
$lv = $row['equip_level'] + $p['param_value'];
|
||||
if ($lv >= $e['max_lv']) {
|
||||
$lv = $e['max_lv'];
|
||||
}
|
||||
$ret = $conn->execScript('UPDATE equip SET equip_level=:equip_level, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:account_id AND equip_id=:equip_id;',
|
||||
array(
|
||||
':account_id' => $account_id,
|
||||
':equip_id' => $equip_id,
|
||||
':equip_level' => $lv,
|
||||
':modify_time' => time()
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
|
||||
$quest = new classes\Quest();
|
||||
$quest->triggerQuest(QUEST_DAY_UPDATEEQUIP, 1, 1, $account_id);
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg' => '',
|
||||
'lv' => $lv,
|
||||
));
|
||||
}
|
||||
|
||||
public function updateEquip()
|
||||
{
|
||||
@ -224,6 +275,7 @@ class EquipController{
|
||||
'errcode' => 0,
|
||||
'errmsg' => '',
|
||||
'coin_nums' => $rowuser['coin_num'],
|
||||
'lv' => $equip_level,
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -178,7 +178,7 @@ class HangController{
|
||||
}
|
||||
$id = $_REQUEST['id'];
|
||||
$it = $this->getItem($id);
|
||||
$row = $conn->execQueryOne('SELECT coin_num, daily_skin_times FROM user WHERE accountid=:accountid;',
|
||||
$row = $conn->execQueryOne('SELECT coin_num, daily_skin_times, diamond_num, daily_diamond_times FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
));
|
||||
@ -189,15 +189,29 @@ class HangController{
|
||||
$p1 = $this->getParameter(COINREWARD);
|
||||
$p2 = $this->getParameter(SUIPIANREWARD);
|
||||
$p3 = $this->getParameter(SUIPIANTIME);
|
||||
$num = $row['coin_num'];
|
||||
$times = $row['daily_skin_times'];
|
||||
$p4 = $this->getParameter(ZIJIE_DIAMONDREWARD_TIMES);
|
||||
$p5 = $this->getParameter(ZIJIE_DIAMONDREWARD);
|
||||
$skin_times = $row['daily_skin_times'];
|
||||
$diamond_times = $row['daily_diamond_times'];
|
||||
$addreward = new classes\AddReward();
|
||||
if ($it['type'] == 1) {
|
||||
$num = $p1['param_value'] + $row['coin_num'];
|
||||
$ret = $conn->execScript('UPDATE user SET coin_num=:coin_num, modify_time=:modify_time ' .
|
||||
$num = $p1['param_value'];
|
||||
$addreward->addReward($id, $num, $account_id);
|
||||
}
|
||||
|
||||
if ($it['type'] == 2) {
|
||||
if ($row['daily_diamond_times'] >= $p4['param_value']) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '今日兑换次数已用完');
|
||||
return;
|
||||
}
|
||||
$num = $p5['param_value'];
|
||||
$addreward->addReward($id, $num, $account_id);
|
||||
$diamond_times = $row['daily_diamond_times'] + 1;
|
||||
$ret = $conn->execScript('UPDATE user SET daily_diamond_times=:daily_diamond_times, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':coin_num' => $num,
|
||||
':daily_diamond_times' => $diamond_times,
|
||||
':modify_time' => time()
|
||||
));
|
||||
if (!$ret) {
|
||||
@ -213,12 +227,12 @@ class HangController{
|
||||
}
|
||||
$addreward = new classes\AddReward();
|
||||
$addreward->addReward($id - 1000, $p2['param_value'], $account_id);
|
||||
$times = $row['daily_skin_times'] + 1;
|
||||
$skin_times = $row['daily_skin_times'] + 1;
|
||||
$ret = $conn->execScript('UPDATE user SET daily_skin_times=:daily_skin_times, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':daily_skin_times' => $times,
|
||||
':daily_skin_times' => $skin_times,
|
||||
':modify_time' => time()
|
||||
));
|
||||
if (!$ret) {
|
||||
@ -226,12 +240,67 @@ class HangController{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$coin_num = $addreward->getCoinNum($account_id);
|
||||
$diamond_num = $addreward->getDiamondNum($account_id);
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg' => '',
|
||||
'coin_nums' => $num,
|
||||
'times' => $times,
|
||||
'coin_nums' => $coin_num,
|
||||
'diamond_nums' => $diamond_num,
|
||||
'times' => $skin_times,
|
||||
'daily_diamond_times' => $diamond_times,
|
||||
));
|
||||
}
|
||||
|
||||
public function getNewHandReward()
|
||||
{
|
||||
$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;
|
||||
}
|
||||
$row = $conn->execQueryOne('SELECT newhand FROM user WHERE accountid=:account_id;',
|
||||
array(
|
||||
':account_id' => $account_id
|
||||
));
|
||||
$type = 1;
|
||||
if (!$row || $row['newhand'] != 1) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '未达到领取条件');
|
||||
return;
|
||||
}
|
||||
$ret = $conn->execScript('UPDATE user SET newhand=2, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':modify_time' => time(),
|
||||
':accountid' => $account_id
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
$p_num = $this->getParameter(ZIJIE_ACTIVITY_REWARD);
|
||||
$item_list = array();
|
||||
array_push($item_list, array(
|
||||
'item_id' => $p_num['param_value'],
|
||||
'item_num' => 1,
|
||||
));
|
||||
$addreward = new classes\AddReward();
|
||||
$item_list = $addreward->addReward($p_num['param_value'], 1, $account_id);
|
||||
$coin_num = $addreward->getCoinNum($account_id);
|
||||
$num = $addreward->getDiamondNum($account_id);
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg'=> '',
|
||||
'item_list' => $item_list,
|
||||
'coin_num' => $coin_num,
|
||||
'diamond_nums' => $num,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@ -341,6 +341,51 @@ class PayController{
|
||||
return $item_list;
|
||||
}
|
||||
|
||||
public function getVipDoubleReward()
|
||||
{
|
||||
$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;
|
||||
}
|
||||
$vip_id = $_REQUEST['vip_id'];
|
||||
$type = $_REQUEST['reward_type'];
|
||||
$status = 0;
|
||||
$vip = $this->getVip($vip_id);
|
||||
if (!$vip) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 3, '没有这个奖励');
|
||||
return;
|
||||
}
|
||||
//发送奖励
|
||||
$item_list = array();
|
||||
if ($type == 2) {
|
||||
$item_list = $this->getVipItemInfo($vip['reward']);
|
||||
}
|
||||
if ($type == 1) {
|
||||
$item_list = $this->getVipItemInfo($vip['dailyreward']);
|
||||
}
|
||||
$addreward = new classes\AddReward();
|
||||
foreach ($item_list as $item) {
|
||||
//增加奖励
|
||||
$addreward->addReward($item['item_id'], $item['item_num'] * 2, $account_id);
|
||||
}
|
||||
$coin_num = $addreward->getCoinNum($account_id);
|
||||
$diamond_num = $addreward->getDiamondNum($account_id);
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg'=> '',
|
||||
'coin_nums' => $coin_num,
|
||||
'diamond_nums' => $diamond_num,
|
||||
));
|
||||
}
|
||||
|
||||
public function getVipReward()
|
||||
{
|
||||
$account_id = $_REQUEST['account_id'];
|
||||
@ -717,7 +762,7 @@ class PayController{
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
$row = $conn->execQueryOne('SELECT vip_score FROM user WHERE accountid=:accountid;',
|
||||
$row = $conn->execQueryOne('SELECT vip_score, game_times2, newhand, view_times2 FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
));
|
||||
@ -725,12 +770,25 @@ class PayController{
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
$ret = $conn->execScript('UPDATE user SET vip_score=:vip_score, modify_time=:modify_time ' .
|
||||
|
||||
$newhand = $row['newhand'];
|
||||
$rview_times2 = $row['view_times2'];
|
||||
$p3 = $this->getParameter(ZIJIE_ACTIVITY_FIGHT);
|
||||
$fight_times2 = $p3['value'];
|
||||
$p4 = $this->getParameter(ZIJIE_ACTIVITY_ADS);
|
||||
$view_times2 = $p4['value'];
|
||||
if ($row['game_times2'] >= $fight_times2 && $row['view_times2'] + 1 == $view_times2 && $newhand == 0) {
|
||||
$newhand = 1;
|
||||
}
|
||||
$rview_times2++;
|
||||
$ret = $conn->execScript('UPDATE user SET vip_score=:vip_score, newhand=:newhand, view_times2=:view_times2, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':modify_time' => time(),
|
||||
':vip_score' => $row['vip_score'] + 1
|
||||
':vip_score' => $row['vip_score'] + 1,
|
||||
':newhand' => $newhand,
|
||||
':view_times2' => $rview_times2,
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
@ -739,6 +797,8 @@ class PayController{
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg'=> '',
|
||||
'view_times' => $rview_times2,
|
||||
'newhand' => $newhand,
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -316,7 +316,7 @@ class QuestController{
|
||||
$quest_id = $_REQUEST['quest_id'];
|
||||
$quest_type = $_REQUEST['type'];
|
||||
$p = $this->getParameter(REWARD_TIMES);
|
||||
$times = $p['value'] - 1;
|
||||
$times = (3 - 1) * 2;
|
||||
//发奖励
|
||||
if ($quest_type == 0) {
|
||||
$t = $this->getTaskReward($quest_id);
|
||||
|
@ -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, share_video_times, daily_skin_times, share_equip_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, 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, daily_skin_times=0, share_equip_times=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, daily_skin_times, share_equip_times, daily_diamond_times, newhand, game_times2, view_times2) ' .
|
||||
' 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, 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, 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, daily_skin_times=0, share_equip_times=0, daily_diamond_times=0, newhand=0, game_times2=0, view_times2=0;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':user_name' => $user_name,
|
||||
@ -161,6 +161,10 @@ class RoleController{
|
||||
'share_video_times' => 0,
|
||||
'daily_skin_times' => 0,
|
||||
'share_equip_times' => 0,
|
||||
'daily_diamond_times' => 0,
|
||||
'newhand' => 0,
|
||||
'game_times2' => 0,
|
||||
'view_times2' => 0,
|
||||
));
|
||||
} else {
|
||||
$ret = $conn->execScript('UPDATE user SET first_login=1 ' .
|
||||
@ -200,8 +204,9 @@ class RoleController{
|
||||
$daily_skin_times = $row['daily_skin_times'];
|
||||
$box_num = $row['box_num'];
|
||||
$share_equip_times = $row['share_equip_times'];
|
||||
$daily_diamond_times = $row['daily_diamond_times'];
|
||||
if ($row['daily_time'] == 0 || ($nowTime - phpcommon\getdayseconds($row['daily_time']) > 0)) {
|
||||
$ret = $conn->execScript('UPDATE user SET daily_first_login=0, share_video_times=0, daily_skin_times=0, box_num=0, daily_time=:daily_time, share_equip_times=0,' .
|
||||
$ret = $conn->execScript('UPDATE user SET daily_first_login=0, share_video_times=0, daily_skin_times=0, box_num=0, daily_time=:daily_time, share_equip_times=0, daily_diamond_times=0,' .
|
||||
'modify_time=:modify_time WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
@ -217,6 +222,7 @@ class RoleController{
|
||||
$daily_skin_times = 0;
|
||||
$box_num = 0;
|
||||
$share_equip_times = 0;
|
||||
$daily_diamond_times = 0;
|
||||
}
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
@ -252,6 +258,10 @@ class RoleController{
|
||||
'daily_skin_times' => $daily_skin_times,
|
||||
'box_num' => $box_num,
|
||||
'share_equip_times' => $share_equip_times,
|
||||
'daily_diamond_times' => $daily_diamond_times,
|
||||
'newhand' => $row['newhand'],
|
||||
'game_times2' => $row['game_times2'],
|
||||
'view_times2' => $row['view_times2'],
|
||||
));
|
||||
}
|
||||
}
|
||||
@ -397,7 +407,17 @@ class RoleController{
|
||||
if ($switch == 1) {
|
||||
$daily_first_login = $daily_first_login + 1;
|
||||
}
|
||||
$ret = $conn->execScript('UPDATE user SET game_times=:game_times, kills=:kills, harm=:harm, add_HP=:add_HP, alive_time=:alive_time, kill_his=:kill_his, alive_time_his=:alive_time_his, harm_his=:harm_his, add_HP_his=:add_HP_his, coin_num=:coin_num, modify_time=:modify_time, first_fight=1, score=:score, daily_first_login=:daily_first_login ' .
|
||||
$newhand = $row['newhand'];
|
||||
$game_times2 = $row['game_times2'];
|
||||
$p3 = $this->getParameter(ZIJIE_ACTIVITY_FIGHT);
|
||||
$fight_times2 = $p3['param_value'];
|
||||
$p4 = $this->getParameter(ZIJIE_ACTIVITY_ADS);
|
||||
$view_times2 = $p4['param_value'];
|
||||
if ($row['game_times2'] + 1 == $fight_times2 && $row['view_times2'] >= $view_times2) {
|
||||
$newhand = 1;
|
||||
}
|
||||
$game_times2++;
|
||||
$ret = $conn->execScript('UPDATE user SET game_times=:game_times, kills=:kills, harm=:harm, add_HP=:add_HP, alive_time=:alive_time, kill_his=:kill_his, alive_time_his=:alive_time_his, harm_his=:harm_his, add_HP_his=:add_HP_his, coin_num=:coin_num, modify_time=:modify_time, first_fight=1, score=:score, daily_first_login=:daily_first_login, newhand=:newhand, game_times2=:game_times2 ' .
|
||||
'WHERE accountid=:accountid;',
|
||||
array(
|
||||
':game_times' => $row['game_times'] + 1,
|
||||
@ -413,7 +433,9 @@ class RoleController{
|
||||
':coin_num' => $row['coin_num'] + $coin_num,
|
||||
':modify_time' => time(),
|
||||
':score' => $row['score'] + $score,
|
||||
':daily_first_login' => $daily_first_login
|
||||
':daily_first_login' => $daily_first_login,
|
||||
':game_times2' => $game_times2,
|
||||
':newhand' => $newhand,
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
@ -1017,7 +1039,7 @@ class RoleController{
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '今日领取奖励次数已达上限');
|
||||
return;
|
||||
}
|
||||
$num = 50;
|
||||
$num = 100;
|
||||
|
||||
$ret = $conn->execScript('UPDATE user SET diamond_num=:diamond_num, share_video_times=:share_video_times, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
|
@ -27,6 +27,8 @@ class SignController{
|
||||
'condition' => $sign_conf['condition'],
|
||||
'item_id' => $sign_conf['item_id'],
|
||||
'num' => $sign_conf['num'],
|
||||
'item_id1' => $sign_conf['item_id1'],
|
||||
'num1' => $sign_conf['num1'],
|
||||
);
|
||||
return $s;
|
||||
}
|
||||
@ -335,6 +337,63 @@ class SignController{
|
||||
$this->getSignReward($account_id, $_REQUEST['sign_id'], 1);
|
||||
}
|
||||
|
||||
public function getSignExtraReward(){
|
||||
$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 sign_sum FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
));
|
||||
//获得奖励
|
||||
//判断当前第几周
|
||||
$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) + $_REQUEST['sign_id'] - 7;
|
||||
}
|
||||
$s = $this->getSign($dayid + 90000);
|
||||
$item_id = $s['item_id'];
|
||||
$num = $s['num'];
|
||||
$i = $this->getItem($item_id);
|
||||
if ($i['type'] == 1 || $i['type'] == 2 || $i['type'] == 3) {
|
||||
$num = $num * 4;
|
||||
array_push($item_list, array(
|
||||
'item_id' => $item_id,
|
||||
'item_num' => $num,
|
||||
));
|
||||
} else {
|
||||
array_push($item_list, array(
|
||||
'item_id' => $s['item_id1'],
|
||||
'item_num' => $s['num1'] * 4,
|
||||
));
|
||||
}
|
||||
$addreward = new classes\AddReward();
|
||||
foreach ($item_list as $it) {
|
||||
$addreward->addReward($it['item_id'], $it['item_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
|
||||
));
|
||||
}
|
||||
|
||||
protected function updateSignSum($account_id, $sign_num)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user