102 lines
2.6 KiB
PHP
102 lines
2.6 KiB
PHP
<?php
|
|
|
|
require_once('models/User.php');
|
|
require_once('models/Hero.php');
|
|
|
|
require_once('mt/Parameter.php');
|
|
require_once('mt/Drop.php');
|
|
require_once('mt/Season.php');
|
|
|
|
require_once('services/PropertyChgService.php');
|
|
require_once('services/SeasonService.php');
|
|
|
|
use phpcommon\SqlHelper;
|
|
use models\User;
|
|
use models\Hero;
|
|
|
|
class SeasonCardController extends BaseAuthedController {
|
|
|
|
private $propertyChgService = null;
|
|
private $userInfo = null;
|
|
private $seasonService = null;
|
|
private $currSeasonMeta = null;
|
|
private $seasonDb = null;
|
|
private $seasonCardDb = null;
|
|
|
|
public function _handlePre()
|
|
{
|
|
parent::_handlePre();
|
|
$this->currSeasonMeta = mt\Season::getCurrentSeason();
|
|
if (!$this->currSeasonMeta) {
|
|
$this->_rspErr(10, '服务器内部错误');
|
|
die();
|
|
}
|
|
$this->propertyChgService = new services\PropertyChgService();
|
|
$this->userInfo = $this->_safeGetOrmUserInfo();
|
|
$this->seasonService = new services\SeasonService();
|
|
if (!$this->seasonService->checkSeason($this->userInfo)) {
|
|
$this->userInfo = $this->_safeGetOrmUserInfo();
|
|
$this->propertyChgService->addUserChg();
|
|
}
|
|
}
|
|
|
|
public function info()
|
|
{
|
|
$this->_rspData(array(
|
|
array(
|
|
'info' => array(
|
|
'season_id' => $this->currSeasonMeta['id'],
|
|
'card_lv' => $this->seasonDb ? $this->seasonDb['card_lv'] : 1,
|
|
'card_exp' => $this->seasonDb ? $this->seasonDb['card_exp'] : 0,
|
|
'gift_packages' => $this->getGiftPackages(),
|
|
'unlock_rewards' => $this->getUnlockRewards()
|
|
)
|
|
)
|
|
));
|
|
}
|
|
|
|
public function getReward()
|
|
{
|
|
}
|
|
|
|
public function buyLevel()
|
|
{
|
|
}
|
|
|
|
public function buyGiftPackage()
|
|
{
|
|
$packageId = getReqVal('package_id', 0);
|
|
$giftPackage = array_find($this->getGiftPackages(), function ($val) use($packageId) {
|
|
if ($val['package_id'] == $packageId) {
|
|
return true;
|
|
}
|
|
return false;
|
|
});
|
|
if (!$giftPackage) {
|
|
$this->_rspErr(1, 'pacakge_id参数错误');
|
|
return;
|
|
}
|
|
if ($giftPackage['state'] == 1) {
|
|
$this->_rspErr(2, '不能重复购买');
|
|
return;
|
|
}
|
|
}
|
|
|
|
private function getGiftPackages()
|
|
{
|
|
$giftPackages = array(
|
|
|
|
);
|
|
return $giftPackages;
|
|
}
|
|
|
|
private function getUnlockRewards()
|
|
{
|
|
$rewards = array(
|
|
|
|
);
|
|
return $rewards;
|
|
}
|
|
|
|
}
|