This commit is contained in:
aozhiwei 2020-06-05 15:24:41 +08:00
parent 5c94b86b61
commit 9b481b8c86
2 changed files with 53 additions and 31 deletions

View File

@ -219,5 +219,11 @@ function getRecommendConfig($rec_table, $rec_id)
$rec_id = (int)$rec_id;
return array_key_exists($rec_id, $rec_table) ? $rec_table[$rec_id] : null;
}
function getRankRewardConfig($ran_table, $ran_id)
{
$ran_id = (int)$ran_id;
return array_key_exists($ran_id, $ran_table) ? $ran_table[$ran_id] : null;
}
checkMysqlConfig();
checkRedisConfig();

View File

@ -93,6 +93,20 @@ class GameOverController{
}
protected function getRankReward($rank)
{
$rank_meta_table = require('../res/rankReward@rankReward.php');
$rank_meta = getRankRewardConfig($rank_meta_table, $rank);
$d = array(
'rank' => $rank_meta['rank'],
'parameter' => $rank_meta['parameter'],
'drop' => $rank_meta['drop'],
'ad_drop' => $rank_meta['ad_drop'],
'ad_num' => $rank_meta['ad_num']
);
return $d;
}
public function firstRewardInfo()
{
$account_id = $_REQUEST['account_id'];
@ -109,34 +123,35 @@ class GameOverController{
die();
return;
}
$id = 12120;
$conn = $this->getMysql($account_id);
if (!$conn) {
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家');
die();
return;
}
$row = $conn->execQueryOne('SELECT id FROM equip WHERE accountid=:account_id;',
array(
':account_id' => $account_id
));
if ($row) {
$id = $row['id'];
}
$e = $this->getEquip($id);
if (!$e) {
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个道具');
die();
return;
}
$count = 3;
if ($e['upgrade_priority'] == 1) {
$count = 1;
}
$rank = $_REQUEST['rank'];
//$id = 12120;
// $conn = $this->getMysql($account_id);
// if (!$conn) {
// phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家');
// die();
// return;
// }
// $row = $conn->execQueryOne('SELECT id FROM equip WHERE accountid=:account_id;',
// array(
// ':account_id' => $account_id
// ));
// if ($row) {
// $id = $row['id'];
// }
// $e = $this->getEquip($id);
// if (!$e) {
// phpcommon\sendError(ERR_USER_BASE + 2, '没有这个道具');
// die();
// return;
// }
// $count = 3;
// if ($e['upgrade_priority'] == 1) {
// $count = 1;
// }
//道具物品
$first_list = array();
$first_list = $this->fixReward($first_list);
$first_list = $this->randomReward($first_list, $id, $count);
//$first_list = $this->fixReward($first_list);
$first_list = $this->randomReward($rank);
$first_db = array(
'first_uuid' => $first_uuid,
'first_list' => $first_list,
@ -232,13 +247,14 @@ class GameOverController{
return $item_list;
}
protected function randomReward($item_list, $id, $count)
protected function randomReward($rank)
{
//随机奖励
$e = $this->getEquip($id);
$b = $this->getDrop($e['drop_id']);
//$e = $this->getEquip($id);
$r = $this->getRankReward($rank);
$b = $this->getDrop($r['ad_drop']);
$count = $r['ad_num'];
$item_list = array();
//$b = $this->getbox(6);
//$count = 3;
$item_id_array = $this->getExplode($b['item_id']);