diff --git a/sql/gamedb.sql b/sql/gamedb.sql index e18387ac..ce5dbfbf 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_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', + `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..6753fb1a --- /dev/null +++ b/webapp/models/RealtimeData.php @@ -0,0 +1,29 @@ +_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..2ca63bec 100644 --- a/webapp/services/BattleDataService.php +++ b/webapp/services/BattleDataService.php @@ -20,9 +20,11 @@ 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'); +require_once('services/RealtimeData.php'); use mt; use phpcommon\SqlHelper; @@ -32,6 +34,7 @@ use models\Bag; use models\Hero; use models\Gun; use services\FormulaService; +use services\RealtimeData; class BattleDataService extends BaseService { @@ -492,7 +495,7 @@ class BattleDataService extends BaseService { return; } - $onlineNum = $this->getOnlineNumber(); + $onlineNum = RealtimeData::getOnline(); $rankedTopX= getXVal($params, 'ranked_topx'); $meta = mt\FormulaPvp::getByRanked($rankedTopX); @@ -528,6 +531,7 @@ class BattleDataService extends BaseService { return; } + } private function rewardFragmentPve() @@ -542,7 +546,7 @@ class BattleDataService extends BaseService { return; } - $onlineNum = $this->getOnlineNumber(); + $onlineNum = RealtimeData::getOnline(); $instanceLevel = $this->pveGeminiMeta['gemini_lv']; $instanceRank = $this->instanceRank; $instanceRankRate = $this->getInstanceRankRate(); @@ -658,11 +662,6 @@ class BattleDataService extends BaseService { } } - private function getOnlineNumber() - { - return max(1, 0); - } - private function randWeight($items) { $weights = array();