From d88a85b184681cf88a36bc0a4f489eb3a403c810 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 19 Sep 2022 15:32:38 +0800 Subject: [PATCH 1/4] 1 --- sql/gamedb.sql | 41 +++++++++++++++++++++++++++ webapp/models/FragmentPool.php | 10 +++++++ webapp/models/RealtimeData.php | 28 ++++++++++++++++++ webapp/services/BattleDataService.php | 1 + 4 files changed, 80 insertions(+) create mode 100644 webapp/models/RealtimeData.php diff --git a/sql/gamedb.sql b/sql/gamedb.sql index e18387ac..057e31b8 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -579,6 +579,9 @@ CREATE TABLE `t_game_log` ( -- Dump completed on 2015-08-19 18:51:22 +-- +-- Table structure for table `t_nft_active` +-- DROP TABLE IF EXISTS `t_nft_active`; /*!40101 SET @saved_cs_client = @@character_set_client */; @@ -596,4 +599,42 @@ CREATE TABLE `t_nft_active` ( ) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `t_fragment_pool` +-- + +DROP TABLE IF EXISTS `t_fragment_pool`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_fragment_pool` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `fragment_id` int(11) NOT NULL DEFAULT '0' COMMENT '碎片id', + `fragment_type` int(11) NOT NULL DEFAULT '0' COMMENT '碎片类型 0:英雄 1:武器', + `fragment_num` int(11) NOT NULL DEFAULT '0' COMMENT '碎片数量', + `alloc_time` int(11) NOT NULL DEFAULT '0' COMMENT '分配时间', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + KEY `alloc_time_fragment_type` (`alloc_time`, `fragment_type`), +) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `t_realtime_data` +-- + +DROP TABLE IF EXISTS `t_realtime_data`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_fragment_data` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `name` varchar(60) NOT NULL DEFAULT '' COMMENT '参数名', + `value1` varchar(60) NOT NULL DEFAULT '' COMMENT '值1', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + UNIQUE KEY `name` (`name`) +) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + -- Dump completed on 2015-08-19 18:51:22 diff --git a/webapp/models/FragmentPool.php b/webapp/models/FragmentPool.php index a38bbd6a..09f62b6a 100644 --- a/webapp/models/FragmentPool.php +++ b/webapp/models/FragmentPool.php @@ -7,4 +7,14 @@ use phpcommon\SqlHelper; class FragmentPool extends BaseModel { + public static function dropHero() + { + + } + + public static function dropGun() + { + + } + } diff --git a/webapp/models/RealtimeData.php b/webapp/models/RealtimeData.php new file mode 100644 index 00000000..083a224e --- /dev/null +++ b/webapp/models/RealtimeData.php @@ -0,0 +1,28 @@ +_getMysql($targetId), + 't_realtime_data', + array( + 'name' => $name + ) + ); + return $row ? $row : ''; + } + +} diff --git a/webapp/services/BattleDataService.php b/webapp/services/BattleDataService.php index b815087d..429c959b 100644 --- a/webapp/services/BattleDataService.php +++ b/webapp/services/BattleDataService.php @@ -528,6 +528,7 @@ class BattleDataService extends BaseService { return; } + } private function rewardFragmentPve() From b32d14733f3906ae8fcbb2e5fce2c8f8bbcdff04 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 19 Sep 2022 15:35:14 +0800 Subject: [PATCH 2/4] 1 --- sql/gamedb.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/gamedb.sql b/sql/gamedb.sql index 057e31b8..ce5dbfbf 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -626,7 +626,7 @@ CREATE TABLE `t_fragment_pool` ( DROP TABLE IF EXISTS `t_realtime_data`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_fragment_data` ( +CREATE TABLE `t_realtime_data` ( `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', `name` varchar(60) NOT NULL DEFAULT '' COMMENT '参数名', `value1` varchar(60) NOT NULL DEFAULT '' COMMENT '值1', From 793acfdb8d7f797290f8be70b636537912c7213f Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 19 Sep 2022 15:41:56 +0800 Subject: [PATCH 3/4] 1 --- webapp/models/RealtimeData.php | 3 ++- webapp/services/BattleDataService.php | 11 ++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/webapp/models/RealtimeData.php b/webapp/models/RealtimeData.php index 083a224e..6753fb1a 100644 --- a/webapp/models/RealtimeData.php +++ b/webapp/models/RealtimeData.php @@ -10,7 +10,8 @@ class RealtimeData extends BaseModel { //获取在线人数 public static function getOnline() { - return self::internalGet('online_num'); + $onlineNum = self::internalGet('online_num'); + return max(1, $onlineNum ? $onlineNum : 0); } private static function internalGet($name) diff --git a/webapp/services/BattleDataService.php b/webapp/services/BattleDataService.php index 429c959b..7058c0fe 100644 --- a/webapp/services/BattleDataService.php +++ b/webapp/services/BattleDataService.php @@ -23,6 +23,7 @@ require_once('models/Gun.php'); require_once('services/RankActivityService.php'); require_once('services/FormulaService.php'); +require_once('services/RealtimeData.php'); use mt; use phpcommon\SqlHelper; @@ -32,6 +33,7 @@ use models\Bag; use models\Hero; use models\Gun; use services\FormulaService; +use services\RealtimeData; class BattleDataService extends BaseService { @@ -492,7 +494,7 @@ class BattleDataService extends BaseService { return; } - $onlineNum = $this->getOnlineNumber(); + $onlineNum = RealtimeData::getOnline(); $rankedTopX= getXVal($params, 'ranked_topx'); $meta = mt\FormulaPvp::getByRanked($rankedTopX); @@ -543,7 +545,7 @@ class BattleDataService extends BaseService { return; } - $onlineNum = $this->getOnlineNumber(); + $onlineNum = RealtimeData::getOnline(); $instanceLevel = $this->pveGeminiMeta['gemini_lv']; $instanceRank = $this->instanceRank; $instanceRankRate = $this->getInstanceRankRate(); @@ -659,11 +661,6 @@ class BattleDataService extends BaseService { } } - private function getOnlineNumber() - { - return max(1, 0); - } - private function randWeight($items) { $weights = array(); From 7d6b7f70b7d2e5b8e76afa88fbb79f5265de438f Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 19 Sep 2022 16:32:01 +0800 Subject: [PATCH 4/4] 1 --- webapp/services/BattleDataService.php | 1 + 1 file changed, 1 insertion(+) diff --git a/webapp/services/BattleDataService.php b/webapp/services/BattleDataService.php index 7058c0fe..2ca63bec 100644 --- a/webapp/services/BattleDataService.php +++ b/webapp/services/BattleDataService.php @@ -20,6 +20,7 @@ require_once('models/Battle.php'); require_once('models/Bag.php'); require_once('models/Hero.php'); require_once('models/Gun.php'); +require_once('models/FragmentPool.php'); require_once('services/RankActivityService.php'); require_once('services/FormulaService.php');