支付添加北上广深屏蔽

This commit is contained in:
aozhiwei 2019-08-26 14:43:23 +08:00
parent 0c8f7a74ac
commit 907ab60fc1
7 changed files with 183 additions and 26 deletions

View File

@ -74,6 +74,8 @@ CREATE TABLE `user` (
`season_status` int(11) NOT NULL DEFAULT '0' COMMENT '赛季奖励状态', `season_status` int(11) NOT NULL DEFAULT '0' COMMENT '赛季奖励状态',
`first_gift` int(11) NOT NULL DEFAULT '0' COMMENT '首充礼包领取状态', `first_gift` int(11) NOT NULL DEFAULT '0' COMMENT '首充礼包领取状态',
`season_time` int(11) NOT NULL DEFAULT '0' COMMENT '赛季结束时间', `season_time` int(11) NOT NULL DEFAULT '0' COMMENT '赛季结束时间',
`free_coin` int(11) NOT NULL DEFAULT '0' COMMENT '每日免费金币',
`free_diamond` int(11) NOT NULL DEFAULT '0' COMMENT '每日免费钻石',
PRIMARY KEY (`idx`), PRIMARY KEY (`idx`),
UNIQUE KEY `accountid` (`accountid`) UNIQUE KEY `accountid` (`accountid`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

View File

@ -61,6 +61,7 @@ class AddReward {
public function addReward($item_id, $item_num, $account_id) public function addReward($item_id, $item_num, $account_id)
{ {
error_log($item_id);
$conn = $this->getMysql($account_id); $conn = $this->getMysql($account_id);
if (!$conn) { if (!$conn) {
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
@ -78,12 +79,10 @@ class AddReward {
)); ));
if ($it['type'] == 5) { if ($it['type'] == 5) {
$item_list = $this->addGift($it['index'], $account_id); $item_list = $this->addGift($it['index'], $account_id);
} else if ($it['type'] == 6) { } else if ($it['type'] == 7) {
error_log($it['id']); $this->addPass($it['id'], $item_num, $account_id);
$item_list = $this->addEmoji($it['id'], $account_id, $it['dprice']);
} else if ($it['type'] == 4) {
$item_list = $this->addSkin($it['id'], $item_num, $account_id);
} }
foreach ($item_list as $item) { foreach ($item_list as $item) {
$i = $this->getItem($item['itemid']); $i = $this->getItem($item['itemid']);
switch ($i['type']) switch ($i['type'])
@ -100,9 +99,13 @@ class AddReward {
//添加角色碎片 //添加角色碎片
$this->addSkinFragment($item['itemid'], $item['itemnum'], $account_id); $this->addSkinFragment($item['itemid'], $item['itemnum'], $account_id);
break; break;
case 7: case 4:
//添加通行证 //添加角色
$this->addPass($item['itemid'], $item['itemnum'], $account_id); $this->addSkin($item['itemid'], $item['itemnum'], $account_id);
break;
case 6:
//添加表情
$this->addEmoji($item['itemid'], $account_id, $it['dprice']);
break; break;
default: default:
break; break;
@ -150,6 +153,7 @@ class AddReward {
$item_id = 0; $item_id = 0;
$item_num = 0; $item_num = 0;
$conn = $this->getMysql($accountid); $conn = $this->getMysql($accountid);
error_log($itemid);
if (!$conn) { if (!$conn) {
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
die(); die();
@ -176,6 +180,7 @@ class AddReward {
$item_id = $itemid; $item_id = $itemid;
$item_num = 1; $item_num = 1;
} else { } else {
error_log(22222222222);
$item_id = 10003; $item_id = 10003;
$item_num = $dprice; $item_num = $dprice;
$this->addDiamond($item_id, $item_num, $accountid); $this->addDiamond($item_id, $item_num, $accountid);
@ -190,8 +195,6 @@ class AddReward {
//添加钻石 //添加钻石
protected function addDiamond($item_id, $item_num, $accountid) protected function addDiamond($item_id, $item_num, $accountid)
{ {
error_log($item_id);
error_log($item_num);
$conn = $this->getMysql($accountid); $conn = $this->getMysql($accountid);
if (!$conn) { if (!$conn) {
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
@ -335,7 +338,7 @@ class AddReward {
$user_ret = $conn->execScript('UPDATE user SET pass_status=1, modify_time=:modify_time ' . $user_ret = $conn->execScript('UPDATE user SET pass_status=1, modify_time=:modify_time ' .
' WHERE accountid=:accountid;', ' WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id, ':accountid' => $accountid,
':modify_time' => time() ':modify_time' => time()
)); ));
if (!$user_ret) { if (!$user_ret) {

View File

@ -98,7 +98,7 @@ class PassController{
$ret = $conn->execScript('UPDATE user SET season_time=:season_time, modify_time=:modify_time ' . $ret = $conn->execScript('UPDATE user SET season_time=:season_time, modify_time=:modify_time ' .
' WHERE accountid=:accountid;', ' WHERE accountid=:accountid;',
array( array(
':accountid' => $accountid, ':accountid' => $account_id,
':season_time' => $end_time, ':season_time' => $end_time,
':modify_time' => time() ':modify_time' => time()
)); ));
@ -421,7 +421,7 @@ class PassController{
$ret = $conn->execScript('UPDATE user SET integral=0, season_status=1, modify_time=:modify_time ' . $ret = $conn->execScript('UPDATE user SET integral=0, season_status=1, modify_time=:modify_time ' .
' WHERE accountid=:accountid;', ' WHERE accountid=:accountid;',
array( array(
':accountid' => $accountid, ':accountid' => $account_id,
':modify_time' => time() ':modify_time' => time()
)); ));
if (!$ret) { if (!$ret) {
@ -431,6 +431,7 @@ class PassController{
echo json_encode(array( echo json_encode(array(
'errcode' => 0, 'errcode' => 0,
'errmsg'=> '', 'errmsg'=> '',
'item_list' => $reward,
)); ));
} }
} }

View File

@ -47,6 +47,18 @@ class PayController{
return $vip; return $vip;
} }
protected function getParameter($para_id)
{
$parameter_meta_cluster = require('../res/parameter@parameter.php');
$parameter_meta = getParameterConfig($parameter_meta_cluster, $para_id);
$p = array(
'id' => $parameter_meta['id'],
'name' => $parameter_meta['param_name'],
'value' => $parameter_meta['param_value'],
);
return $p;
}
protected function getDiamondShop($diamond_id) protected function getDiamondShop($diamond_id)
{ {
$diamond_meta_table = require('../res/diamondshop@diamondshop.php'); $diamond_meta_table = require('../res/diamondshop@diamondshop.php');
@ -135,7 +147,7 @@ class PayController{
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
return; return;
} }
$rowUser = $conn->execQueryOne('SELECT create_time FROM user WHERE accountid=:accountid;', $rowUser = $conn->execQueryOne('SELECT create_time, free_coin, free_diamond FROM user WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
)); ));
@ -159,13 +171,27 @@ class PayController{
':accountid' => $account_id, ':accountid' => $account_id,
':itemid' => $diamond['item_id'] ':itemid' => $diamond['item_id']
)); ));
if ($diamond['limit_num'] == -1) {
$times = $diamond['limit_num'];
} else {
if (!$row) { if (!$row) {
$times = $diamond['limit_num']; $times = $diamond['limit_num'];
} else { } else {
//无限次数
if ($diamond['limit_num'] == -1) {
$times = $diamond['limit_num'];
} else {
//限定次数
$times = $diamond['limit_num'] - $row['today_times']; $times = $diamond['limit_num'] - $row['today_times'];
if ($times < 0) {
$times = 0;
}
}
}
//免费金币钻石领取次数
if ($diamond['coin_type'] == 0) {
if ($diamond['shop_type'] == 2) {
$times = $diamond['limit_num'] - $rowUser['free_coin'];
}
if ($diamond['shop_type'] == 1) {
$times = $diamond['limit_num'] - $rowUser['free_diamond'];
} }
} }
$sub_item = array(); $sub_item = array();
@ -526,7 +552,7 @@ class PayController{
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
return; return;
} }
$row = $conn->execQueryOne('SELECT diamond_num, first_gift FROM user WHERE accountid=:accountid;', $row = $conn->execQueryOne('SELECT diamond_num, first_gift, free_coin, free_diamond FROM user WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id ':accountid' => $account_id
)); ));
@ -583,6 +609,41 @@ class PayController{
return; return;
} }
} }
//每日免费金币钻石
if ($diamond['coin_type'] == 0) {
if ($diamond['shop_type'] == 2) {
if ($row['free_coin'] == 1) {
phpcommon\sendError(ERR_USER_BASE + 4, '每日免费金币已领取');
return;
}
$ret = $conn->execScript('UPDATE user SET free_coin=1, modify_time=:modify_time ' .
' WHERE accountid=:accountid;',
array(
':accountid' => $account_id,
':modify_time' => time()
));
if (!$ret) {
die();
return;
}
}
if ($diamond['shop_type'] == 1) {
if ($row['free_diamond'] == 1) {
phpcommon\sendError(ERR_USER_BASE + 4, '每日免费钻石已领取');
return;
}
$ret = $conn->execScript('UPDATE user SET free_diamond=1, modify_time=:modify_time ' .
' WHERE accountid=:accountid;',
array(
':accountid' => $account_id,
':modify_time' => time()
));
if (!$ret) {
die();
return;
}
}
}
} }
//添加道具 //添加道具
@ -595,5 +656,43 @@ class PayController{
'errmsg'=> '', 'errmsg'=> '',
)); ));
} }
public function getDoubleCoin()
{
$account_id = $_REQUEST['account_id'];
//登录校验
$login = loginVerify($account_id, $_REQUEST['session_id']);
if (!$login) {
phpcommon\sendError(ERR_USER_BASE + 1, 'session无效');
return;
}
$item_id = $_REQUEST['item_id'];
$item_list = array();
$diamond_meta_table = require('../res/diamondshop@diamondshop.php');
for ($i = 1; $i <= count($diamond_meta_table); $i++) {
$diamond = $this->getDiamondShop($i);
if ($item_id != $diamond['item_id']) {
continue;
}
$item = $this->getItem($diamond['item_id']);
$item_list = $this->getItemInfo($item['fuctionindex']);
if (!$item_list) {
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个道具');
return;
}
}
//添加道具
$p = $this->getParameter(REWARD_TIMES);
$times = $p['value'] - 1;
foreach ($item_list as $item) {
$addreward = new classes\AddReward();
$addreward->addReward($item['itemid'], $item['itemnum'] * $times, $account_id);
}
echo json_encode(array(
'errcode' => 0,
'errmsg'=> '',
));
}
} }
?> ?>

View File

@ -100,9 +100,9 @@ class RoleController{
':accountid' => $account_id ':accountid' => $account_id
)); ));
if (!$row) { 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) ' . $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) ' .
' 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) ' . ' 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) ' .
' 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;', ' 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;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
':user_name' => $user_name, ':user_name' => $user_name,

View File

@ -2,13 +2,67 @@
class ServerSwitchController { class ServerSwitchController {
private function isForbidCity()
{
if (in_array(strtolower($_REQUEST['province']),
array(
strtolower('Shanghai'),
strtolower('Beijing'),
'上海',
'北京'
)) ||
in_array(strtolower($_REQUEST['city']),
array(
strtolower('Guangzhou'),
strtolower('Shenzhen'),
strtolower('Chengdu'),
'广州',
'深圳',
'成都'
))
) {
return true;
}
return false;
}
public function getSwitch() public function getSwitch()
{ {
if (SERVER_ENV != _ONLINE) {
echo json_encode(array( echo json_encode(array(
'errcode' => 0, 'errcode' => 0,
'errmsg' => '', 'errmsg' => '',
'payable' => 1 'payable' => 1
)); ));
die();
}
$payable = 0;
/*
玩家第一天不开放
玩家进来第二天玩了7-8次战斗后开放(非北上广并且每天重置战斗次数)
北上广第三天开放
*/
if (phpcommon\isValidSessionId($_REQUEST['account_id'],
$_REQUEST['session_id'])) {
$register_time = phpcommon\extractRegisterTimeSessionId($_REQUEST['session_id']);
$nowtime = time();
if ($nowtime - $register_time > 3600 * 24) {
if ($this->isForbidCity() && $nowtime - $register_time > 3600 * 24 * 2) {
if ($_REQUEST['battle_times'] >= 8) {
$payable = 1;
}
} else {
if ($_REQUEST['battle_times'] >= 8) {
$payable = 1;
}
}
}
}
echo json_encode(array(
'errcode' => 0,
'errmsg' => '',
'payable' => $payable
));
} }
} }

View File

@ -176,7 +176,6 @@ class SignController{
public function signReward() public function signReward()
{ {
$account_id = $_REQUEST['account_id']; $account_id = $_REQUEST['account_id'];
$double = $_REQUEST['double'];
//登录校验 //登录校验
$login = loginVerify($account_id, $_REQUEST['session_id']); $login = loginVerify($account_id, $_REQUEST['session_id']);
if (!$login) { if (!$login) {
@ -322,8 +321,8 @@ class SignController{
die(); die();
} }
} }
//刷新战斗结算奖励次数,商店刷新次数,客服 //刷新战斗结算奖励次数,商店刷新次数,客服, 每日免费金币钻石
$battle_ret = $conn->execScript('UPDATE user SET battle_re_times=0, diamond_shop_flush_times=0, shop_flush_times=0, kefu_status=0, modify_time=:modify_time ' . $battle_ret = $conn->execScript('UPDATE user SET battle_re_times=0, diamond_shop_flush_times=0, shop_flush_times=0, kefu_status=0, free_coin=0, free_diamond=0 modify_time=:modify_time ' .
' WHERE accountid=:accountid;', ' WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
@ -364,10 +363,9 @@ class SignController{
} }
//刷新赛季奖励状态 //刷新赛季奖励状态
$rowUser = $conn->execQueryOne('SELECT season_time, pass_status ' . $rowUser = $conn->execQueryOne('SELECT season_time, pass_status ' .
' FROM user WHERE accountid=:accountid AND passid=:passid;', ' FROM user WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
':passid' => $$passid
)); ));
if (time() > $rowUser['season_time']) { if (time() > $rowUser['season_time']) {