diff --git a/webapp/controller/MissionController.class.php b/webapp/controller/MissionController.class.php index d8552a0b..d7e6beec 100644 --- a/webapp/controller/MissionController.class.php +++ b/webapp/controller/MissionController.class.php @@ -41,22 +41,22 @@ class MissionController extends BaseAuthedController { { parent::_handlePre(); DynData::preload(); - $this->currRankSeasonMeta = mt\RankSeason::getCurrentSeason(); +// $this->currRankSeasonMeta = mt\RankSeason::getCurrentSeason(); // if (!$this->currRankSeasonMeta) { // $this->_rspErr(10, 'server internal error'); // die(); // } $this->propertyChgService = new services\PropertyChgService(); $this->userInfo = $this->_safeGetOrmUserInfo(); - $this->seasonDb = Season::find($this->currRankSeasonMeta['id']); - if (!$this->seasonDb) { - Season::add($this->currRankSeasonMeta['id']); - $this->seasonDb = Season::find($this->currRankSeasonMeta['id']); - } - if (!$this->seasonDb) { - $this->_rspErr(10, 'server internal error'); - die(); - } +// $this->seasonDb = Season::find($this->currRankSeasonMeta['id']); +// if (!$this->seasonDb) { +// Season::add($this->currRankSeasonMeta['id']); +// $this->seasonDb = Season::find($this->currRankSeasonMeta['id']); +// } +// if (!$this->seasonDb) { +// $this->_rspErr(10, 'server internal error'); +// die(); +// } $this->awardService = new services\AwardService(); $this->missionService = new services\MissionService(); $this->missionService->init($this->userInfo, $this->seasonDb); diff --git a/webapp/controller/OtherController.class.php b/webapp/controller/OtherController.class.php index 32614cc3..1287cbe5 100644 --- a/webapp/controller/OtherController.class.php +++ b/webapp/controller/OtherController.class.php @@ -24,10 +24,10 @@ class OtherController extends BaseAuthedController { switch ($param){ case self::MISSION : { $userInfo = $this->_safeGetOrmUserInfo(); - $currRankSeasonMeta = mt\RankSeason::getCurrentSeason(); - $seasonDb = Season::find($currRankSeasonMeta['id']); +// $currRankSeasonMeta = mt\RankSeason::getCurrentSeason(); +// $seasonDb = Season::find($currRankSeasonMeta['id']); $missionService = new services\MissionService(); - $missionService->init($userInfo, $seasonDb);; + $missionService->init($userInfo, null);; $missionMetaList = mt\Task::getCustomTypeMetaList(1, $missionService); $missionHash = Mission::allToHash(); foreach ($missionMetaList as $missionMeta) { diff --git a/webapp/models/BattleHistory.php b/webapp/models/BattleHistory.php index c2adf42b..e97f690e 100644 --- a/webapp/models/BattleHistory.php +++ b/webapp/models/BattleHistory.php @@ -59,13 +59,16 @@ class BattleHistory extends BaseModel public static function toDto($row){ if ($row['hero_id']){ - $row['hero_id'] = Hero::findByAccountId($row['account_id'],$row['hero_id'])['hero_id']; + $heroDb = Hero::findByAccountId($row['account_id'],$row['hero_id']); + $row['hero_id'] =$heroDb ? $heroDb['hero_id'] : 0; } if ($row['weapon1']){ - $row['weapon1'] = Gun::findByAccountId($row['account_id'],$row['weapon1'])['gun_id']; + $weaponDb1 = Gun::findByAccountId($row['account_id'],$row['weapon1']); + $row['weapon1'] =$weaponDb1 ? $weaponDb1['gun_id'] : 0; } if ($row['weapon2']){ - $row['weapon2'] = Gun::findByAccountId($row['account_id'],$row['weapon2'])['gun_id']; + $weaponDb2 = Gun::findByAccountId($row['account_id'],$row['weapon2']); + $row['weapon2'] = $weaponDb2 ? $weaponDb2['gun_id'] : 0; } return $row; } diff --git a/webapp/models/HeroSkin.php b/webapp/models/HeroSkin.php index 03ccaa00..ad8e0be5 100644 --- a/webapp/models/HeroSkin.php +++ b/webapp/models/HeroSkin.php @@ -82,12 +82,19 @@ class HeroSkin extends BaseModel { public static function toDto($meta) { $row = self::find($meta['id']); - $array = array( + $is_have = 0; + $use_state = 0; + if ($row){ + $is_have = 1; + } + if ($row && $row['hero_id']){ + $use_state = 1; + } + return array( 'skin_id'=>$meta['id'], - 'is_have' => $row?1:0, - 'use_state' => $row['hero_id']?1:0, + 'is_have' => $is_have, + 'use_state' => $use_state, ); - return $array; } public static function addSkin($itemMeta) diff --git a/webapp/services/MissionService.php b/webapp/services/MissionService.php index db81005f..66466cb3 100644 --- a/webapp/services/MissionService.php +++ b/webapp/services/MissionService.php @@ -57,14 +57,23 @@ class MissionService extends BaseService { public function init($userInfo, $seasonDb) { $this->userInfo = $userInfo; - $this->seasonDb = $seasonDb; - $this->hisBattleData = Battle::getMyBattleData(); - $seasonBattleData = json_decode($this->seasonDb['battle_data'], true); - if (!isset($seasonBattleData)) { - $seasonBattleData = array(); + if ($seasonDb){ + $this->seasonDb = $seasonDb; + $seasonBattleData = json_decode($this->seasonDb['battle_data'], true); + if (!isset($seasonBattleData)) { + $seasonBattleData = array(); + } + $this->seasonBattleData = getXVal($seasonBattleData, 'season_data', array()); + $this->thisWeekBattleData = getXVal($seasonBattleData, 'this_week_data', array()); + if (myself()->_getDaySeconds(getXVal($this->thisWeekBattleData, 'modifytime', 0)) < + myself()->_getMondaySeconds()) { + $this->thisWeekBattleData = array( + 'createtime' => myself()->_getNowTime(), + 'modifytime' => myself()->_getNowTime(), + ); + } } - $this->seasonBattleData = getXVal($seasonBattleData, 'season_data', array()); - $this->thisWeekBattleData = getXVal($seasonBattleData, 'this_week_data', array()); + $this->hisBattleData = Battle::getMyBattleData(); $this->todayBattleData = getXVal($this->hisBattleData, 'today_data', array()); if (myself()->_getDaySeconds(getXVal($this->todayBattleData, 'modifytime', 0)) < myself()->_getNowDaySeconds()) { @@ -73,13 +82,7 @@ class MissionService extends BaseService { 'modifytime' => myself()->_getNowTime(), ); } - if (myself()->_getDaySeconds(getXVal($this->thisWeekBattleData, 'modifytime', 0)) < - myself()->_getMondaySeconds()) { - $this->thisWeekBattleData = array( - 'createtime' => myself()->_getNowTime(), - 'modifytime' => myself()->_getNowTime(), - ); - } + // $this->offerRewartdMission = BigData::getData(BigData::OFFER_REWARD_MISSION_TYPE); // if (!$this->offerRewartdMission) {