From 67646a85de46d9090b7fdff981438ff8a8c21bc3 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 2 Dec 2021 19:49:14 +0800 Subject: [PATCH] 1 --- .../controller/SeasonCardController.class.php | 28 +++++++++++++---- webapp/controller/SeasonController.class.php | 30 +++++++++++-------- 2 files changed, 39 insertions(+), 19 deletions(-) diff --git a/webapp/controller/SeasonCardController.class.php b/webapp/controller/SeasonCardController.class.php index d246e38..36ccad7 100644 --- a/webapp/controller/SeasonCardController.class.php +++ b/webapp/controller/SeasonCardController.class.php @@ -5,15 +5,10 @@ require_once('models/Hero.php'); require_once('mt/Parameter.php'); require_once('mt/Drop.php'); -require_once('mt/EquipUpgrade.php'); require_once('mt/Season.php'); -require_once('mt/SeasonPoint.php'); -require_once('mt/RankReward.php'); -require_once('mt/Equip.php'); -require_once('mt/Hero.php'); -require_once('mt/Robot.php'); require_once('services/PropertyChgService.php'); +require_once('services/SeasonService.php'); use phpcommon\SqlHelper; use models\User; @@ -21,6 +16,27 @@ use models\Hero; class SeasonCardController extends BaseAuthedController { + private $propertyChgService = null; + private $userInfo = null; + private $seasonService = null; + + public function _handlePre() + { + parent::_handlePre(); + $currSeasonMeta = mt\Season::getCurrentSeason(); + if (!$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() { } diff --git a/webapp/controller/SeasonController.class.php b/webapp/controller/SeasonController.class.php index 5e41d88..f65c4a8 100644 --- a/webapp/controller/SeasonController.class.php +++ b/webapp/controller/SeasonController.class.php @@ -12,20 +12,29 @@ use models\User; class SeasonController extends BaseAuthedController { - public function info() + private $propertyChgService = null; + private $userInfo = null; + private $seasonService = null; + + public function _handlePre() { + parent::_handlePre(); $currSeasonMeta = mt\Season::getCurrentSeason(); if (!$currSeasonMeta) { $this->_rspErr(10, '服务器内部错误'); - return; + die(); } - $propertyChgService = new services\PropertyChgService(); - $userInfo = $this->_safeGetOrmUserInfo(); - $seasonService = new services\SeasonService(); - if (!$seasonService->checkSeason($userInfo)) { - $userInfo = $this->_safeGetOrmUserInfo(); - $propertyChgService->addUserChg(); + $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() + { $rankMeta = mt\Rank::get($userInfo['rank']); $this->_rspData(array( array( @@ -43,11 +52,6 @@ class SeasonController extends BaseAuthedController { public function getMissionReward() { - $currSeasonMeta = mt\Season::getCurrentSeason(); - if (!$currSeasonMeta) { - $this->_rspErr(10, '服务器内部错误'); - return; - } $mission = $this->getMissionInfo(); if ($mission['state'] != 1) { $this->_rspErr(1, '不可领取');