From 7aa8729bbe07eb2757d92c51507d68721dce826d Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 21 Sep 2022 15:54:14 +0800 Subject: [PATCH] 1 --- server/game2006service/tasks/fragment.js | 17 ++++++++++++++++- sql/gamedb.sql | 3 ++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/server/game2006service/tasks/fragment.js b/server/game2006service/tasks/fragment.js index 217d5803..29115650 100644 --- a/server/game2006service/tasks/fragment.js +++ b/server/game2006service/tasks/fragment.js @@ -26,13 +26,28 @@ class Fragment { const hourSeconds = utils.getHourSeconds(nowTime, constant.TIME_ZONE); const {err, conn} = await app.getDbConn("GameDb1"); if (!err && conn) { - const {err, rows} = await conn.execQuery(); + const allocedFragments = await this.fetchAllocedFragments(conn); } } catch (err) { } } + async fetchAllocedFragments(conn) { + const {err, rows} = await conn.execQuery( + 'SELECT * FROM t_fragment_pool WHERE alloc_time >= ? AND alloc_time <= ?', + [ + + ] + ); + if (err) { + throw err; + return; + } + const allocedFragments = {}; + + } + } function init() { diff --git a/sql/gamedb.sql b/sql/gamedb.sql index 0840343e..ebb1cbae 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -610,6 +610,7 @@ DROP TABLE IF EXISTS `t_fragment_pool`; CREATE TABLE `t_fragment_pool` ( `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', `fragment_id` int(11) NOT NULL DEFAULT '0' COMMENT '碎片id', + `type` int(11) NOT NULL DEFAULT '0' COMMENT '0:pvp 1:pve', `fragment_type` int(11) NOT NULL DEFAULT '0' COMMENT '碎片类型 0:英雄 1:武器', `fragment_num` int(11) NOT NULL DEFAULT '0' COMMENT '剩余碎片数量', `alloc_num` int(11) NOT NULL DEFAULT '0' COMMENT '分配的碎片数量', @@ -617,7 +618,7 @@ CREATE TABLE `t_fragment_pool` ( `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`) + KEY `alloc_time_type_fragment_type` (`alloc_time`, `type`, `fragment_type`) ) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; /*!40101 SET character_set_client = @saved_cs_client */;