1
This commit is contained in:
parent
4ffa30cc40
commit
8092eb93a4
@ -80,14 +80,18 @@ class Role(object):
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'desc': 'getFightReward',
|
'desc': '获取战斗奖励getFightReward',
|
||||||
'group': 'Role',
|
'group': 'Role',
|
||||||
'url': 'webapp/index.php?c=Role&a=getFightReward',
|
'url': 'webapp/index.php?c=Role&a=getFightReward',
|
||||||
'params': [
|
'params': [
|
||||||
_common.ReqHead(),
|
_common.ReqHead(),
|
||||||
|
['coin_num', 0, '货币数量'],
|
||||||
|
['reward_id', 0, '奖励id'],
|
||||||
|
['reward_num', 0, '奖励数量'],
|
||||||
],
|
],
|
||||||
'response': [
|
'response': [
|
||||||
_common.RspHead(),
|
_common.RspHead(),
|
||||||
|
['coin_num', 0, '货币数量'],
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -356,22 +356,20 @@ class RoleController extends BaseAuthedController {
|
|||||||
|
|
||||||
public function getFightReward()
|
public function getFightReward()
|
||||||
{
|
{
|
||||||
$account_id = $_REQUEST['account_id'];
|
|
||||||
$coin_num = $_REQUEST['coin_num'];
|
$coin_num = $_REQUEST['coin_num'];
|
||||||
$reward_id = $_REQUEST['reward_id'];
|
$reward_id = $_REQUEST['reward_id'];
|
||||||
$reward_num = $_REQUEST['reward_num'];
|
$reward_num = $_REQUEST['reward_num'];
|
||||||
|
|
||||||
|
$times = mt\Parameter::getVal('gameover_reward_times', 1) - 1; //为啥-1?
|
||||||
$addreward = new classes\AddReward();
|
$addreward = new classes\AddReward();
|
||||||
$p = mt\Parameter::getOldParam(GAMEOVER_REWARD_TIMES);
|
$val = $addreward->getVipVal($this->getAccountId(), 1);
|
||||||
$times = $p['param_value'] - 1;
|
|
||||||
$addreward = new classes\AddReward();
|
|
||||||
$val = $addreward->getVipVal($account_id, 1);
|
|
||||||
$coin_num = floor($coin_num + $coin_num * $val / 100);
|
$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) {
|
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);
|
$coin_num = $addreward->getCoinNum($this->getAccountId());
|
||||||
echo json_encode(array(
|
$this->rspRawData(array(
|
||||||
'errcode' => 0,
|
'errcode' => 0,
|
||||||
'errmsg'=> '',
|
'errmsg'=> '',
|
||||||
'coin_nums' => $coin_num,
|
'coin_nums' => $coin_num,
|
||||||
|
@ -30,6 +30,13 @@ class Parameter {
|
|||||||
return $meta;
|
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)
|
public static function getListValue($meta)
|
||||||
{
|
{
|
||||||
$values = explode("|", $meta['param_value']);
|
$values = explode("|", $meta['param_value']);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user