From aa03ecf64f7bef74fe1eda12318d1816ae5fabc5 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 8 Dec 2021 16:04:08 +0800 Subject: [PATCH] 1 --- webapp/controller/GMController.class.php | 60 +++++++++++++++++++++++- 1 file changed, 58 insertions(+), 2 deletions(-) diff --git a/webapp/controller/GMController.class.php b/webapp/controller/GMController.class.php index fe5b3ca1..2b841af8 100644 --- a/webapp/controller/GMController.class.php +++ b/webapp/controller/GMController.class.php @@ -1,9 +1,15 @@ _rspErr(1, '请输入指令'); + return; + } + $cmd = $cmds[0]; + $params = count($cmds) > 1 ? array_slice($cmds, 1) : array(); + $cmdHash = array( + '.help' => function () use($params) { + $this->help($params); + }, + '.additem' => function () use($params) { + $this->addItem($params); + } + ); + $func = getXVal($cmdHash, $cmd); + if ($func) { + $func($params); + } else { + $this->_rspErr(2, '无法识别的指令'); + return; + } + } + + private function help($params) + { + $this->_rspData(array( + 'text' => <<_addItems(array( + array( + 'item_id' => $itemId, + 'item_num' => $itemNum + ) + ), $awardService, $propertyChgService); + $this->_rspData(array( + 'text' => '添加道具成功', + 'award' => $awardService->toDto(), + 'property_chg' => $propertyChgService->toDto(), + )); } }