import { core, GLog } from "cgserver" import { AdModel, GAdSer } from "../Service/AdService" import { BlindModel, GBlindSer } from "../Service/BlindService" import { EMatchLoopType, GMatchSer, MatchModel } from "../Service/MatchService" import { GNewsSer, NewsModel } from "../Service/NewsService" import { GServerSer, ServerItem, ServerModel } from "../Service/ServerService" class MongoInit { async initAll() { await this.initServers() await this.initBlindCfg() await this.initMatch() await this.initAds() await this.initNews() } async initServers() { let sm = new ServerModel() sm.id= 1 sm.name= "test region" sm.info= "rest region info" sm.is_show= 1 sm.sort_num= 1 sm.create_time= Date.now() sm.servers=[] let si = new ServerItem() si.id = 2 si.sort_num = 1 si.host = "192.168.0.106" si.port = 6001 si.gmhost = "" si.gmport = -1 si.name = "hall" si.info = "hall" si.is_show = 1 si.state = 1 si.create_time = Date.now() sm.servers.push(si) si = new ServerItem() si.id = 3 si.sort_num = 1 si.host = "192.168.0.106" si.port = 6101 si.gmhost = "" si.gmport = -1 si.name = "texas" si.info = "texas" si.is_show = 1 si.state = 1 si.create_time = Date.now() sm.servers.push(si) await GServerSer.updateOne(sm,{id:sm.id},true) } async initBlindCfg() { let blindM = new BlindModel() blindM.id=1 blindM.items=[ {level:1,small_blind:25,big_blind:50,ante:0,seconds:300}, {level:2,small_blind:50,big_blind:100,ante:0,seconds:300}, {level:3,small_blind:75,big_blind:150,ante:0,seconds:300}, {level:4,small_blind:100,big_blind:200,ante:0,seconds:300}, {level:5,small_blind:150,big_blind:300,ante:0,seconds:300}, {level:-1,small_blind:0,big_blind:0,ante:0,seconds:300}, {level:6,small_blind:200,big_blind:400,ante:0,seconds:300}, {level:7,small_blind:300,big_blind:600,ante:50,seconds:300}, {level:8,small_blind:400,big_blind:800,ante:100,seconds:300}, {level:9,small_blind:500,big_blind:1000,ante:100,seconds:300}, {level:10,small_blind:600,big_blind:1200,ante:200,seconds:300}, {level:-1,small_blind:0,big_blind:0,ante:0,seconds:300}, {level:11,small_blind:800,big_blind:1600,ante:200,seconds:300}, {level:12,small_blind:1000,big_blind:2000,ante:300,seconds:300}, {level:13,small_blind:1200,big_blind:2400,ante:300,seconds:300}, {level:14,small_blind:1500,big_blind:3000,ante:300,seconds:300}, {level:15,small_blind:2000,big_blind:4000,ante:400,seconds:300}, {level:-1,small_blind:0,big_blind:0,ante:0,seconds:300}, {level:16,small_blind:2500,big_blind:5000,ante:500,seconds:300}, {level:17,small_blind:3000,big_blind:6000,ante:500,seconds:300}, {level:18,small_blind:4000,big_blind:8000,ante:1000,seconds:300}, {level:19,small_blind:5000,big_blind:10000,ante:1000,seconds:300}, {level:20,small_blind:6000,big_blind:12000,ante:2000,seconds:300}, {level:-1,small_blind:0,big_blind:0,ante:0,seconds:300}, {level:21,small_blind:8000,big_blind:16000,ante:2000,seconds:300}, {level:22,small_blind:10000,big_blind:20000,ante:3000,seconds:300}, {level:23,small_blind:12000,big_blind:24000,ante:3000,seconds:300}, {level:24,small_blind:15000,big_blind:30000,ante:3000,seconds:300}, {level:25,small_blind:20000,big_blind:40000,ante:4000,seconds:300}, {level:-1,small_blind:0,big_blind:0,ante:0,seconds:300}, {level:26,small_blind:25000,big_blind:50000,ante:5000,seconds:300}, {level:27,small_blind:30000,big_blind:60000,ante:5000,seconds:300}, {level:28,small_blind:40000,big_blind:80000,ante:10000,seconds:300}, {level:29,small_blind:50000,big_blind:100000,ante:10000,seconds:300}, {level:30,small_blind:60000,big_blind:120000,ante:20000,seconds:300}, {level:-1,small_blind:0,big_blind:0,ante:0,seconds:300}, {level:31,small_blind:80000,big_blind:160000,ante:20000,seconds:300}, {level:32,small_blind:100000,big_blind:200000,ante:30000,seconds:300}, {level:33,small_blind:120000,big_blind:240000,ante:30000,seconds:300}, {level:34,small_blind:150000,big_blind:300000,ante:30000,seconds:300}, {level:35,small_blind:200000,big_blind:400000,ante:40000,seconds:300}, {level:-1,small_blind:0,big_blind:0,ante:0,seconds:300}, {level:36,small_blind:250000,big_blind:500000,ante:50000,seconds:300}, {level:37,small_blind:300000,big_blind:600000,ante:50000,seconds:300}, {level:38,small_blind:400000,big_blind:800000,ante:100000,seconds:300}, {level:39,small_blind:500000,big_blind:1000000,ante:100000,seconds:300}, {level:40,small_blind:600000,big_blind:1200000,ante:200000,seconds:300}, {level:-1,small_blind:0,big_blind:0,ante:0,seconds:300}, {level:41,small_blind:800000,big_blind:1600000,ante:200000,seconds:300}, {level:42,small_blind:1000000,big_blind:2000000,ante:300000,seconds:300}, {level:43,small_blind:1200000,big_blind:2400000,ante:300000,seconds:300}, {level:44,small_blind:1500000,big_blind:3000000,ante:300000,seconds:300}, {level:45,small_blind:2000000,big_blind:4000000,ante:400000,seconds:300}, {level:-1,small_blind:0,big_blind:0,ante:0,seconds:300}, {level:46,small_blind:2500000,big_blind:5000000,ante:500000,seconds:300}, {level:47,small_blind:3000000,big_blind:6000000,ante:500000,seconds:300}, {level:48,small_blind:4000000,big_blind:8000000,ante:1000000,seconds:300}, {level:49,small_blind:5000000,big_blind:10000000,ante:1000000,seconds:300}, {level:50,small_blind:6000000,big_blind:12000000,ante:2000000,seconds:300}, {level:-1,small_blind:0,big_blind:0,ante:0,seconds:300}, {level:51,small_blind:8000000,big_blind:16000000,ante:2000000,seconds:300}, {level:52,small_blind:10000000,big_blind:20000000,ante:3000000,seconds:300}, {level:53,small_blind:12000000,big_blind:24000000,ante:3000000,seconds:300}, {level:54,small_blind:15000000,big_blind:30000000,ante:3000000,seconds:300}, {level:55,small_blind:20000000,big_blind:40000000,ante:4000000,seconds:300}, {level:-1,small_blind:0,big_blind:0,ante:0,seconds:300}, {level:56,small_blind:25000000,big_blind:50000000,ante:5000000,seconds:300}, {level:57,small_blind:30000000,big_blind:60000000,ante:5000000,seconds:300}, {level:58,small_blind:40000000,big_blind:80000000,ante:10000000,seconds:300}, {level:59,small_blind:50000000,big_blind:100000000,ante:10000000,seconds:300}, {level:60,small_blind:60000000,big_blind:120000000,ante:20000000,seconds:300}, {level:-1,small_blind:0,big_blind:0,ante:0,seconds:300}, {level:61,small_blind:80000000,big_blind:160000000,ante:20000000,seconds:300}, {level:62,small_blind:100000000,big_blind:200000000,ante:30000000,seconds:300}, {level:63,small_blind:120000000,big_blind:240000000,ante:30000000,seconds:300}, {level:64,small_blind:150000000,big_blind:300000000,ante:30000000,seconds:300}, {level:65,small_blind:200000000,big_blind:400000000,ante:40000000,seconds:300}, {level:-1,small_blind:0,big_blind:0,ante:0,seconds:300}, {level:66,small_blind:250000000,big_blind:500000000,ante:50000000,seconds:300}, {level:67,small_blind:300000000,big_blind:600000000,ante:50000000,seconds:300}, {level:68,small_blind:400000000,big_blind:800000000,ante:100000000,seconds:300}, {level:69,small_blind:500000000,big_blind:1000000000,ante:100000000,seconds:300}, {level:70,small_blind:600000000,big_blind:1200000000,ante:200000000,seconds:300} ] await GBlindSer.updateOne(blindM,{id:blindM.id},true) GLog.info("blind init success!",true) } async initMatch() { for(let i=1;i<=23;++i) { let matchm = new MatchModel() matchm.id=10000+i matchm.name="测试比赛"+matchm.id matchm.des="测试比赛"+matchm.id+" 描述" matchm.icon="image/icon/score_500" matchm.looptype=EMatchLoopType.Day matchm.blind_id=1 matchm.coin=10000 //报名开始时间 matchm.singup_starttime=0 //游戏正式开始的时间 matchm.match_starttime=core.getTodayStartTime()+i*60*60*1000 //最低开赛人数 matchm.min_user=2 matchm.max_user=999 //报名花费 matchm.signup_cost=[ { "id":-99, "count":100 } ] //奖励 matchm.reward= [ { "id":-99, "count":10000 } ] //多少盲注级别以内,还可以进入 matchm.reenter_blind_index=5 //可以重新进入的次数 matchm.reenter_count=3 matchm.open=1 await GMatchSer.updateOne(matchm,{id:matchm.id},true) } GLog.info("match init success!",true) } async initAds() { let ad = new AdModel() ad.title="ad1" ad.icon="http://dzgame.obs.cn-east-2.myhuaweicloud.com/texasres/images/1.png" ad.url="http://www.baidu.com" ad.info="ad1 info" ad.create_time=Date.now() ad.open=1 await GAdSer.updateOne(ad,{title:ad.title},true) ad = new AdModel() ad.title="ad2" ad.icon="http://dzgame.obs.cn-east-2.myhuaweicloud.com/texasres/images/2.png" ad.url="http://www.baidu.com" ad.info="ad2 info" ad.create_time=Date.now() ad.open=1 await GAdSer.updateOne(ad,{title:ad.title},true) ad = new AdModel() ad.title="ad3" ad.icon="http://dzgame.obs.cn-east-2.myhuaweicloud.com/texasres/images/3.png" ad.url="http://www.baidu.com" ad.info="ad3 info" ad.create_time=Date.now() ad.open=1 await GAdSer.updateOne(ad,{title:ad.title},true) ad = new AdModel() ad.title="ad4" ad.icon="http://dzgame.obs.cn-east-2.myhuaweicloud.com/texasres/images/4.png" ad.url="http://www.baidu.com" ad.info="ad4 info" ad.create_time=Date.now() ad.open=1 await GAdSer.updateOne(ad,{title:ad.title},true) } async initNews() { let news = new NewsModel() news.title="测试新闻1" news.icon="http://dzgame.obs.cn-east-2.myhuaweicloud.com/texasres/images/1.png" news.url="http://www.baidu.com" news.subtitle="" news.info="测试新闻内容1,哈哈哈哈哈哈哈哈哈哈哈哈啊哈哈" news.create_time=Date.now() news.type="赛事公告" news.open=1 await GNewsSer.updateOne(news,{title:news.title},true) news = new NewsModel() news.title="测试新闻2" news.icon="http://dzgame.obs.cn-east-2.myhuaweicloud.com/texasres/images/2.png" news.url="http://www.baidu.com" news.subtitle="" news.info="测试新闻内容2,哈哈哈哈哈哈哈哈哈哈哈哈啊哈哈" news.create_time=Date.now() news.type="赛事公告" news.open=1 await GNewsSer.updateOne(news,{title:news.title},true) news = new NewsModel() news.title="测试新闻3" news.icon="http://dzgame.obs.cn-east-2.myhuaweicloud.com/texasres/images/3.png" news.url="http://www.baidu.com" news.subtitle="" news.info="测试新闻内容3,哈哈哈哈哈哈哈哈哈哈哈哈啊哈哈" news.create_time=Date.now() news.type="赛事公告" news.open=1 await GNewsSer.updateOne(news,{title:news.title},true) news = new NewsModel() news.title="测试新闻1" news.icon="http://dzgame.obs.cn-east-2.myhuaweicloud.com/texasres/images/4.png" news.url="http://www.baidu.com" news.subtitle="" news.info="测试新闻内容4,哈哈哈哈哈哈哈哈哈哈哈哈啊哈哈" news.create_time=Date.now() news.type="赛事公告" news.open=1 await GNewsSer.updateOne(news,{title:news.title},true) } } export let GMongoInit=new MongoInit()