This commit is contained in:
wangwei01 2019-08-23 14:40:06 +08:00
parent b434e12a16
commit ce54a90de5
5 changed files with 131 additions and 3 deletions

@ -1 +1 @@
Subproject commit 7ecf558df93a2656631782e76c6d35697da72808
Subproject commit 1e3bb4df855f6d11df75545d10b0c2aacea34a06

View File

@ -179,5 +179,66 @@ class EmojiController{
'emoji_list' => $emoji_list
));
}
public function buyEmoji()
{
$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['emoji_id'];
$emoji = $this->getEmoji($id);
if (!$emoji) {
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个表情');
return;
}
if ($emoji['get_type'] != 2) {
phpcommon\sendError(ERR_USER_BASE + 1, '不能用钻石购买');
return;
}
//扣除钻石
$row = $conn->execQueryOne('SELECT diamond_num FROM user WHERE accountid=:accountid;',
array(
':accountid' => $account_id
));
if (!$row) {
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家');
return;
}
if ($row['diamond_num'] < $emoji['number']) {
phpcommon\sendError(ERR_USER_BASE + 3, '钻石不足');
return;
}
$ret = $conn->execScript('UPDATE user SET diamond_num=:diamond_num, modify_time=:modify_time ' .
' WHERE accountid=:accountid;',
array(
':accountid' => $account_id,
':diamond_num' => $row['diamond_num'] - $emoji['number'],
':modify_time' => time()
));
if (!$ret) {
die();
return;
}
//修改状态
$addreward = new classes\AddReward();
$addreward->addReward($id, 1, $account_id);
echo json_encode(array(
'errcode' => 0,
'errmsg'=> '',
'emoji_status' => 1
));
}
}
?>

View File

@ -141,7 +141,7 @@ class PassController{
//奖励信息
$item_list = array();
$seaReward_meta_table = require('../res/seasonReward@seasonReward.php');
for ($j = 1; $j <= count($season_meta_table); $j++) {
for ($j = 1; $j <= count($seaReward_meta_table); $j++) {
$id = $j + $number * 100;
if ($id >= ($number + 1) * 100 || $id <= ($number - 1) * 100) {
continue;

View File

@ -511,5 +511,71 @@ class PayController{
));
}
public function buyPayItem()
{
$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;
}
$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;
}
if ($diamond['coin_type'] == 10003) {
//扣除钻石
$row = $conn->execQueryOne('SELECT diamond_num FROM user WHERE accountid=:accountid;',
array(
':accountid' => $account_id
));
if (!$row) {
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家');
return;
}
if ($row['diamond_num'] < $diamond['coin_num']) {
phpcommon\sendError(ERR_USER_BASE + 3, '钻石不足');
return;
}
$ret = $conn->execScript('UPDATE user SET diamond_num=:diamond_num, modify_time=:modify_time ' .
' WHERE accountid=:accountid;',
array(
':accountid' => $account_id,
':diamond_num' => $row['diamond_num'] - $diamond['coin_num'],
':modify_time' => time()
));
if (!$ret) {
die();
return;
}
}
}
//添加道具
foreach ($item_list as $item) {
$addreward = new classes\AddReward();
$addreward->addReward($item['itemid'], $item['itemnum'], $account_id);
}
echo json_encode(array(
'errcode' => 0,
'errmsg'=> '',
));
}
}
?>

View File

@ -131,11 +131,12 @@ class ShareController{
$free = $_REQUEST['free'];
if ($free != 0) {
$drop_id = 24002;
$p = $this->getParameter(DIAMONDBOX10);
} else {
$drop_id = 24001;
$p = $this->getParameter(DIAMONDBOX);
}
//扣除钻石
$p = $this->getParameter(DIAMONDBOX);
$diamond_num = $p['param_value'];
$this->subCoin($diamond_num, $account_id);
//随机奖励