This commit is contained in:
aozhiwei 2021-11-23 13:28:29 +08:00
parent 4ffa30cc40
commit 8092eb93a4
3 changed files with 19 additions and 10 deletions

View File

@ -80,14 +80,18 @@ class Role(object):
]
},
{
'desc': 'getFightReward',
'desc': '获取战斗奖励getFightReward',
'group': 'Role',
'url': 'webapp/index.php?c=Role&a=getFightReward',
'params': [
_common.ReqHead(),
['coin_num', 0, '货币数量'],
['reward_id', 0, '奖励id'],
['reward_num', 0, '奖励数量'],
],
'response': [
_common.RspHead(),
['coin_num', 0, '货币数量'],
]
},
{

View File

@ -356,22 +356,20 @@ class RoleController extends BaseAuthedController {
public function getFightReward()
{
$account_id = $_REQUEST['account_id'];
$coin_num = $_REQUEST['coin_num'];
$reward_id = $_REQUEST['reward_id'];
$reward_num = $_REQUEST['reward_num'];
$times = mt\Parameter::getVal('gameover_reward_times', 1) - 1; //为啥-1?
$addreward = new classes\AddReward();
$p = mt\Parameter::getOldParam(GAMEOVER_REWARD_TIMES);
$times = $p['param_value'] - 1;
$addreward = new classes\AddReward();
$val = $addreward->getVipVal($account_id, 1);
$val = $addreward->getVipVal($this->getAccountId(), 1);
$coin_num = floor($coin_num + $coin_num * $val / 100);
$addreward->addReward(10001, $coin_num * $times, $account_id, 0, 0);
$addreward->addReward(V_ITEM_GOLD, $coin_num * $times, $this->getAccountId(), 0, 0);
if ($reward_id != 0) {
$addreward->addReward($reward_id, $reward_num * $times, $account_id, 0, 0);
$addreward->addReward($reward_id, $reward_num * $times, $this->getAccountId(), 0, 0);
}
$coin_num = $addreward->getCoinNum($account_id);
echo json_encode(array(
$coin_num = $addreward->getCoinNum($this->getAccountId());
$this->rspRawData(array(
'errcode' => 0,
'errmsg'=> '',
'coin_nums' => $coin_num,

View File

@ -30,6 +30,13 @@ class Parameter {
return $meta;
}
public static function getVal($name, $defVal)
{
self::mustBeNameHash();
$meta = array_key_exists($id, self::$nameHash) ? self::$nameHash[$name] : null;
return $meta ? $meta['param_value'] : $defVal;
}
public static function getListValue($meta)
{
$values = explode("|", $meta['param_value']);