From 767c2130db1b2cebf360e67a34b0b43c62089557 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 11 Mar 2022 10:28:04 +0800 Subject: [PATCH] 1 --- webapp/controller/GMController.class.php | 11 +++++++++++ webapp/services/MissionService.php | 7 +++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/webapp/controller/GMController.class.php b/webapp/controller/GMController.class.php index 7b1eab0d..8e203a46 100644 --- a/webapp/controller/GMController.class.php +++ b/webapp/controller/GMController.class.php @@ -40,6 +40,9 @@ class GMController extends BaseAuthedController { }, '.setsystime' => function () use($params) { $this->setSysTime($params); + }, + '.reset_mission' => function () use($params) { + $this->resetMission($params); } ); $func = getXVal($cmdHash, $cmd); @@ -59,6 +62,7 @@ class GMController extends BaseAuthedController { .addtili 英雄id 体力值 //添加英雄体力 .getsystime //获取服务器时间 .setsystime //设置服务器时间,示例:.setsystime 2021-12-08 00:00:00 +.reset_mission //重置任务 END )); } @@ -126,4 +130,11 @@ END $r->set(GLOBAL_TIME_OFFSET_KEY, $time_offset); } + private function resetMission($params) + { + myself()->_getSelfMysql()->execScript('DELETE FROM t_mission;'); + myself()->_getSelfMysql()->execScript('DELETE FROM t_bigdata;'); + myself()->_rspOk(); + } + } diff --git a/webapp/services/MissionService.php b/webapp/services/MissionService.php index 9a1f2d50..22f84ce5 100644 --- a/webapp/services/MissionService.php +++ b/webapp/services/MissionService.php @@ -76,7 +76,9 @@ class MissionService extends BaseService { } $this->offerRewartdMission = BigData::getData(BigData::OFFER_REWARD_MISSION_TYPE); if (!$this->offerRewartdMission) { - $this->offerRewartdMission = array(); + $this->offerRewartdMission = array( + 'missions' => array() + ); } { $refreshTime = getXVal($this->offerRewartdMission, 'refreshtime'); @@ -550,6 +552,7 @@ class MissionService extends BaseService { private function refreshOfferRewardMission() { + error_log(11); $this->offerRewartdMission['refreshtime'] = myself()->_getNowTime(); $sentMissions = array(); foreach ($this->offerRewartdMission['missions'] as $mission) { @@ -592,7 +595,7 @@ class MissionService extends BaseService { foreach ($this->offerRewartdMission['missions'] as $mission) { if ($mission['mission_id'] == $missionDto['mission_id']) { if ($mission['sendtime'] > 0) { - $leftTime = max(0, myself()->_getNowTime() - $mission['sendtime']); + $leftTime = max(0, ($mission['sendtime'] + $missionMeta['time'] + 1000)-myself()->_getNowTime()); $missionDto['lefttime'] = $leftTime; if ($leftTime > 0) { $missionDto['state'] = 0;