1
This commit is contained in:
parent
ac9b9f1411
commit
a9e5b6344f
@ -124,6 +124,65 @@ class SeasonCardController extends BaseAuthedController {
|
||||
));
|
||||
}
|
||||
|
||||
public function getAllReward()
|
||||
{
|
||||
$seasonCardMeta = mt\SeasonCard::get(1);
|
||||
$info = array(
|
||||
'season_id' => $this->currSeasonMeta['id'],
|
||||
'season_begin_time' => strtotime($this->currSeasonMeta['begin_time']),
|
||||
'season_end_time' => strtotime($this->currSeasonMeta['end_time']),
|
||||
'card_lv' => $this->seasonDb ? $this->seasonDb['card_lv'] : 1,
|
||||
'card_exp' => $this->seasonDb ? $this->seasonDb['card_exp'] : 0,
|
||||
'card_max_exp' => $this->seasonDb ? $this->seasonDb['card_exp'] : 1,
|
||||
'gift_packages' => $this->getGiftPackages(),
|
||||
'buy_level_price' => $seasonCardMeta ? $seasonCardMeta['cost'] : 0,
|
||||
'received_level_rewards1' => $this->getReceivedLevelRewards(SeasonCard::NORMAL_PACKAGE_ID),
|
||||
'received_level_rewards2' => $this->getReceivedLevelRewards(SeasonCard::VIP_PACKAGE_ID),
|
||||
);
|
||||
$vipPackageBuyed = false;
|
||||
foreach ($info['gift_packages'] as $package) {
|
||||
if ($package['package_id'] == SeasonCard::VIP_PACKAGE_ITEM_ID) {
|
||||
if ($package['state'] == 1) {
|
||||
$vipPackageBuyed = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
for ($i = 1; $i < $info['card_lv']; ++$i) {
|
||||
$level = $i;
|
||||
$type = SeasonCard::NORMAL_PACKAGE_ID;
|
||||
{
|
||||
$received1 = array_find($info['received_level_rewards1'], function ($val) use($i) {
|
||||
return $val == $i;
|
||||
});
|
||||
if (!$received1) {
|
||||
$this->_scatterDrop('season:level_reward:' . $type . ':' . $level,
|
||||
$dropMeta,
|
||||
$this->awardService,
|
||||
$this->propertyChgService);
|
||||
SeasonCard::add($this->currSeasonMeta['id'], $type, $level);
|
||||
}
|
||||
}
|
||||
$type = SeasonCard::VIP_PACKAGE_ID;
|
||||
if ($vipPackageBuyed) {
|
||||
$received2 = array_find($info['received_level_rewards2'], function ($val) use($i) {
|
||||
return $val == $i;
|
||||
});
|
||||
if (!$received2) {
|
||||
$this->_scatterDrop('season:level_reward:' . $type . ':' . $level,
|
||||
$dropMeta,
|
||||
$this->awardService,
|
||||
$this->propertyChgService);
|
||||
SeasonCard::add($this->currSeasonMeta['id'], $type, $level);
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->_rspData(array(
|
||||
'award' => $this->awardService->toDto(),
|
||||
'property_chg' => $this->propertyChgService->toDto(),
|
||||
));
|
||||
}
|
||||
|
||||
public function buyLevel()
|
||||
{
|
||||
$addLevel = (int)getReqVal('add_level', 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user