Exemple #1
0
func init() {
	//根据随机时间种子实例化随机数
	newRand = rand.New(rand.NewSource(time.Now().UnixNano()))
	//如果没有日志目录则创建日志目录
	_, err := os.Open("log")
	if err != nil && os.IsNotExist(err) {
		os.Mkdir("log", 0777)
	}
	//初始化日志
	log = logs.NewLogger(10000)
	log.SetLogger("file", `{"filename":"log/kingdoms.log"}`)
	//初始化又拍云
	/// 初始化空间
	ku = upyun.NewUpYun("kingdoms", beego.AppConfig.String("UpyunAccount"), beego.AppConfig.String("UpyunPassword"))
	ku.SetApiDomain("v0.api.upyun.com")
	//初始化技能
	allskill = &logic.AllSkill{}
	//初始化所有图片json值
	updateImage()
	//初始化游戏数据
	cardRanks = "100,500,2000,10000"
	chuanqi = []int{16, 132, 181, 230, 278, 308, 501, 539, 566}
	shenjiang = []int{17, 18, 24, 26, 57, 84, 91, 98, 180, 190, 192, 196, 233, 294, 395, 575}
	hujiang = []int{14, 20, 25, 27, 29, 31, 32, 33, 129, 130, 131, 183, 191, 215, 220, 225, 229, 237, 283, 284, 285, 288, 293, 296, 297, 352, 383, 450, 451, 479, 495, 530, 546, 574, 576, 577}
	putong = []int{20}
	xiaobing1 = []int{1001, 1002, 1003, 1004, 1005, 1006}
	xiaobing2 = []int{1007, 1008, 1009, 1010, 1011, 1012}
	xiaobing3 = []int{1013, 1014, 1015, 1016, 1017, 1018}
	RliveCost = 10
	//赋值所有卡牌
	SetAllCards()
}
Exemple #2
0
func init() {
	//如果没有日志目录则创建日志目录
	_, err := os.Open("log")
	if err != nil && os.IsNotExist(err) {
		os.Mkdir("log", 0777)
	}
	//初始化日志
	ApiLog = logs.NewLogger(10000)
	ApiLog.SetLogger("file", `{"filename":"log/api.log"}`)
	//初始化邮箱
	mail = utils.NewEMail(`{"username":"******"EmailAccount") + `","password":"******"EmailPassword") + `","host":"` + beego.AppConfig.String("EmailSmtp") + `","port":` + beego.AppConfig.String("EmailPort") + `}`)
	//初始化又拍云
	u = upyun.NewUpYun("wokugame", beego.AppConfig.String("UpyunAccount"), beego.AppConfig.String("UpyunPassword"))
	u.SetApiDomain("v0.api.upyun.com")
}