github.com/lianghucheng/zrddz@v0.0.0-20200923083010-c71f680932e2/src/conf/redpacket.go (about) 1 package conf 2 3 import ( 4 "github.com/BurntSushi/toml" 5 "github.com/name5566/leaf/log" 6 ) 7 8 type CfgPrimaryTask struct { 9 ID int 10 Real bool 11 Total int 12 Fee float64 13 Desc string 14 Jump int 15 Type int // 红包类型 1:新人指定金额红包 2:新人幸运红包 3:指定金额红包 4:幸运红包 16 } 17 18 type CfgMiddleTask struct { 19 ID int 20 Real bool 21 Total int 22 Fee float64 23 Desc string 24 Jump int 25 Type int // 红包类型 1:新人指定金额红包 2:新人幸运红包 3:指定金额红包 4:幸运红包 26 27 } 28 type CfgHighTask struct { 29 ID int 30 Real bool 31 Total int 32 Fee float64 33 Desc string 34 Jump int 35 Type int // 红包类型 1:新人指定金额红包 2:新人幸运红包 3:指定金额红包 4:幸运红包 36 37 } 38 39 type RedpacketTaskList struct { 40 CfgPrimaryTasks []CfgPrimaryTask 41 CfgMiddleTasks []CfgMiddleTask 42 CfgHighTasks []CfgHighTask 43 } 44 45 var RedpacketTaskCfg RedpacketTaskList 46 47 func RedpacketTaskCfgInit() { 48 _, err := toml.DecodeFile("conf/redpacket-task.toml", &RedpacketTaskCfg) 49 if err != nil { 50 log.Error("读取redpacket-task.toml失败,error:%v", err) 51 } 52 log.Release("*****************:%v", RedpacketTaskCfg.CfgPrimaryTasks) 53 log.Release("*****************:%v", RedpacketTaskCfg.CfgMiddleTasks) 54 log.Release("*****************:%v", RedpacketTaskCfg.CfgHighTasks) 55 } 56 func GetCfgMiddleTask() []CfgMiddleTask { 57 return RedpacketTaskCfg.CfgMiddleTasks 58 } 59 60 func GetCfgPrimaryTask() []CfgPrimaryTask { 61 return RedpacketTaskCfg.CfgPrimaryTasks 62 } 63 64 func GetCfgHighTask() []CfgHighTask { 65 return RedpacketTaskCfg.CfgHighTasks 66 }