1
This commit is contained in:
parent
cbe3a18f7c
commit
62232d51f8
@ -47,6 +47,9 @@ function getResBaseDir()
|
||||
|
||||
function getXVal($arr, $name, $defVal = null)
|
||||
{
|
||||
if (is_null($arr)) {
|
||||
error_log('callstack:' . json_encode(debug_backtrace(), JSON_PRETTY_PRINT));
|
||||
}
|
||||
$val = array_key_exists($name, $arr) ? $arr[$name] : $defVal;
|
||||
return $val;
|
||||
}
|
||||
|
@ -5,11 +5,13 @@ namespace services;
|
||||
require_once('mt/Task.php');
|
||||
|
||||
require_once('models/Mission.php');
|
||||
require_once('models/Battle.php');
|
||||
|
||||
use phpcommon\SqlHelper;
|
||||
use mt;
|
||||
use models\User;
|
||||
use models\Mission;
|
||||
use models\Battle;
|
||||
|
||||
class MissionService extends BaseService {
|
||||
|
||||
@ -24,6 +26,28 @@ class MissionService extends BaseService {
|
||||
{
|
||||
$this->userInfo = $userInfo;
|
||||
$this->seasonDb = $seasonDb;
|
||||
$this->hisBattleData = Battle::getMyBattleData();
|
||||
$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());
|
||||
$this->todayBattleData = getXVal($seasonBattleData, 'today_data', array());
|
||||
if (myself()->_getDaySeconds(getXVal($this->todayBattleData, 'modifytime', 0)) <
|
||||
myself()->_getNowDaySeconds()) {
|
||||
$this->todayBattleData = array(
|
||||
'createtime' => myself()->_getNowTime(),
|
||||
'modifytime' => myself()->_getNowTime(),
|
||||
);
|
||||
}
|
||||
if (myself()->_getDaySeconds(getXVal($this->thisWeekBattleData, 'modifytime', 0)) <
|
||||
myself()->_getMondaySeconds()) {
|
||||
$this->thisWeekBattleData = array(
|
||||
'createtime' => myself()->_getNowTime(),
|
||||
'modifytime' => myself()->_getNowTime(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public function getMissionDto($userInfo, $seasonDb, $missionDb, $missionMeta)
|
||||
@ -375,7 +399,7 @@ class MissionService extends BaseService {
|
||||
{
|
||||
$battleData = null;
|
||||
if ($missionMeta['type'] == mt\Task::DAILY_MISSON_TYPE) {
|
||||
$battleData = $this->dailyBattleData;
|
||||
$battleData = $this->todayBattleData;
|
||||
} else {
|
||||
if ($missionMeta['season_task'] == mt\Task::SEASON_MISSON_FLAG) {
|
||||
if ($missionMeta['type'] == mt\Task::SEASONCARD_MISSON_TYPE &&
|
||||
|
Loading…
x
Reference in New Issue
Block a user