This commit is contained in:
aozhiwei 2021-12-09 10:34:53 +08:00
parent 041eb4f995
commit 3e7603067d

View File

@ -73,11 +73,28 @@ class SeasonController extends BaseAuthedController {
public function getMissionReward()
{
$mission = $this->getMissionInfo();
if ($mission['state'] != Mission::RECEIVEABLE_STATE) {
if (!$mission || $mission['state'] != Mission::RECEIVEABLE_STATE) {
$this->_rspErr(1, '不可领取');
return;
}
$this->_rspOk();
$missionMeta = mt\Task::get($this->currSeasonMeta['task_id']);
if (!$missionMeta) {
$this->_rspErr(10, '服务器内部错误drop错误');
return;
}
$dropMeta = mt\Drop::get($missionMeta['reward']);
if (!$dropMeta) {
$this->_rspErr(10, '服务器内部错误drop错误');
return;
}
$this->_scatterDrop($dropMeta, $this->awardService, $this->propertyChgService);
Mission::add($missionId);
$missionDb = Mission::find($missionId);
$missionDto = $this->missionService->getMissionDto($missionDb, $missionMeta);
$this->_rspData(array(
'award' => $this->awardService->toDto(),
'property_chg' => $this->propertyChgService->toDto(),
));
}
private function getMissionInfo()