season passport
This commit is contained in:
parent
f01c661ad8
commit
1b3c33b4b8
@ -222,6 +222,7 @@ CREATE TABLE `passinfo` (
|
||||
`passid` int(11) NOT NULL DEFAULT '0' COMMENT 'passid',
|
||||
`active_status` int(11) NOT NULL DEFAULT '0' COMMENT '普通奖励状态',
|
||||
`honor_status` int(11) NOT NULL DEFAULT '0' COMMENT '充值奖励状态',
|
||||
`season_passport` mediumblob NOT NULL COMMENT '赛季通行证',
|
||||
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`modify_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||
PRIMARY KEY (`idx`),
|
||||
|
@ -80,6 +80,7 @@ class PassController{
|
||||
$open_time = 0;
|
||||
$end_time = 0;
|
||||
$sea_reward = array();
|
||||
$passport_reward = array();
|
||||
$rank_status = 0;
|
||||
$season_meta_table = require('../res/season@season.php');
|
||||
for ($i = 1; $i <= count($season_meta_table); $i++) {
|
||||
@ -89,9 +90,10 @@ class PassController{
|
||||
$end_time = strtotime($season['end_time']);
|
||||
$number = $i;
|
||||
$item_multiply = $this->getExplode($season['reward']);
|
||||
$passportaward = array();
|
||||
//$ii = 0;
|
||||
for($ii = 1; $ii <= count($item_multiply); $ii++) {
|
||||
$rowpass = $conn->execQueryOne('SELECT active_status, honor_status ' .
|
||||
$rowpass = $conn->execQueryOne('SELECT active_status, honor_status, season_passport ' .
|
||||
' FROM passinfo WHERE accountid=:accountid AND passid=:passid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
@ -115,6 +117,21 @@ class PassController{
|
||||
$rank_status = 0;
|
||||
} else {
|
||||
$rank_status = $rowpass['active_status'];
|
||||
if (!is_null($rowpass['season_passport']) && !empty($rowpass['season_passport'])) {
|
||||
$passportawardinfo = json_decode($rowpass['season_passport'], true);
|
||||
foreach($passportawardinfo as $key => $status) {
|
||||
if (!array_key_exists($key, $passportaward)) {
|
||||
$passportaward[$key] = $this->getExplode($season_meta_table[$i][$key]);
|
||||
}
|
||||
|
||||
$passport_reward[$key][] = array(
|
||||
'item_id' => $passportaward[$key][$ii - 1][0],
|
||||
'item_num' => $passportaward[$key][$ii - 1][1],
|
||||
'time' => $passportaward[$key][$ii - 1][2],
|
||||
'status' => $status,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$key = $ii - 1;
|
||||
@ -207,6 +224,7 @@ class PassController{
|
||||
'week' => $week_reward,
|
||||
'seareward' => $sea_reward,
|
||||
'min_rank_score' => $min_rank_score,
|
||||
'passport_reward' => $passport_reward,
|
||||
));
|
||||
}
|
||||
|
||||
@ -292,6 +310,96 @@ class PassController{
|
||||
));
|
||||
}
|
||||
|
||||
public function getPassportReward() {
|
||||
$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;
|
||||
}
|
||||
$passid = $_REQUEST['id'];
|
||||
$name = $_REQUEST['name'];
|
||||
$status = 0;
|
||||
$rowPass = $conn->execQueryOne('SELECT season_passport ' .
|
||||
' FROM passinfo WHERE accountid=:accountid AND passid=:passid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':passid' => $passid
|
||||
));
|
||||
if ($rowPass) {
|
||||
$statusinfo = $rowPass['season_passport'];
|
||||
if (is_null($statusinfo) || empty($statusinfo)) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 3, '没有该奖励');
|
||||
return;
|
||||
}
|
||||
|
||||
$statusobj = json_decode($statusinfo, true);
|
||||
if (!array_key_exists($name, $statusobj)) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 3, '没有该奖励 2');
|
||||
return;
|
||||
}
|
||||
|
||||
$status = $statusobj[$name];
|
||||
if ($status == 1) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '该奖励已领取');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$statusobj[$name] = 1;
|
||||
$ret = $conn->execScript('UPDATE passinfo SET season_passport=:season_passport, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid AND passid=:passid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':passid' => $passid,
|
||||
':season_passport' => json_encode($statusobj),
|
||||
':modify_time' => time()
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
|
||||
$season = array();
|
||||
$season_meta_table = require('../res/season@season.php');
|
||||
for ($i = 1; $i <= count($season_meta_table); $i++) {
|
||||
$season = $this->getSeason($i);
|
||||
if (time() >= strtotime($season['open_time']) && time() <= strtotime($season['end_time'])) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$item_multiply = $this->getExplode($season[$name]);
|
||||
$items = $item_multiply[$passid - 1];
|
||||
|
||||
$reward = array();
|
||||
array_push($reward, array(
|
||||
'item_id' => $items[0],
|
||||
'item_num' => $items[1],
|
||||
'time' => $items[2],
|
||||
));
|
||||
$addreward = new classes\AddReward();
|
||||
$all_item_list = $addreward->addReward($items[0], $items[1], $account_id, $items[2],0);
|
||||
|
||||
$coin_num = $addreward->getCoinNum($account_id);
|
||||
$diamond_num = $addreward->getDiamondNum($account_id);
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg'=> '',
|
||||
'status' => 1,
|
||||
'item_list' => $reward,
|
||||
'coin_nums' => $coin_num,
|
||||
'diamond_nums' => $diamond_num,
|
||||
'all_item_list' => $all_item_list
|
||||
));
|
||||
}
|
||||
|
||||
protected function updateStatus($accountid, $passid)
|
||||
{
|
||||
$conn = $this->getMysql($accountid);
|
||||
|
@ -500,7 +500,8 @@ class RechargeController
|
||||
$shopgoods['type'] != 5 && //等级基金
|
||||
$shopgoods['type'] != 6 && //首充
|
||||
$shopgoods['type'] != 7 && //关卡基金
|
||||
$shopgoods['type'] != 8 //体力基金
|
||||
$shopgoods['type'] != 8 && //体力基金
|
||||
$shopgoods['type'] != 9 //精英手册
|
||||
) {
|
||||
error_log('game2004api payNotify goods type error:' + json_encode($_REQUEST));
|
||||
echo json_encode(array(
|
||||
@ -852,6 +853,66 @@ class RechargeController
|
||||
)
|
||||
);
|
||||
}
|
||||
} else if ($shopgoods['type'] == 9) {
|
||||
//判断当前赛季
|
||||
$number = 0;
|
||||
$season_meta_table = require('../res/season@season.php');
|
||||
for ($i = 1; $i <= count($season_meta_table); $i++) {
|
||||
$season = $season_meta_table[$i];
|
||||
if (time() >= strtotime($season['time1']) && time() <= strtotime($season['time2'])) {
|
||||
$number = $i;
|
||||
$item_multiply = explode('|', $season['season_reward']);
|
||||
|
||||
$passportname = 'shop_' . $goodsid;
|
||||
for ($ii = 1; $ii <= count($item_multiply); $ii++) {
|
||||
$rowpass = $conn->execQueryOne(
|
||||
'SELECT active_status, honor_status, season_passport ' .
|
||||
' FROM passinfo WHERE accountid=:accountid AND passid=:passid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':passid' => $ii,
|
||||
)
|
||||
);
|
||||
|
||||
$season_passport = array(
|
||||
$passportname => 0
|
||||
);
|
||||
if (!$rowpass) {
|
||||
$conn->execScript(
|
||||
'INSERT INTO passinfo(accountid, passid, active_status, honor_status, create_time, modify_time) ' .
|
||||
' VALUES(:accountid, :passid, 0, 0, :create_time, :modify_time) ' .
|
||||
' ON DUPLICATE KEY UPDATE accountid=:accountid, passid=:passid, active_status=0, honor_status=0, modify_time=:modify_time;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':passid' => $ii,
|
||||
':season_passport' => json_encode($season_passport),
|
||||
':create_time' => time(),
|
||||
':modify_time' => time()
|
||||
)
|
||||
);
|
||||
} else {
|
||||
if (!is_null($rowpass['season_passport']) && !empty($rowpass['season_passport'])) {
|
||||
$season_passport = json_decode($rowpass['season_passport'], true);
|
||||
$season_passport[$passportname] = 0;
|
||||
}
|
||||
|
||||
$conn->execScript('UPDATE passinfo SET season_passport=:season_passport, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid AND passid=:passid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':passid' => $passid,
|
||||
':season_passport' => json_encode($season_passport),
|
||||
':modify_time' => time()
|
||||
));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($number == 0) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '赛季未开启');
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
//等级基金,关卡基金,体力基金
|
||||
$solorow = $conn->execQueryOne(
|
||||
|
@ -578,10 +578,11 @@ class RoleController
|
||||
die();
|
||||
}
|
||||
$pass_ret = $conn->execScript(
|
||||
'UPDATE passinfo SET active_status=0, honor_status=0, modify_time=:modify_time ' .
|
||||
'UPDATE passinfo SET active_status=0, honor_status=0, season_passport=:passportinfo, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':passportinfo' => '',
|
||||
':modify_time' => time()
|
||||
)
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user