From f608e1ffb526e42535aa95e9479ce572214717bb Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 8 Dec 2021 19:31:11 +0800 Subject: [PATCH] 1 --- third_party/phpcommon | 2 +- .../controller/SeasonCardController.class.php | 21 ++++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/third_party/phpcommon b/third_party/phpcommon index 119990e..0732336 160000 --- a/third_party/phpcommon +++ b/third_party/phpcommon @@ -1 +1 @@ -Subproject commit 119990eeeac4281031895c17c9983b523699d757 +Subproject commit 07323361e8abd576aa74a7fab9d2def0d7bee089 diff --git a/webapp/controller/SeasonCardController.class.php b/webapp/controller/SeasonCardController.class.php index fad2636..fd27593 100644 --- a/webapp/controller/SeasonCardController.class.php +++ b/webapp/controller/SeasonCardController.class.php @@ -86,7 +86,7 @@ class SeasonCardController extends BaseAuthedController { $type = getReqVal('type', 0); $level = getReqVal('level', 0); $cardMeta = mt\SeasonCard::get($level); - if ($level) { + if (!$level) { $this->_rspErr(1, 'level参数错误'); return; } @@ -102,10 +102,19 @@ class SeasonCardController extends BaseAuthedController { return; } $cardDb = getXVal($this->seasonCardDb[$type], $level); - if ($cardDd) { + if ($cardDb) { $this->_rspErr(3, '不能重复领取'); return; } + $dropMeta = mt\Drop::get($type == SeasonCard::NORMAL_PACKAGE_ID ? $cardMeta['reward'] : $cardMeta['advanced_reward']); + if (!$dropMeta){ + $this->_rspErr(4, '配置表错误'); + return; + } + $this->_scatterDrop('season:level_reward:' . $type . ':' . $level, + $dropMeta, + $this->awardService, + $this->propertyChgService); SeasonCard::add($this->currSeasonMeta['id'], $type, $level); $this->_rspData(array( 'award' => $this->awardService->toDto(), @@ -213,9 +222,11 @@ class SeasonCardController extends BaseAuthedController { private function getReceivedLevelRewards($type) { - return array_map(function ($val) { - return $val['card_lv']; - }, getXVal($this->seasonCardDb, $type, array())); + $levels = array(); + foreach (getXVal($this->seasonCardDb, $type, array()) as $val) { + array_push($levels, $val['card_lv']); + } + return $levels; } }