From 10f0c55f336db6fa6a1e849d85cebae724dd14c5 Mon Sep 17 00:00:00 2001 From: hujiabin Date: Thu, 16 Mar 2023 19:30:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=AF=8F=E6=97=A5=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/BaseAuthedController.class.php | 5 +- webapp/controller/BattleController.class.php | 6 +- webapp/controller/MissionController.class.php | 22 +++--- webapp/services/BattleDataService.php | 8 +- webapp/services/MissionService.php | 76 ++++++++++--------- 5 files changed, 67 insertions(+), 50 deletions(-) diff --git a/webapp/controller/BaseAuthedController.class.php b/webapp/controller/BaseAuthedController.class.php index 71fc2aeb..3fad6430 100644 --- a/webapp/controller/BaseAuthedController.class.php +++ b/webapp/controller/BaseAuthedController.class.php @@ -274,7 +274,7 @@ class BaseAuthedController extends BaseController { break; case V_ITEM_ACTIVE: { - return; + $addItem = max(0, mt\Parameter::getVal('activeness_limit', 0) - $this->_getDailyV(TN_DAILY_ACTIVE, 0)); $addItem = min($addItem, $itemNum); if ($addItem > 0) { @@ -302,6 +302,9 @@ class BaseAuthedController extends BaseController { $this->_updateUserInfo(array( 'gold' => function () use($itemNum) { return "GREATEST(0, gold - ${itemNum})"; + }, + 'consume_gold' => function () use ($itemNum){ + return "consume_gold + ${itemNum}"; } )); } diff --git a/webapp/controller/BattleController.class.php b/webapp/controller/BattleController.class.php index f7afa4ae..9b2a0b69 100644 --- a/webapp/controller/BattleController.class.php +++ b/webapp/controller/BattleController.class.php @@ -111,6 +111,10 @@ class BattleController extends BaseAuthedController { } $this->_rspData($data); } + public function test(){ + $a = myself()->_getDailyV(TN_DAILY_ACTIVE, 0); + print_r($a); + } /* http post @@ -220,7 +224,7 @@ class BattleController extends BaseAuthedController { } } } - array_push($data['members'], $info); + array_push($data['members'], $info);error_log("PresetInfo---".json_encode($data)); myself()->_rspData($data); } diff --git a/webapp/controller/MissionController.class.php b/webapp/controller/MissionController.class.php index 72aaf56c..3b319fbf 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); @@ -103,6 +103,8 @@ class MissionController extends BaseAuthedController { $this->_rspData(array( 'current_active_value' => min($this->_getV(TN_ACTIVE, 0), mt\Parameter::getVal('max_activity', 0)), 'max_active_value' => mt\Parameter::getVal('max_activity', 0), + 'day_active_limit' => mt\Parameter::getVal('activeness_limit', 0), + 'week_active_limit' => mt\Parameter::getVal('max_weekly', 0), 'mission_list1' => $missionDtoList1, 'mission_list2' => $missionDtoList2 )); diff --git a/webapp/services/BattleDataService.php b/webapp/services/BattleDataService.php index e6092693..7d61743e 100644 --- a/webapp/services/BattleDataService.php +++ b/webapp/services/BattleDataService.php @@ -236,10 +236,14 @@ class BattleDataService extends BaseService { //单人模式最高排名 $this->minValue($battleData, 'single_battle_rank', getReqVal('ranked', 0)); } else { - //组队模式战斗次数 - $this->minValue($battleData, 'team_battle_rank', getReqVal('ranked', 0)); //组队模式最高排名 + $this->minValue($battleData, 'team_battle_rank', getReqVal('ranked', 0)); + //组队模式战斗次数 $this->incValue($battleData, 'total_team_battle_times', 1); + //组队模式前30名次数 + if (getReqVal('ranked', 0) <= 30){ + $this->incValue($battleData, 'total_team_top_X_battle_times', 1); + } } $ranked = getReqVal('ranked', 0); if ($ranked == 1) { diff --git a/webapp/services/MissionService.php b/webapp/services/MissionService.php index 338a813b..534e0ce8 100644 --- a/webapp/services/MissionService.php +++ b/webapp/services/MissionService.php @@ -57,39 +57,40 @@ class MissionService extends BaseService { public function init($userInfo, $seasonDb) { $this->userInfo = $userInfo; -// $this->seasonDb = $seasonDb; + $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(), -// ); -// } - $this->offerRewartdMission = BigData::getData(BigData::OFFER_REWARD_MISSION_TYPE); - if (!$this->offerRewartdMission) { - $this->offerRewartdMission = array( - 'missions' => array(), - 'refreshtime' => 0 + $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()->_getNowTime() - $this->offerRewartdMission['refreshtime'] >= 86400){ - $this->refreshOfferRewardMission(); + 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) { +// $this->offerRewartdMission = array( +// 'missions' => array(), +// 'refreshtime' => 0 +// ); +// } +// if (myself()->_getNowTime() - $this->offerRewartdMission['refreshtime'] >= 86400){ +// $this->refreshOfferRewardMission(); +// } } public function getMissionDto($userInfo, $seasonDb, $missionDb, $missionMeta) @@ -101,11 +102,11 @@ class MissionService extends BaseService { 'state' => Mission::NOT_FINISHED_STATE, 'objects' => array(), 'lefttime' => 0, - 'ceg_num' => 0, - "awards" => array( - V_ITEM_GOLD, - mt\Drop::get($missionMeta['reward'])?mt\Drop::get($missionMeta['reward'])['item_id']:0 - ) +// 'ceg_num' => 0, +// "awards" => array( +// V_ITEM_GOLD, +// mt\Drop::get($missionMeta['reward'])?mt\Drop::get($missionMeta['reward'])['item_id']:0 +// ) ); if ($missionDb) { if ($missionMeta['type'] == mt\Task::DAILY_MISSON_TYPE) { @@ -175,9 +176,9 @@ class MissionService extends BaseService { break; case mt\Task::TEAM_BATTLE_RANK_COND: { - //组队比赛排名前X + //组队比赛排名前X次数 $missionDto['current'] = $this->getBattleData($missionDb, $missionMeta, - 'team_battle_rank'); + 'total_team_top_X_battle_times'); } break; case mt\Task::TOTAL_KILL_NUM_COND: @@ -448,6 +449,9 @@ class MissionService extends BaseService { $val = 0; $battleData = $this->internalGetBattleData($missionMeta); $val = getXVal($battleData, $key, 0); + if ($key == 'total_alive_time'){ + $val = $val/1000/60; + } return $val; }