From 6ed02245ef92ebb5749936971535529e2893eafe Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 1 Apr 2022 09:08:17 +0800 Subject: [PATCH] 1 --- webapp/controller/BattleController.class.php | 27 +++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/webapp/controller/BattleController.class.php b/webapp/controller/BattleController.class.php index 2cdd1c8c..48debba6 100644 --- a/webapp/controller/BattleController.class.php +++ b/webapp/controller/BattleController.class.php @@ -37,10 +37,29 @@ class BattleController extends BaseAuthedController { public function getBattleData() { - error_log(json_encode($_REQUEST)); - myself()->_rspData(array( - 'hero_id' => 1245678 - )); + $mode = getReqVal('mode', ''); + $members = json_decode(getReqVal('members', ''), true); + $self = null; + { + foreach ($members as $member) { + if ($member['account_id'] == myself()->_getAccountId()) { + $self = $member; + } + } + if (!$self) { + myself()->_rspErr(1, 'data error'); + return; + } + } + + $data = array( + 'members' => array() + ); + foreach ($members as $member) { + $info = array(); + array_push($data['members'], $info); + } + myself()->_rspData($data()); } }