diff --git a/webapp/services/MissionService.php b/webapp/services/MissionService.php index b038676e..9a1f2d50 100644 --- a/webapp/services/MissionService.php +++ b/webapp/services/MissionService.php @@ -614,8 +614,9 @@ class MissionService extends BaseService { myself()->_rspErr(1, 'mission_id parameter error'); return; } + $idx = 0; $mission = null; - if (!$this->getOfferRewardMissionById($missionId, $mission)) { + if (!$this->getOfferRewardMissionById($missionId, $mission, $idx)) { myself()->_rspErr(1, 'mission_id parameter error'); return; } @@ -634,6 +635,9 @@ class MissionService extends BaseService { $objects = explode('|', getReqVal('objects', 0)); foreach ($objects as $val) { $strings = explode(':', $val); + if (count($strings) < 2) { + continue; + } $type = $strings[0]; $id = $strings[1]; switch ($type) { @@ -671,6 +675,7 @@ class MissionService extends BaseService { error_log(111); $mission['sendtime'] = myself()->_getNowTime(); error_log(json_encode($mission)); + $this->offerRewartdMission['missions'][$idx] = $mission; $this->saveOfferRewardMission(); error_log(json_encode($this->offerRewartdMission)); myself()->_rspOk(); @@ -678,8 +683,9 @@ class MissionService extends BaseService { public function boostOfferRewardMission($missionId) { + $idx = 0; $mission = null; - if (!$this->getOfferRewardMissionById($missionId, $mission)) { + if (!$this->getOfferRewardMissionById($missionId, $mission, $idx)) { myself()->_rspErr(1, 'mission_id parameter error'); return; } @@ -707,14 +713,16 @@ class MissionService extends BaseService { myself()->_rspOk(); } - private function getOfferRewardMissionById($missionId, &$mission) + private function getOfferRewardMissionById($missionId, &$mission, &$idx) { + $idx = 0; $missions = &$this->getOfferRewardMissions(); foreach ($missions as &$val) { if ($val['mission_id'] == $missionId) { $mission = $val; return true; } + ++$idx; } return false; }