1
This commit is contained in:
parent
b90e48824f
commit
3575336fe4
@ -1,8 +1,11 @@
|
||||
<?php
|
||||
|
||||
require_once('mt/Parameter.php');
|
||||
require_once('mt/Rank.php');
|
||||
require_once('mt/Season.php');
|
||||
|
||||
require_once('services/PropertyChgService.php');
|
||||
require_once('services/SeasonService.php');
|
||||
|
||||
use phpcommon\SqlHelper;
|
||||
use models\User;
|
||||
@ -11,14 +14,57 @@ class SeasonController extends BaseAuthedController {
|
||||
|
||||
public function info()
|
||||
{
|
||||
$currSeasonMeta = mt\Season::getCurrentSeason();
|
||||
if (!$currSeasonMeta) {
|
||||
$this->_rspErr(10, '服务器内部错误');
|
||||
return;
|
||||
}
|
||||
$propertyChgService = new services\PropertyChgService();
|
||||
$userInfo = $this->_safeGetOrmUserInfo();
|
||||
$seasonService = new services\SeasonService();
|
||||
if (!$seasonService->checkSeason($userInfo)) {
|
||||
$userInfo = $this->_safeGetOrmUserInfo();
|
||||
$propertyChgService->addUserChg();
|
||||
}
|
||||
$rankMeta = mt\Rank::get($userInfo['rank']);
|
||||
$this->_rspData(array(
|
||||
array(
|
||||
'info' => array(
|
||||
'season_id' => $currSeasonMeta['id'],
|
||||
'rank' => $userInfo['rank'],
|
||||
'max_score' => $rankMeta ? $rankMeta['max_score'] : 0,
|
||||
'noshow_score_bar' => $rankMeta ? $rankMeta['noshow_score_bar'] : 1,
|
||||
'mission' => $this->getMissionInfo()
|
||||
)
|
||||
),
|
||||
'property_chg' => $propertyChgService->toDto()
|
||||
));
|
||||
}
|
||||
|
||||
public function getMissionReward()
|
||||
{
|
||||
$currSeasonMeta = mt\Season::getCurrentSeason();
|
||||
if (!$currSeasonMeta) {
|
||||
$this->_rspErr(10, '服务器内部错误');
|
||||
return;
|
||||
}
|
||||
$mission = $this->getMissionInfo();
|
||||
if ($mission['state'] != 1) {
|
||||
$this->_rspErr(1, '不可领取');
|
||||
return;
|
||||
}
|
||||
$this->_rspOk();
|
||||
}
|
||||
|
||||
private function precheck($userInfo)
|
||||
private function getMissionInfo()
|
||||
{
|
||||
$info = array(
|
||||
'state' => 0,
|
||||
'current' => 0,
|
||||
'target' => 0,
|
||||
'target_rank' => 0
|
||||
);
|
||||
return $info;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user