1
This commit is contained in:
parent
a3f0a7bed9
commit
8411f898f9
@ -72,6 +72,7 @@ CREATE TABLE `user` (
|
|||||||
`pass_status` int(11) NOT NULL DEFAULT '0' COMMENT '通行证购买状态',
|
`pass_status` int(11) NOT NULL DEFAULT '0' COMMENT '通行证购买状态',
|
||||||
`score` int(11) NOT NULL DEFAULT '0' COMMENT '通行证积分',
|
`score` int(11) NOT NULL DEFAULT '0' COMMENT '通行证积分',
|
||||||
`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 '首充礼包领取状态',
|
||||||
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;
|
||||||
|
@ -52,6 +52,7 @@ class PassController{
|
|||||||
'point' => $seaReward_meta['point'],
|
'point' => $seaReward_meta['point'],
|
||||||
'active' => $seaReward_meta['reward1'],
|
'active' => $seaReward_meta['reward1'],
|
||||||
'honor' => $seaReward_meta['reward2'],
|
'honor' => $seaReward_meta['reward2'],
|
||||||
|
'level' => $seaReward_meta['level']
|
||||||
);
|
);
|
||||||
return $seaReward;
|
return $seaReward;
|
||||||
}
|
}
|
||||||
@ -144,16 +145,19 @@ class PassController{
|
|||||||
}
|
}
|
||||||
$drop_multiply = array();
|
$drop_multiply = array();
|
||||||
$status = 0;
|
$status = 0;
|
||||||
$seaReward = $this->getSeasonReward($j + $number * 100);
|
$seaReward = $this->getSeasonReward($id - 1);
|
||||||
if ($row['score'] >= $seaReward['point']) {
|
if ($row['score'] >= $seaReward['point'] && $seaReward['point'] != -1) {
|
||||||
$level = $seaReward['level'];
|
$level = $seaReward['level'];
|
||||||
$pass_score = $row['score'] - $seaReward['point'];
|
$pass_score = $row['score'] - $seaReward['point'];
|
||||||
$max_pass_score = $seaReward['point'];
|
$max_pass_score = $seaReward['point'];
|
||||||
}
|
}
|
||||||
if ($row['score'] < $seaReward_meta_table[1]['point']) {
|
//如果是最大等级,则返回上一级的最大值
|
||||||
$max_rank_score = $seaReward['point'];
|
if ($seaReward['point'] == -1) {
|
||||||
}
|
$seaReward = $this->getSeasonReward($id - 2);
|
||||||
$sum_score = $seaReward['point'];
|
$sum_score = $seaReward['point'];
|
||||||
|
} else {
|
||||||
|
$sum_score = $seaReward['point'];
|
||||||
|
}
|
||||||
$rowPass = $conn->execQueryOne('SELECT active_status, honor_status ' .
|
$rowPass = $conn->execQueryOne('SELECT active_status, honor_status ' .
|
||||||
' FROM passinfo WHERE accountid=:accountid AND passid=:passid;',
|
' FROM passinfo WHERE accountid=:accountid AND passid=:passid;',
|
||||||
array(
|
array(
|
||||||
|
@ -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) ' .
|
$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) ' .
|
||||||
' 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) ' .
|
' 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) ' .
|
||||||
' 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;',
|
' 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;',
|
||||||
array(
|
array(
|
||||||
':accountid' => $account_id,
|
':accountid' => $account_id,
|
||||||
':user_name' => $user_name,
|
':user_name' => $user_name,
|
||||||
@ -134,6 +134,7 @@ class RoleController{
|
|||||||
'diamond_num' => 0,
|
'diamond_num' => 0,
|
||||||
'pass_status' => 0,
|
'pass_status' => 0,
|
||||||
'season_status' => 1,
|
'season_status' => 1,
|
||||||
|
'first_gift' => 0,
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
echo json_encode(array(
|
echo json_encode(array(
|
||||||
@ -155,7 +156,8 @@ class RoleController{
|
|||||||
'box_num' => $row['box_num'],
|
'box_num' => $row['box_num'],
|
||||||
'diamond_num' => $row['diamond_num'],
|
'diamond_num' => $row['diamond_num'],
|
||||||
'pass_status' => $row['pass_status'],
|
'pass_status' => $row['pass_status'],
|
||||||
'season_status' => $row['season_status']
|
'season_status' => $row['season_status'],
|
||||||
|
'first_gift' => $row['first_gift'],
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,22 +82,14 @@ class ShareController{
|
|||||||
return $p;
|
return $p;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function subCoin($coin_num, $account_id)
|
protected function subCoin($num, $account_id, $diamond_num)
|
||||||
{
|
{
|
||||||
$conn = $this->getMysql($account_id);
|
$conn = $this->getMysql($account_id);
|
||||||
if (!$conn) {
|
if (!$conn) {
|
||||||
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$row = $conn->execQueryOne('SELECT diamond_num FROM user WHERE accountid=:accountid;',
|
|
||||||
array(
|
|
||||||
':accountid' => $account_id
|
|
||||||
));
|
|
||||||
if (!$row) {
|
|
||||||
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家');
|
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家');
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
if ($row['diamond_num'] < $diamond_num) {
|
if ($diamond_num < $num) {
|
||||||
phpcommon\sendError(ERR_USER_BASE + 3, '钻石不足');
|
phpcommon\sendError(ERR_USER_BASE + 3, '钻石不足');
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
@ -105,7 +97,7 @@ class ShareController{
|
|||||||
' WHERE accountid=:accountid;',
|
' WHERE accountid=:accountid;',
|
||||||
array(
|
array(
|
||||||
':accountid' => $account_id,
|
':accountid' => $account_id,
|
||||||
':diamond_num' => $row['diamond_num'] - $diamond_num,
|
':diamond_num' => $diamond_num - $num,
|
||||||
':modify_time' => time()
|
':modify_time' => time()
|
||||||
));
|
));
|
||||||
if (!$ret) {
|
if (!$ret) {
|
||||||
@ -129,6 +121,7 @@ class ShareController{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$free = $_REQUEST['free'];
|
$free = $_REQUEST['free'];
|
||||||
|
$drop_id = 0;
|
||||||
if ($free != 0) {
|
if ($free != 0) {
|
||||||
$drop_id = 24002;
|
$drop_id = 24002;
|
||||||
$p = $this->getParameter(DIAMONDBOX10);
|
$p = $this->getParameter(DIAMONDBOX10);
|
||||||
@ -136,11 +129,19 @@ class ShareController{
|
|||||||
$drop_id = 24001;
|
$drop_id = 24001;
|
||||||
$p = $this->getParameter(DIAMONDBOX);
|
$p = $this->getParameter(DIAMONDBOX);
|
||||||
}
|
}
|
||||||
|
$row = $conn->execQueryOne('SELECT diamond_num FROM user WHERE accountid=:accountid;',
|
||||||
|
array(
|
||||||
|
':accountid' => $account_id
|
||||||
|
));
|
||||||
|
if (!$row) {
|
||||||
|
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家');
|
||||||
|
die();
|
||||||
|
}
|
||||||
//扣除钻石
|
//扣除钻石
|
||||||
$diamond_num = $p['param_value'];
|
$diamond_num = $p['param_value'];
|
||||||
$this->subCoin($diamond_num, $account_id);
|
$this->subCoin($diamond_num, $account_id, $row['diamond_num']);
|
||||||
|
$num = $row['diamond_num'] - $diamond_num;
|
||||||
//随机奖励
|
//随机奖励
|
||||||
$drop_id = 0;
|
|
||||||
$d = $this->getDrop($drop_id);
|
$d = $this->getDrop($drop_id);
|
||||||
if (!$d) {
|
if (!$d) {
|
||||||
phpcommon\sendError(ERR_USER_BASE + 3, '没有这个奖励');
|
phpcommon\sendError(ERR_USER_BASE + 3, '没有这个奖励');
|
||||||
@ -154,8 +155,7 @@ class ShareController{
|
|||||||
for ($i = 0; $i < count($weight_array); $i++) {
|
for ($i = 0; $i < count($weight_array); $i++) {
|
||||||
$weight_sum += $weight_array[$i][0];
|
$weight_sum += $weight_array[$i][0];
|
||||||
}
|
}
|
||||||
$keys = $row['keys_num'] - 1;
|
srand(crc32($account_id . $num));
|
||||||
srand(crc32($account_id . $keys));
|
|
||||||
$random = Rand(0, $weight_sum);
|
$random = Rand(0, $weight_sum);
|
||||||
$weight = 0;
|
$weight = 0;
|
||||||
for ($i = 0; $i < count($weight_array); $i++) {
|
for ($i = 0; $i < count($weight_array); $i++) {
|
||||||
@ -205,7 +205,7 @@ class ShareController{
|
|||||||
'errcode' => 0,
|
'errcode' => 0,
|
||||||
'errmsg' => '',
|
'errmsg' => '',
|
||||||
'item_list' => $item_list,
|
'item_list' => $item_list,
|
||||||
'keys_num' => $row['keys_num'] - 1
|
'diamond_num' => $num,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user