1
This commit is contained in:
parent
7035c8309b
commit
cca00f4da9
@ -110,4 +110,33 @@ CREATE TABLE `t_bag` (
|
||||
KEY `accountid` (`accountid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
DROP TABLE IF EXISTS `t_gun_skin`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `t_gun_skin` (
|
||||
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`accountid` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'accountid',
|
||||
`skin_id` int(11) NOT NULL DEFAULT '0' COMMENT '皮肤ID',
|
||||
`deadline` int(11) NOT NULL DEFAULT '0' COMMENT '试用截止时间',
|
||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY `accountid_skin_id` (`accountid`, `skin_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
DROP TABLE IF EXISTS `t_gun_talent`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `t_gun_talent` (
|
||||
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`accountid` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'accountid',
|
||||
`type_id` int(11) NOT NULL DEFAULT '0' COMMENT '枪类型的id',
|
||||
`talent_id` int(11) NOT NULL DEFAULT '0' COMMENT '技能ID',
|
||||
`talent_lv` int(11) NOT NULL DEFAULT '0' COMMENT '技能等级',
|
||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY `accountid_type_id_skill_id` (`accountid`, `type_id`,`skill_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
-- Dump completed on 2015-08-19 18:51:22
|
||||
|
@ -1,244 +0,0 @@
|
||||
<?php
|
||||
|
||||
require 'classes/Quest.php';
|
||||
require 'classes/AddReward.php';
|
||||
|
||||
require_once('mt/Parameter.php');
|
||||
require_once('mt/Drop.php');
|
||||
require_once('mt/RankReward.php');
|
||||
require_once('mt/Equip.php');
|
||||
require_once('mt/Box.php');
|
||||
|
||||
class GameOverController extends BaseAuthedController {
|
||||
|
||||
public function firstRewardInfo()
|
||||
{
|
||||
$first_uuid = 'game2005api_first_uuid:' . $this->getAccountId();
|
||||
$rank = $_REQUEST['rank'];
|
||||
$type = isset($_REQUEST['type']) ? $_REQUEST['type'] : 0;
|
||||
$coin = 0;
|
||||
$score = 0;
|
||||
$num = 1;
|
||||
$par = mt\Parameter::getVal('equipreward_parameter', 0);
|
||||
if ($type == 1) {
|
||||
$ar = mt\RankReward::getOldRankReward($rank);
|
||||
$coin = $ar['zbmode_param'];
|
||||
$num = ceil($ar['zbmode_param'] / $par);
|
||||
if (isset($_REQUEST['kills'])) {
|
||||
$score = $_REQUEST['kills'] * 10;
|
||||
}
|
||||
} else if ($type == 0) {
|
||||
$num = isset($_REQUEST['coin']) ? ceil($_REQUEST['coin'] / $par) : $num;
|
||||
}
|
||||
$first_list = array();
|
||||
array_push($first_list, array(
|
||||
'item_id' => 10010,
|
||||
'item_num' => $num,
|
||||
'time' => 0,
|
||||
));
|
||||
mt\Box::randomBox($firstList, 8);
|
||||
mt\Box::randomBox($firstList, 9);
|
||||
$first_db = array(
|
||||
'first_uuid' => $first_uuid,
|
||||
'first_list' => $first_list,
|
||||
);
|
||||
$this->redisSetAndExpire($first_uuid, $first_uuid, json_encode($first_db), 1000 * 3600 * 2);
|
||||
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg'=> '',
|
||||
'first_uuid' => $first_uuid,
|
||||
'item_list' => $first_list,
|
||||
'coin' => $coin,
|
||||
'score' => $score,
|
||||
));
|
||||
}
|
||||
|
||||
public function getFirstReward()
|
||||
{
|
||||
$type = $_REQUEST['type'];
|
||||
$first_uuid = $_REQUEST['first_uuid'];
|
||||
$addreward = new classes\AddReward();
|
||||
$item_list = array();
|
||||
$all_item_list = array();
|
||||
if ($type == 0) {
|
||||
mt\Box::randomBoxNN(5, $itemList);
|
||||
} else {
|
||||
$info = $this->redisGetJson($first_uuid, $first_uuid);
|
||||
if (empty($info)) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1,'session失效');
|
||||
return;
|
||||
}
|
||||
$item_list = $info['first_list'];
|
||||
}
|
||||
foreach($item_list as $it) {
|
||||
$items = $addreward->addReward($it['item_id'],
|
||||
$it['item_num'],
|
||||
$this->getAccountId(),
|
||||
$it['time'],
|
||||
0);
|
||||
foreach($items as $j) {
|
||||
array_push($all_item_list, array(
|
||||
'item_id' => $j['item_id'],
|
||||
'item_num' => $j['item_num'],
|
||||
'time' => $j['time'],
|
||||
));
|
||||
}
|
||||
}
|
||||
$userInfo = $this->getUserInfo(array(
|
||||
'coin_num',
|
||||
'rmb_num',
|
||||
));
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg'=> '',
|
||||
'coin_nums' => $userInfo['coin_num'],
|
||||
'rmb_nums' => $userInfo['rmb_num'],
|
||||
'item_list' => $item_list,
|
||||
'all_item_list' => $all_item_list
|
||||
));
|
||||
}
|
||||
|
||||
public function getFuckBoxReward()
|
||||
{
|
||||
$id = isset($_REQUEST['id']) ? $_REQUEST['id'] : 10;
|
||||
$item_list = array();
|
||||
$all_item_list = array();
|
||||
mt\Box::randomBoxNew($id, $itemList);
|
||||
$addreward = new classes\AddReward();
|
||||
foreach($item_list as $it) {
|
||||
$items = $addreward->addReward($it['item_id'],
|
||||
$it['item_num'],
|
||||
$this->getAccountId(),
|
||||
$it['time'],
|
||||
0);
|
||||
foreach($items as $j) {
|
||||
array_push($all_item_list, array(
|
||||
'item_id' => $j['item_id'],
|
||||
'item_num' => $j['item_num'],
|
||||
'time' => $j['time'],
|
||||
));
|
||||
}
|
||||
}
|
||||
$userInfo = $this->getUserInfo(array(
|
||||
'coin_num',
|
||||
'rmb_num'
|
||||
));
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg'=> '',
|
||||
'coin_nums' => $userInfo['coin_num'],
|
||||
'rmb_nums' => $userInfo['rmb_num'],
|
||||
'item_list' => $item_list,
|
||||
'all_item_list' => $all_item_list
|
||||
));
|
||||
}
|
||||
|
||||
public function updateDiamond()
|
||||
{
|
||||
$userInfo = $this->getUserInfo(array(
|
||||
'rmb_num'
|
||||
));
|
||||
$par = mt\Parameter::getVal('clan_diamond', 0);
|
||||
if ($userInfo['rmb_num'] < $par) {
|
||||
$par = 0;
|
||||
}
|
||||
$addreward = new classes\AddReward();
|
||||
$items = $addreward->addReward(10003, -$par, $account_id, 0, 0);
|
||||
$newUserInfo = $this->getUserInfo(array(
|
||||
'rmb_num'
|
||||
));
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg'=> '',
|
||||
'rmb_nums' => $userInfo['rmb_num'],
|
||||
));
|
||||
}
|
||||
|
||||
public function addSpoilsItems()
|
||||
{
|
||||
/*
|
||||
data: [
|
||||
{
|
||||
"values":[item_id, item_num]
|
||||
}
|
||||
]
|
||||
*/
|
||||
$addreward = new classes\AddReward();
|
||||
$item_list = array();
|
||||
$all_item_list = array();
|
||||
$arr = json_decode($_REQUEST['data'], true);
|
||||
if (!$arr) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 3, '没有这个道具');
|
||||
return;
|
||||
}
|
||||
foreach ($arr as $a) {
|
||||
$val = $a['values'];
|
||||
array_push($item_list, array(
|
||||
'item_id' => $val[0],
|
||||
'item_num' => $val[1],
|
||||
'time' => 0,
|
||||
));
|
||||
$items = $addreward->addReward($val[0], $val[1], $account_id, 0, 0);
|
||||
foreach($items as $it) {
|
||||
array_push($all_item_list, array(
|
||||
'item_id' => $it['item_id'],
|
||||
'item_num' => $it['item_num'],
|
||||
'time' => $it['time'],
|
||||
));
|
||||
}
|
||||
}
|
||||
$userInfo = $this->getUserInfo(array(
|
||||
'coin_num',
|
||||
'rmb_num'
|
||||
));
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg'=> '',
|
||||
'coin_nums' => $userInfo['coin_num'],
|
||||
'diamond_nums' => $userInfo['rmb_num'],
|
||||
'item_list' => $item_list,
|
||||
'all_item_list' => $all_item_list
|
||||
));
|
||||
}
|
||||
|
||||
public function fightRevive()
|
||||
{
|
||||
$userInfo = $this->getUserInfo(array(
|
||||
'rmb_num'
|
||||
));
|
||||
$cost = mt\Parameter::getVal('revive_money', 0);
|
||||
if ($cost > $userInfo['rmb_num']) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 3, '点券不足');
|
||||
return;
|
||||
}
|
||||
$this->updateUserInfo(array(
|
||||
'rmb_num' => function () {
|
||||
return "rmb_num - ${cost}";
|
||||
}
|
||||
));
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg'=> '',
|
||||
));
|
||||
}
|
||||
|
||||
public function addGameTimes()
|
||||
{
|
||||
$this->updateUserInfo(array(
|
||||
'game_times' => function () {
|
||||
return 'game_times + 1';
|
||||
},
|
||||
'modify_time' => $this->getNowTime()
|
||||
));
|
||||
$userInfo = $this->getUserInfo(array(
|
||||
'game_times'
|
||||
));
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg'=> '',
|
||||
'game_times' => $userInfo['game_times'],
|
||||
));
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user