From 3ad16d907ea2c460473ce0af5b215b74eff5a628 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 21 Nov 2022 11:50:48 +0800 Subject: [PATCH 1/3] 1 --- webapp/controller/BattleController.class.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/webapp/controller/BattleController.class.php b/webapp/controller/BattleController.class.php index 223b41f2..5734a3d7 100644 --- a/webapp/controller/BattleController.class.php +++ b/webapp/controller/BattleController.class.php @@ -39,7 +39,7 @@ class BattleController extends BaseAuthedController { } $channelId = phpcommon\extractChannel($account_id); - if ($chnanelId == SELFSDK_CHANNEL) { + if ($chnanelId == SELFSDK_CHANNEL || $account_id == '') { //则是机器人 } */ @@ -52,6 +52,10 @@ class BattleController extends BaseAuthedController { return; } $data = json_decode(file_get_contents('php://input'), true); + /*error_log(json_encode(array( + 'a' => 'battleReport', + 'post_data' => $data + )));*/ $teamList = array(); if ($data) { $teamList = $data['team_list']; @@ -88,6 +92,17 @@ class BattleController extends BaseAuthedController { $this->_rspData($data); } + /* + http post + php://input + { + } + */ + + public function reportSettlement() + { + } + public function getBattleData() { $mode = getReqVal('mode', ''); From a2e2fdcad459c82d1dc0e13c8bc6d5955d789e1c Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 21 Nov 2022 12:06:08 +0800 Subject: [PATCH 2/3] 1 --- sql/gamedb.sql | 20 ++++++++- webapp/controller/BattleController.class.php | 6 +++ webapp/models/BattleSettlement.php | 44 ++++++++++++++++++++ 3 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 webapp/models/BattleSettlement.php diff --git a/sql/gamedb.sql b/sql/gamedb.sql index a58c1772..ed155c25 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -652,6 +652,25 @@ CREATE TABLE `t_realtime_data` ( ) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `t_battle_settlement` +-- + +DROP TABLE IF EXISTS `t_battle_settlement`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_battle_settlement` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `battle_uniid` varchar(60) NOT NULL DEFAULT '' COMMENT '战斗记录唯一id', + `account_id` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'account_id', + `data` mediumblob COMMENT 'data', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + UNIQUE KEY `account_id_battle_uniid` (`account_id`, `battle_uniid`) +) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `t_battle_history` -- @@ -835,7 +854,6 @@ CREATE TABLE `t_nft_up_event` ( ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; /*!40101 SET character_set_client = @saved_cs_client */; - DROP TABLE IF EXISTS `t_nft_up_receive`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; diff --git a/webapp/controller/BattleController.class.php b/webapp/controller/BattleController.class.php index 689fc5b9..bd2d1f71 100644 --- a/webapp/controller/BattleController.class.php +++ b/webapp/controller/BattleController.class.php @@ -4,6 +4,7 @@ require_once('models/Hero.php'); require_once('models/Gun.php'); require_once('models/Chip.php'); require_once('models/Bag.php'); +require_once('models/BattleSettlement.php'); require_once('models/BattleHistory.php'); require_once('services/BattleDataService.php'); require_once('services/FormulaService.php'); @@ -14,6 +15,7 @@ use models\Hero; use models\Gun; use models\Bag; use models\BattleHistory; +use models\BattleSettlement; class BattleController extends BaseAuthedController { @@ -155,6 +157,10 @@ class BattleController extends BaseAuthedController { public function reportSettlement() { + $battleUuid = getReqVal('battle_uuid', ''); + $data = json_decode(file_get_contents('php://input'), true); + BattleSettlement::add($battleUuid, $data); + myself()->_rspOk(); } public function getBattleData() diff --git a/webapp/models/BattleSettlement.php b/webapp/models/BattleSettlement.php new file mode 100644 index 00000000..62ee67c5 --- /dev/null +++ b/webapp/models/BattleSettlement.php @@ -0,0 +1,44 @@ +_getSelfMysql(), + 't_battle_settlement', + array( + 'account_id' => myself()->_getAccountId(), + 'battle_uniid' => $battleUuid, + ), + array( + ), + array( + 'account_id' => myself()->_getAccountId(), + 'battle_uniid' => $battleUuid, + 'data' => $data, + 'createtime' => myself()->_getNowTime(), + 'modifytime' => myself()->_getNowTime(), + ) + ); + } + + public static function find($battleUuid) + { + $row = SqlHelper::selectOne + (myself()->_getSelfMysql(), + 't_battle_settlement', + array( + 'account_id' => myself()->_getAccountId(), + 'battle_uniid' => $battleUuid, + ) + ); + return $row; + } + +} From 03b5f56cccad2413213972294a7e36ca69f00f67 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 21 Nov 2022 12:13:00 +0800 Subject: [PATCH 3/3] 1 --- webapp/controller/BattleController.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/controller/BattleController.class.php b/webapp/controller/BattleController.class.php index bd2d1f71..8f5b5ea4 100644 --- a/webapp/controller/BattleController.class.php +++ b/webapp/controller/BattleController.class.php @@ -158,7 +158,7 @@ class BattleController extends BaseAuthedController { public function reportSettlement() { $battleUuid = getReqVal('battle_uuid', ''); - $data = json_decode(file_get_contents('php://input'), true); + $data = file_get_contents('php://input'); BattleSettlement::add($battleUuid, $data); myself()->_rspOk(); }