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 f851174a..8f5b5ea4 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 { @@ -39,7 +41,7 @@ class BattleController extends BaseAuthedController { } $channelId = phpcommon\extractChannel($account_id); - if ($chnanelId == SELFSDK_CHANNEL) { + if ($chnanelId == SELFSDK_CHANNEL || $account_id == '') { //则是机器人 } */ @@ -52,6 +54,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']; @@ -142,6 +148,21 @@ class BattleController extends BaseAuthedController { $this->_rspData($data); } + /* + http post + php://input + { + } + */ + + public function reportSettlement() + { + $battleUuid = getReqVal('battle_uuid', ''); + $data = file_get_contents('php://input'); + BattleSettlement::add($battleUuid, $data); + myself()->_rspOk(); + } + public function getBattleData() { $mode = getReqVal('mode', ''); 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; + } + +}