1
This commit is contained in:
parent
b046193d67
commit
386833a32b
@ -88,6 +88,9 @@ 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 '每日武器分享次数',
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY `accountid` (`accountid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
8
sql/gamedb2001_n_migrate_200910_01.sql
Normal file
8
sql/gamedb2001_n_migrate_200910_01.sql
Normal file
@ -0,0 +1,8 @@
|
||||
begin;
|
||||
|
||||
alter table user add column `daily_skin_times` int(11) NOT NULL DEFAULT '0' COMMENT '每日兑换碎片次数';
|
||||
alter table user add column `share_equip_times` int(11) NOT NULL DEFAULT '0' COMMENT '每日武器分享次数';
|
||||
update user set box_num=0 where 1=1;
|
||||
insert into version (version) values(2020091001);
|
||||
|
||||
commit;
|
@ -77,6 +77,11 @@ define('RAND_DIAMONDSHOP_TIME', 60); //钻石商店刷新次数
|
||||
define('DIAMONDBOX', 61); //钻石宝箱花费钻石数
|
||||
define('DIAMONDBOX10', 62); //钻石视频宝箱花费钻石数
|
||||
define('REDLIMIT', 68); //红包上限
|
||||
|
||||
define('COINREWARD', 82);
|
||||
define('SUIPIANREWARD', 83);
|
||||
define('SUIPIANTIME', 84);
|
||||
define('SHAREWUQILV', 85);
|
||||
require 'config_loader.php';
|
||||
|
||||
|
||||
|
@ -321,7 +321,7 @@ class AddReward {
|
||||
$rowSkin = $conn->execQueryOne('SELECT fragment_num FROM skin WHERE accountid=:accountid AND fragment_id=:fragment_id;',
|
||||
array(
|
||||
':accountid' => $accountid,
|
||||
':fragment_id' => $item_id
|
||||
':fragment_id' => $item_id - 1000
|
||||
));
|
||||
if (!$rowSkin) {
|
||||
$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) ' .
|
||||
@ -339,7 +339,7 @@ class AddReward {
|
||||
if(!$ret){
|
||||
die();
|
||||
}
|
||||
$item_id = $itemid;
|
||||
$item_id = $item_id;
|
||||
$item_num = 1;
|
||||
} else {
|
||||
$item_id = 10003;
|
||||
|
@ -576,11 +576,11 @@ class ActivityController{
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
if ($row['box_num'] <= 0) {
|
||||
if ($row['box_num'] >= 1) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '今日开箱子次数已用完');
|
||||
return;
|
||||
}
|
||||
$airReward_uuid = 'game2001api_airReward_uuid:' . md5($_REQUEST['account_id']);
|
||||
$airReward_uuid = 'game2001api_airReward_uuid:' . $_REQUEST['account_id'];
|
||||
$airReward_list = array();
|
||||
$r = $this->getRedis($airReward_uuid);
|
||||
if (!$r) {
|
||||
@ -613,7 +613,7 @@ class ActivityController{
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':box_num' => $row['box_num'] - 1,
|
||||
':box_num' => $row['box_num'] + 1,
|
||||
':modify_time' => time()
|
||||
));
|
||||
if (!$ret) {
|
||||
@ -642,7 +642,7 @@ class ActivityController{
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, 'session无效');
|
||||
return;
|
||||
}
|
||||
$airReward_uuid = 'game2001api_airReward_uuid:' . md5($_REQUEST['account_id']);
|
||||
$airReward_uuid = 'game2001api_airReward_uuid:' . $_REQUEST['account_id'];
|
||||
$airReward_list = array();
|
||||
$r = $this->getRedis($airReward_uuid);
|
||||
if (!$r) {
|
||||
|
@ -215,9 +215,15 @@ class EquipController{
|
||||
if ($row['equip_level'] + 1 >= $e['max_lv']) {
|
||||
$quest->triggerQuest(QUEST_SUM_EQUIPMAX, 2, 1, $account_id);
|
||||
}
|
||||
|
||||
$rowuser = $conn->execQueryOne('SELECT coin_num FROM user WHERE accountid=:account_id;',
|
||||
array(
|
||||
':account_id' => $account_id,
|
||||
));
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg' => '',
|
||||
'coin_nums' => $rowuser['coin_num'],
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
require 'classes/AddReward.php';
|
||||
class HangController{
|
||||
|
||||
protected function getMysql($account_id)
|
||||
@ -27,6 +27,20 @@ class HangController{
|
||||
return $p;
|
||||
}
|
||||
|
||||
protected function getItem($item_id)
|
||||
{
|
||||
$g_conf_item_cluster = require('../res/item@item.php');
|
||||
$item_conf = getItemConfig($g_conf_item_cluster, $item_id);
|
||||
$it = array(
|
||||
'id' => $item_conf['id'],
|
||||
'price' => $item_conf['price'],
|
||||
'dprice' => $item_conf['dprice'],
|
||||
'type' => $item_conf['fuction'],
|
||||
'index' => $item_conf['fuctionindex']
|
||||
);
|
||||
return $it;
|
||||
}
|
||||
|
||||
public function getHangReward()
|
||||
{
|
||||
$account_id = $_REQUEST['account_id'];
|
||||
@ -68,19 +82,21 @@ class HangController{
|
||||
$num = floor($p_time_limit['param_value'] / 5 * $p_num['param_value']);
|
||||
}
|
||||
if ($weight != 0) {
|
||||
$p = $this->getParameter(REWARD_TIMES);
|
||||
$times = $p['param_value'] - 1;
|
||||
//$p = $this->getParameter(REWARD_TIMES);
|
||||
//$times = $p['param_value'] - 1;
|
||||
$times = 3;
|
||||
$num = $num * $times;
|
||||
}
|
||||
$row = $conn->execQueryOne('SELECT * FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
));
|
||||
$num = $num + $row['coin_num'];
|
||||
$ret = $conn->execScript('UPDATE user SET coin_num=:coin_num, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':coin_num' => $num + $row['coin_num'],
|
||||
':coin_num' => $num,
|
||||
':modify_time' => time()
|
||||
));
|
||||
if (!$ret) {
|
||||
@ -91,8 +107,7 @@ class HangController{
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg' => '',
|
||||
'item_id' => $item_id,
|
||||
'num' => $num,
|
||||
'coin_nums' => $num,
|
||||
'time' => time()
|
||||
));
|
||||
}
|
||||
@ -146,5 +161,78 @@ class HangController{
|
||||
'num' => $num
|
||||
));
|
||||
}
|
||||
|
||||
public function duihuanCoin()
|
||||
{
|
||||
$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;
|
||||
}
|
||||
$id = $_REQUEST['id'];
|
||||
$it = $this->getItem($id);
|
||||
$row = $conn->execQueryOne('SELECT coin_num, daily_skin_times FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
));
|
||||
if (!$row) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
$p1 = $this->getParameter(COINREWARD);
|
||||
$p2 = $this->getParameter(SUIPIANREWARD);
|
||||
$p3 = $this->getParameter(SUIPIANTIME);
|
||||
$num = $row['coin_num'];
|
||||
$times = $row['daily_skin_times'];
|
||||
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 ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':coin_num' => $num,
|
||||
':modify_time' => time()
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ($it['type'] == 4) {
|
||||
if ($row['daily_skin_times'] >= $p3['param_value']) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '今日兑换次数已用完');
|
||||
return;
|
||||
}
|
||||
$addreward = new classes\AddReward();
|
||||
$addreward->addReward($id - 1000, $p2['param_value'], $account_id);
|
||||
$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,
|
||||
':modify_time' => time()
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg' => '',
|
||||
'coin_nums' => $num,
|
||||
'times' => $times,
|
||||
));
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -384,6 +384,27 @@ class QuestController{
|
||||
}
|
||||
$quest_id = $_REQUEST['quest_id'];
|
||||
$quest_type = $_REQUEST['type'];
|
||||
$this->submitReward($quest_id, $quest_type, $account_id, 1);
|
||||
|
||||
}
|
||||
|
||||
public function submitdoubleQuest()
|
||||
{
|
||||
$account_id = $_REQUEST['account_id'];
|
||||
//登录校验
|
||||
$login = loginVerify($account_id, $_REQUEST['session_id']);
|
||||
if (!$login) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, 'session无效');
|
||||
return;
|
||||
}
|
||||
$quest_id = $_REQUEST['quest_id'];
|
||||
$quest_type = $_REQUEST['type'];
|
||||
$this->submitReward($quest_id, $quest_type, $account_id, 2);
|
||||
|
||||
}
|
||||
|
||||
protected function submitReward($quest_id, $quest_type, $account_id, $isdouble)
|
||||
{
|
||||
$conn = $this->getMysql($account_id);
|
||||
if (!$conn) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
@ -446,6 +467,9 @@ class QuestController{
|
||||
$num_array = $this->getExplode($d['num']);
|
||||
$item_id = $item_id_array[$key][0];
|
||||
$item_num = $num_array[$key][0];
|
||||
if ($isdouble == 2) {
|
||||
$item_num = $item_num * 2;
|
||||
}
|
||||
array_push($item_list, array(
|
||||
'item_id' => $item_id,
|
||||
'item_num' => $item_num,
|
||||
@ -461,12 +485,15 @@ class QuestController{
|
||||
$array = $this->getExplode($q['reward']);
|
||||
$reward_id = $array[0][0];
|
||||
$reward_num = $array[0][1];
|
||||
$addreward = new classes\AddReward();
|
||||
$addreward->addReward($reward_id, $reward_num, $account_id);
|
||||
if ($isdouble == 2) {
|
||||
$reward_num = $reward_num * 2;
|
||||
}
|
||||
array_push($item_list, array(
|
||||
'item_id' => $reward_id,
|
||||
'item_num' => $reward_num,
|
||||
));
|
||||
$addreward = new classes\AddReward();
|
||||
$addreward->addReward($reward_id, $reward_num, $account_id);
|
||||
}
|
||||
if ($row['quest_type'] == 1) {
|
||||
$active = $conn->execQueryOne('SELECT active_num, active_sum FROM active WHERE accountid=:accountid;',
|
||||
|
@ -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) ' .
|
||||
' 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;',
|
||||
$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;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':user_name' => $user_name,
|
||||
@ -159,6 +159,8 @@ class RoleController{
|
||||
'chapingcount' => 0,
|
||||
'aderrormaxcount' => 0,
|
||||
'share_video_times' => 0,
|
||||
'daily_skin_times' => 0,
|
||||
'share_equip_times' => 0,
|
||||
));
|
||||
} else {
|
||||
$ret = $conn->execScript('UPDATE user SET first_login=1 ' .
|
||||
@ -195,18 +197,26 @@ class RoleController{
|
||||
$chapingcount = $row['chapingcount'];
|
||||
$aderrormaxcount = $row['aderrormaxcount'];
|
||||
$share_video_times = $row['share_video_times'];
|
||||
$daily_skin_times = $row['daily_skin_times'];
|
||||
$box_num = $row['box_num'];
|
||||
$share_equip_times = $row['share_equip_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, ' .
|
||||
$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,' .
|
||||
'modify_time=:modify_time WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':modify_time' => time(),
|
||||
':daily_time' => time(),
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
$daily_first_login = 0;
|
||||
$share_video_times = 0;
|
||||
$daily_skin_times = 0;
|
||||
$box_num = 0;
|
||||
$share_equip_times = 0;
|
||||
}
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
@ -224,7 +234,6 @@ class RoleController{
|
||||
'collect_status' => $row['collect_status'],
|
||||
'keys_num' => $row['keys_num'],
|
||||
'kefu_status' => $row['kefu_status'],
|
||||
'box_num' => $row['box_num'],
|
||||
'diamond_num' => $row['diamond_num'],
|
||||
'pass_status' => $row['pass_status'],
|
||||
'season_status' => $row['season_status'],
|
||||
@ -239,7 +248,10 @@ class RoleController{
|
||||
'free_box' => $row['free_box'],
|
||||
'chapingcount' => $chapingcount,
|
||||
'aderrormaxcount' => $aderrormaxcount,
|
||||
'share_video_times' => $share_video_times
|
||||
'share_video_times' => $share_video_times,
|
||||
'daily_skin_times' => $daily_skin_times,
|
||||
'box_num' => $box_num,
|
||||
'share_equip_times' => $share_equip_times,
|
||||
));
|
||||
}
|
||||
}
|
||||
@ -370,22 +382,22 @@ class RoleController{
|
||||
if ($add_HP_his < $row['add_HP_his']) {
|
||||
$add_HP_his = $row['add_HP_his'];
|
||||
}
|
||||
//添加空投箱
|
||||
$box_num = $row['box_num'];
|
||||
if ($row['box_num'] + 1 <= 20) {
|
||||
$box_num = $row['box_num'] + 1;
|
||||
}
|
||||
// //添加空投箱
|
||||
// $box_num = $row['box_num'];
|
||||
// if ($row['box_num'] + 1 <= 20) {
|
||||
// $box_num = $row['box_num'] + 1;
|
||||
// }
|
||||
$nowTime = phpcommon\getdayseconds(time());
|
||||
$daily_time = $row['daily_time'];
|
||||
if ($daily_time == 0 || ($nowTime - phpcommon\getdayseconds($daily_time) > 0)) {
|
||||
$daily_time = time();
|
||||
}
|
||||
// $daily_time = $row['daily_time'];
|
||||
// if ($daily_time == 0 || ($nowTime - phpcommon\getdayseconds($daily_time) > 0)) {
|
||||
// $daily_time = time();
|
||||
// }
|
||||
$daily_first_login = $row['daily_first_login'];
|
||||
$switch = $this->getSwitch($account_id);
|
||||
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, box_num=:box_num, score=:score, daily_time=:daily_time, daily_first_login=:daily_first_login ' .
|
||||
$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 ' .
|
||||
'WHERE accountid=:accountid;',
|
||||
array(
|
||||
':game_times' => $row['game_times'] + 1,
|
||||
@ -400,9 +412,7 @@ class RoleController{
|
||||
':accountid' => $account_id,
|
||||
':coin_num' => $row['coin_num'] + $coin_num,
|
||||
':modify_time' => time(),
|
||||
':box_num' => $box_num,
|
||||
':score' => $row['score'] + $score,
|
||||
':daily_time' => $daily_time,
|
||||
':daily_first_login' => $daily_first_login
|
||||
));
|
||||
if (!$ret) {
|
||||
@ -986,7 +996,7 @@ class RoleController{
|
||||
|
||||
}
|
||||
|
||||
$rowUser = $conn->execQueryOne('SELECT diamond_num, share_video_times FROM user WHERE accountid=:accountid;',
|
||||
$rowUser = $conn->execQueryOne('SELECT diamond_num, share_video_times, share_equip_times FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
|
||||
@ -997,12 +1007,17 @@ class RoleController{
|
||||
return;
|
||||
|
||||
}
|
||||
$type = 0;
|
||||
if (isset($_REQUEST['type'])) {
|
||||
$type = $_REQUEST['type'];
|
||||
}
|
||||
$lv = 0;
|
||||
if ($type == 0) {
|
||||
if ($rowUser['share_video_times'] >= 3) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '今日领取奖励次数已达上限');
|
||||
return;
|
||||
}
|
||||
//$p = $this->getParameter(SHARE_VIDEO_REWARD);
|
||||
$num = 50;//$p['param_value'];
|
||||
$num = 50;
|
||||
|
||||
$ret = $conn->execScript('UPDATE user SET diamond_num=:diamond_num, share_video_times=:share_video_times, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
@ -1016,14 +1031,49 @@ class RoleController{
|
||||
die();
|
||||
return;
|
||||
}
|
||||
} else if ($type == 1) {
|
||||
$row = $conn->execQueryOne('SELECT equip_level FROM equip WHERE accountid=:account_id AND equip_id=:equip_id;',
|
||||
array(
|
||||
':account_id' => $account_id,
|
||||
':equip_id' => $type
|
||||
));
|
||||
if (!$row) {
|
||||
return;
|
||||
}
|
||||
$lv = $row['equip_level'] + 1;
|
||||
$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' => $type,
|
||||
':equip_level' => $lv,
|
||||
':modify_time' => time()
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
$p = $this->getParameter(SHAREWUQILV);
|
||||
$ret2 = $conn->execScript('UPDATE user SET share_equip_times=:share_equip_times, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':share_equip_times' => $rowUser['share_equip_times'] + $p['param_value'],
|
||||
':modify_time' => time()
|
||||
));
|
||||
if (!$ret2) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$addreward = new classes\AddReward();
|
||||
|
||||
$diamond_num = $addreward->getDiamondNum($account_id);
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg'=> '',
|
||||
'diamond_nums' => $diamond_num,
|
||||
'lv' => $lv,
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -527,7 +527,7 @@ class ShopController{
|
||||
if ($tips == 4) {
|
||||
//扣除货币
|
||||
if ($rowCoin['diamond_num'] < $coin_num) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 5, '钻石不足');
|
||||
phpcommon\sendError(ERR_USER_BASE + 6, '钻石不足');
|
||||
die();
|
||||
}
|
||||
$ret = $conn->execScript('UPDATE user SET diamond_num=:diamond_num, modify_time=:modify_time ' .
|
||||
|
@ -44,6 +44,20 @@ class SignController{
|
||||
return $arr;
|
||||
}
|
||||
|
||||
protected function getItem($item_id)
|
||||
{
|
||||
$g_conf_item_cluster = require('../res/item@item.php');
|
||||
$item_conf = getItemConfig($g_conf_item_cluster, $item_id);
|
||||
$it = array(
|
||||
'id' => $item_conf['id'],
|
||||
'price' => $item_conf['price'],
|
||||
'dprice' => $item_conf['dprice'],
|
||||
'type' => $item_conf['fuction'],
|
||||
'index' => $item_conf['fuctionindex']
|
||||
);
|
||||
return $it;
|
||||
}
|
||||
|
||||
protected function getSeason($season_id)
|
||||
{
|
||||
$season_meta_table = require('../res/season@season.php');
|
||||
@ -224,6 +238,12 @@ class SignController{
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, 'session无效');
|
||||
return;
|
||||
}
|
||||
$sign_id = $_REQUEST['sign_id'];
|
||||
$this->getSignReward($account_id, $sign_id, 0);
|
||||
}
|
||||
|
||||
protected function getSignReward($account_id, $sign_id, $isdouble)
|
||||
{
|
||||
$conn = $this->getMysql($account_id);
|
||||
if (!$conn) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
@ -232,7 +252,7 @@ class SignController{
|
||||
$row = $conn->execQueryOne('SELECT signable FROM sign WHERE accountid=:accountid AND sign_id=:sign_id;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':sign_id' => $_REQUEST['sign_id'],
|
||||
':sign_id' => $sign_id,
|
||||
));
|
||||
if (!$row || $row['signable'] == 1) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '已签到');
|
||||
@ -267,12 +287,25 @@ class SignController{
|
||||
$s = $this->getSign($dayid + 90000);
|
||||
$item_id = $s['item_id'];
|
||||
$num = $s['num'];
|
||||
$i = $this->getItem($item_id);
|
||||
if ($isdouble == 1) {
|
||||
if ($i['type'] == 1 || $i['type'] == 2 || $i['type'] == 3) {
|
||||
$num = $num * 2;
|
||||
} else {
|
||||
array_push($item_list, array(
|
||||
'item_id' => $s['item_id'],
|
||||
'item_num' => $s['num'],
|
||||
'item_id' => $s['item_id1'],
|
||||
'item_num' => $s['num1'],
|
||||
));
|
||||
}
|
||||
}
|
||||
array_push($item_list, array(
|
||||
'item_id' => $item_id,
|
||||
'item_num' => $num,
|
||||
));
|
||||
$addreward = new classes\AddReward();
|
||||
$addreward->addReward($item_id, $num, $account_id);
|
||||
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(
|
||||
@ -299,32 +332,7 @@ class SignController{
|
||||
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) - 7;
|
||||
}
|
||||
$s = $this->getSign($dayid + 90000);
|
||||
$item_id = $s['item_id'];
|
||||
$num = $s['num'];
|
||||
$p = $this->getParameter(REWARD_TIMES);
|
||||
$times = $p['param_value'] - 1;
|
||||
$num = $num * $times;
|
||||
$addreward = new classes\AddReward();
|
||||
$addreward->addReward($item_id, $num, $account_id);
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg' => '',
|
||||
));
|
||||
$this->getSignReward($account_id, $_REQUEST['sign_id'], 1);
|
||||
}
|
||||
|
||||
|
||||
|
@ -241,7 +241,7 @@ class SkinController{
|
||||
return;
|
||||
}
|
||||
if ($row['skin_type'] != 1) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 2,'皮肤无法解锁');
|
||||
phpcommon\sendError(ERR_USER_BASE + 3,'皮肤无法解锁');
|
||||
return;
|
||||
}
|
||||
$fragment_num = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user