From ca64317a20b29a0afe1b32a008f60d1f7fbb1ddd Mon Sep 17 00:00:00 2001 From: wangwei01 Date: Fri, 23 Aug 2019 17:01:35 +0800 Subject: [PATCH] 1 --- sql/gamedb.sql | 1 + webapp/classes/AddReward.php | 10 ++-- webapp/controller/PassController.class.php | 53 ++++++++++++---------- webapp/controller/PayController.class.php | 16 ++++++- webapp/controller/RoleController.class.php | 10 ++-- 5 files changed, 55 insertions(+), 35 deletions(-) diff --git a/sql/gamedb.sql b/sql/gamedb.sql index 373f60b..c27cf6f 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -70,6 +70,7 @@ CREATE TABLE `user` ( `sum_coin` double NOT NULL DEFAULT '0' COMMENT '累计充值金额', `pass_status` 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`), UNIQUE KEY `accountid` (`accountid`) ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; diff --git a/webapp/classes/AddReward.php b/webapp/classes/AddReward.php index e2a8bcc..12ae14b 100644 --- a/webapp/classes/AddReward.php +++ b/webapp/classes/AddReward.php @@ -79,9 +79,10 @@ class AddReward { if ($it['type'] == 5) { $item_list = $this->addGift($it['index'], $account_id); } 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) { - $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) { $i = $this->getItem($item['itemid']); @@ -93,7 +94,6 @@ class AddReward { break; case 2: //添加钻石 - error_log($item['itemid'], $item['itemnum']); $this->addDiamond($item['itemid'], $item['itemnum'], $account_id); break; case 3: @@ -174,7 +174,7 @@ class AddReward { } else { $item_id = 10003; $item_num = $dprice; - $this->addDirmond($item_num); + $this->addDiamond($item_id, $item_num, $accountid); } array_push($item_list, array( @@ -312,7 +312,7 @@ class AddReward { } else { $item_id = 10003; $item_num = $dprice; - $this->addDirmond($item_num); + $this->addDiamond($item_id, $item_num, $accountid); } array_push($item_list, array( diff --git a/webapp/controller/PassController.class.php b/webapp/controller/PassController.class.php index c860eca..d136a50 100644 --- a/webapp/controller/PassController.class.php +++ b/webapp/controller/PassController.class.php @@ -103,11 +103,9 @@ class PassController{ } //当前段位及积分 $rank = 0; - $next_score = 0; - $max_score = 0; - $sum_score = 0; - $score = 0; - $row = $conn->execQueryOne('SELECT integral, pass_status FROM user WHERE accountid=:accountid;', + $rank_score = 0; + $max_rank_score = 0; + $row = $conn->execQueryOne('SELECT integral, pass_status, score FROM user WHERE accountid=:accountid;', array( ':accountid' => $account_id, )); @@ -121,17 +119,11 @@ class PassController{ if ($row['integral'] >= $seaPoint['min'] && $row['integral'] <= $seaPoint['max'] || $seaPoint['max'] == -1) { $rank = $ii; - if ($ii == count($seaPoint_meta_table)) { - $next_score = $seaPoint['max']; - } else { - $next_score = $seaPoint['max'] + 1 - $seaPoint['min']; - } - $score = $row['integral'] - $seaPoint['min']; + $rank_score = $row['integral'] - $seaPoint['min']; + $max_rank_score = $seaPoint['max']; } if ($ii == count($seaPoint_meta_table)) { - $max_score = $seaPoint['min']; - } else { - $max_score = $seaPoint['max']; + $max_rank_score = $seaPoint['min']; } } if ($rank == 0) { @@ -139,6 +131,10 @@ class PassController{ return; } //奖励信息 + $level = 0; + $sum_score = 0; + $pass_score = 0; + $max_pass_score = 0; $item_list = array(); $seaReward_meta_table = require('../res/seasonReward@seasonReward.php'); for ($j = 1; $j <= count($seaReward_meta_table); $j++) { @@ -149,12 +145,21 @@ class PassController{ $drop_multiply = array(); $status = 0; $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 ' . - ' FROM passinfo WHERE accountid=:accountid AND passid=:passid;', - array( - ':accountid' => $account_id, - ':passid' => $seaReward['id'] - )); + ' FROM passinfo WHERE accountid=:accountid AND passid=:passid;', + array( + ':accountid' => $account_id, + ':passid' => $seaReward['id'] + )); for ($t = 1; $t <= 2; $t++) { $delim = ":"; if ($t == 1) { @@ -187,10 +192,12 @@ class PassController{ 'open_time' => $open_time, 'end_time' => $end_time, 'rank' => $rank, - 'sum_score' => $row['integral'], - 'score' => $score, - 'max_score' => $max_score, - 'next_score' => $next_score, + 'rank_score' => $rank_score, + 'max_rank_score' => $max_rank_score, + 'level' => $level, + 'sum_score' => $sum_score, + 'pass_score' => $pass_score, + 'max_pass_score' => $max_pass_score, 'item_list' => $item_list )); } diff --git a/webapp/controller/PayController.class.php b/webapp/controller/PayController.class.php index e75538d..37dd69a 100644 --- a/webapp/controller/PayController.class.php +++ b/webapp/controller/PayController.class.php @@ -135,6 +135,14 @@ class PayController{ phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); 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; $info_list = array(); $diamond_meta_table = require('../res/diamondshop@diamondshop.php'); @@ -171,10 +179,14 @@ class PayController{ if ($diamond['open_time'] != '-1') { if ($diamond['open_time'] != '1') { $open_time = strtotime($diamond['open_time']); - } else { - $open_time = time(); + }else { + $open_time = $rowUser['create_time']; } $end_time = $open_time + $diamond['continue_time']; + if (time() > $end_time) { + $open_time = '-1'; + $end_time = '-1'; + } } array_push($info_list, array( 'shop_type' => $diamond['shop_type'], diff --git a/webapp/controller/RoleController.class.php b/webapp/controller/RoleController.class.php index e718249..ef4a0b1 100644 --- a/webapp/controller/RoleController.class.php +++ b/webapp/controller/RoleController.class.php @@ -100,9 +100,9 @@ class RoleController{ ':accountid' => $account_id )); 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) ' . - ' 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) ' . - ' 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;', + $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, 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;', array( ':accountid' => $account_id, ':user_name' => $user_name, @@ -132,8 +132,8 @@ class RoleController{ 'kefu_status' => 0, 'box_num' => 0, 'diamond_num' => 0, - 'sum_coin' => 0, 'pass_status' => 0, + 'season_status' => 1, )); } else { echo json_encode(array( @@ -154,8 +154,8 @@ class RoleController{ 'kefu_status' => $row['kefu_status'], 'box_num' => $row['box_num'], 'diamond_num' => $row['diamond_num'], - 'sum_coin' => $row['sum_coin'], 'pass_status' => $row['pass_status'], + 'season_status' => $row['season_status'] )); } }