This commit is contained in:
aozhiwei 2019-08-23 17:03:47 +08:00
commit a3f0a7bed9
5 changed files with 55 additions and 35 deletions

View File

@ -71,6 +71,7 @@ CREATE TABLE `user` (
`recharge_times_total` int(11) NOT NULL DEFAULT '0' COMMENT '累计充值次数', `recharge_times_total` int(11) NOT NULL DEFAULT '0' COMMENT '累计充值次数',
`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 '赛季奖励状态',
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

@ -79,9 +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'] == 6) {
$item_list = $this->addEmoji($it['index'], $account_id); error_log($it['id']);
$item_list = $this->addEmoji($it['id'], $account_id, $it['dprice']);
} else if ($it['type'] == 4) { } else if ($it['type'] == 4) {
$item_list = $this->addSkin($it['index'], $item_num, $account_id); $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']);
@ -93,7 +94,6 @@ class AddReward {
break; break;
case 2: case 2:
//添加钻石 //添加钻石
error_log($item['itemid'], $item['itemnum']);
$this->addDiamond($item['itemid'], $item['itemnum'], $account_id); $this->addDiamond($item['itemid'], $item['itemnum'], $account_id);
break; break;
case 3: case 3:
@ -174,7 +174,7 @@ class AddReward {
} else { } else {
$item_id = 10003; $item_id = 10003;
$item_num = $dprice; $item_num = $dprice;
$this->addDirmond($item_num); $this->addDiamond($item_id, $item_num, $accountid);
} }
array_push($item_list, array( array_push($item_list, array(
@ -312,7 +312,7 @@ class AddReward {
} else { } else {
$item_id = 10003; $item_id = 10003;
$item_num = $dprice; $item_num = $dprice;
$this->addDirmond($item_num); $this->addDiamond($item_id, $item_num, $accountid);
} }
array_push($item_list, array( array_push($item_list, array(

View File

@ -103,11 +103,9 @@ class PassController{
} }
//当前段位及积分 //当前段位及积分
$rank = 0; $rank = 0;
$next_score = 0; $rank_score = 0;
$max_score = 0; $max_rank_score = 0;
$sum_score = 0; $row = $conn->execQueryOne('SELECT integral, pass_status, score FROM user WHERE accountid=:accountid;',
$score = 0;
$row = $conn->execQueryOne('SELECT integral, pass_status FROM user WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
)); ));
@ -121,17 +119,11 @@ class PassController{
if ($row['integral'] >= $seaPoint['min'] && $row['integral'] <= $seaPoint['max'] if ($row['integral'] >= $seaPoint['min'] && $row['integral'] <= $seaPoint['max']
|| $seaPoint['max'] == -1) { || $seaPoint['max'] == -1) {
$rank = $ii; $rank = $ii;
if ($ii == count($seaPoint_meta_table)) { $rank_score = $row['integral'] - $seaPoint['min'];
$next_score = $seaPoint['max']; $max_rank_score = $seaPoint['max'];
} else {
$next_score = $seaPoint['max'] + 1 - $seaPoint['min'];
}
$score = $row['integral'] - $seaPoint['min'];
} }
if ($ii == count($seaPoint_meta_table)) { if ($ii == count($seaPoint_meta_table)) {
$max_score = $seaPoint['min']; $max_rank_score = $seaPoint['min'];
} else {
$max_score = $seaPoint['max'];
} }
} }
if ($rank == 0) { if ($rank == 0) {
@ -139,6 +131,10 @@ class PassController{
return; return;
} }
//奖励信息 //奖励信息
$level = 0;
$sum_score = 0;
$pass_score = 0;
$max_pass_score = 0;
$item_list = array(); $item_list = array();
$seaReward_meta_table = require('../res/seasonReward@seasonReward.php'); $seaReward_meta_table = require('../res/seasonReward@seasonReward.php');
for ($j = 1; $j <= count($seaReward_meta_table); $j++) { for ($j = 1; $j <= count($seaReward_meta_table); $j++) {
@ -149,12 +145,21 @@ class PassController{
$drop_multiply = array(); $drop_multiply = array();
$status = 0; $status = 0;
$seaReward = $this->getSeasonReward($j + $number * 100); $seaReward = $this->getSeasonReward($j + $number * 100);
if ($row['score'] >= $seaReward['point']) {
$level = $seaReward['level'];
$pass_score = $row['score'] - $seaReward['point'];
$max_pass_score = $seaReward['point'];
}
if ($row['score'] < $seaReward_meta_table[1]['point']) {
$max_rank_score = $seaReward['point'];
}
$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(
':accountid' => $account_id, ':accountid' => $account_id,
':passid' => $seaReward['id'] ':passid' => $seaReward['id']
)); ));
for ($t = 1; $t <= 2; $t++) { for ($t = 1; $t <= 2; $t++) {
$delim = ":"; $delim = ":";
if ($t == 1) { if ($t == 1) {
@ -187,10 +192,12 @@ class PassController{
'open_time' => $open_time, 'open_time' => $open_time,
'end_time' => $end_time, 'end_time' => $end_time,
'rank' => $rank, 'rank' => $rank,
'sum_score' => $row['integral'], 'rank_score' => $rank_score,
'score' => $score, 'max_rank_score' => $max_rank_score,
'max_score' => $max_score, 'level' => $level,
'next_score' => $next_score, 'sum_score' => $sum_score,
'pass_score' => $pass_score,
'max_pass_score' => $max_pass_score,
'item_list' => $item_list 'item_list' => $item_list
)); ));
} }

View File

@ -135,6 +135,14 @@ 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;',
array(
':accountid' => $account_id,
));
if (!$rowUser) {
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
return;
}
$times = 0; $times = 0;
$info_list = array(); $info_list = array();
$diamond_meta_table = require('../res/diamondshop@diamondshop.php'); $diamond_meta_table = require('../res/diamondshop@diamondshop.php');
@ -171,10 +179,14 @@ class PayController{
if ($diamond['open_time'] != '-1') { if ($diamond['open_time'] != '-1') {
if ($diamond['open_time'] != '1') { if ($diamond['open_time'] != '1') {
$open_time = strtotime($diamond['open_time']); $open_time = strtotime($diamond['open_time']);
} else { }else {
$open_time = time(); $open_time = $rowUser['create_time'];
} }
$end_time = $open_time + $diamond['continue_time']; $end_time = $open_time + $diamond['continue_time'];
if (time() > $end_time) {
$open_time = '-1';
$end_time = '-1';
}
} }
array_push($info_list, array( array_push($info_list, array(
'shop_type' => $diamond['shop_type'], 'shop_type' => $diamond['shop_type'],

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) ' . $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) ' .
' 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) ' . ' 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) ' .
' 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;', ' 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;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
':user_name' => $user_name, ':user_name' => $user_name,
@ -132,8 +132,8 @@ class RoleController{
'kefu_status' => 0, 'kefu_status' => 0,
'box_num' => 0, 'box_num' => 0,
'diamond_num' => 0, 'diamond_num' => 0,
'sum_coin' => 0,
'pass_status' => 0, 'pass_status' => 0,
'season_status' => 1,
)); ));
} else { } else {
echo json_encode(array( echo json_encode(array(
@ -154,8 +154,8 @@ class RoleController{
'kefu_status' => $row['kefu_status'], 'kefu_status' => $row['kefu_status'],
'box_num' => $row['box_num'], 'box_num' => $row['box_num'],
'diamond_num' => $row['diamond_num'], 'diamond_num' => $row['diamond_num'],
'sum_coin' => $row['sum_coin'],
'pass_status' => $row['pass_status'], 'pass_status' => $row['pass_status'],
'season_status' => $row['season_status']
)); ));
} }
} }