解决赛季空档期每日任务的BUG

This commit is contained in:
hujiabin 2023-05-10 11:37:03 +08:00
parent 5f99a2d082
commit 0efd2bcfe1
5 changed files with 47 additions and 34 deletions

View File

@ -41,22 +41,22 @@ class MissionController extends BaseAuthedController {
{ {
parent::_handlePre(); parent::_handlePre();
DynData::preload(); DynData::preload();
$this->currRankSeasonMeta = mt\RankSeason::getCurrentSeason(); // $this->currRankSeasonMeta = mt\RankSeason::getCurrentSeason();
// if (!$this->currRankSeasonMeta) { // if (!$this->currRankSeasonMeta) {
// $this->_rspErr(10, 'server internal error'); // $this->_rspErr(10, 'server internal error');
// die(); // die();
// } // }
$this->propertyChgService = new services\PropertyChgService(); $this->propertyChgService = new services\PropertyChgService();
$this->userInfo = $this->_safeGetOrmUserInfo(); $this->userInfo = $this->_safeGetOrmUserInfo();
$this->seasonDb = Season::find($this->currRankSeasonMeta['id']); // $this->seasonDb = Season::find($this->currRankSeasonMeta['id']);
if (!$this->seasonDb) { // if (!$this->seasonDb) {
Season::add($this->currRankSeasonMeta['id']); // Season::add($this->currRankSeasonMeta['id']);
$this->seasonDb = Season::find($this->currRankSeasonMeta['id']); // $this->seasonDb = Season::find($this->currRankSeasonMeta['id']);
} // }
if (!$this->seasonDb) { // if (!$this->seasonDb) {
$this->_rspErr(10, 'server internal error'); // $this->_rspErr(10, 'server internal error');
die(); // die();
} // }
$this->awardService = new services\AwardService(); $this->awardService = new services\AwardService();
$this->missionService = new services\MissionService(); $this->missionService = new services\MissionService();
$this->missionService->init($this->userInfo, $this->seasonDb); $this->missionService->init($this->userInfo, $this->seasonDb);

View File

@ -24,10 +24,10 @@ class OtherController extends BaseAuthedController {
switch ($param){ switch ($param){
case self::MISSION : { case self::MISSION : {
$userInfo = $this->_safeGetOrmUserInfo(); $userInfo = $this->_safeGetOrmUserInfo();
$currRankSeasonMeta = mt\RankSeason::getCurrentSeason(); // $currRankSeasonMeta = mt\RankSeason::getCurrentSeason();
$seasonDb = Season::find($currRankSeasonMeta['id']); // $seasonDb = Season::find($currRankSeasonMeta['id']);
$missionService = new services\MissionService(); $missionService = new services\MissionService();
$missionService->init($userInfo, $seasonDb);; $missionService->init($userInfo, null);;
$missionMetaList = mt\Task::getCustomTypeMetaList(1, $missionService); $missionMetaList = mt\Task::getCustomTypeMetaList(1, $missionService);
$missionHash = Mission::allToHash(); $missionHash = Mission::allToHash();
foreach ($missionMetaList as $missionMeta) { foreach ($missionMetaList as $missionMeta) {

View File

@ -59,13 +59,16 @@ class BattleHistory extends BaseModel
public static function toDto($row){ public static function toDto($row){
if ($row['hero_id']){ 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']){ 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']){ 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; return $row;
} }

View File

@ -82,12 +82,19 @@ class HeroSkin extends BaseModel {
public static function toDto($meta) public static function toDto($meta)
{ {
$row = self::find($meta['id']); $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'], 'skin_id'=>$meta['id'],
'is_have' => $row?1:0, 'is_have' => $is_have,
'use_state' => $row['hero_id']?1:0, 'use_state' => $use_state,
); );
return $array;
} }
public static function addSkin($itemMeta) public static function addSkin($itemMeta)

View File

@ -57,14 +57,23 @@ class MissionService extends BaseService {
public function init($userInfo, $seasonDb) public function init($userInfo, $seasonDb)
{ {
$this->userInfo = $userInfo; $this->userInfo = $userInfo;
if ($seasonDb){
$this->seasonDb = $seasonDb; $this->seasonDb = $seasonDb;
$this->hisBattleData = Battle::getMyBattleData();
$seasonBattleData = json_decode($this->seasonDb['battle_data'], true); $seasonBattleData = json_decode($this->seasonDb['battle_data'], true);
if (!isset($seasonBattleData)) { if (!isset($seasonBattleData)) {
$seasonBattleData = array(); $seasonBattleData = array();
} }
$this->seasonBattleData = getXVal($seasonBattleData, 'season_data', array()); $this->seasonBattleData = getXVal($seasonBattleData, 'season_data', array());
$this->thisWeekBattleData = getXVal($seasonBattleData, 'this_week_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->hisBattleData = Battle::getMyBattleData();
$this->todayBattleData = getXVal($this->hisBattleData, 'today_data', array()); $this->todayBattleData = getXVal($this->hisBattleData, 'today_data', array());
if (myself()->_getDaySeconds(getXVal($this->todayBattleData, 'modifytime', 0)) < if (myself()->_getDaySeconds(getXVal($this->todayBattleData, 'modifytime', 0)) <
myself()->_getNowDaySeconds()) { myself()->_getNowDaySeconds()) {
@ -73,13 +82,7 @@ class MissionService extends BaseService {
'modifytime' => myself()->_getNowTime(), '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); // $this->offerRewartdMission = BigData::getData(BigData::OFFER_REWARD_MISSION_TYPE);
// if (!$this->offerRewartdMission) { // if (!$this->offerRewartdMission) {