github.com/lianghucheng/zrddz@v0.0.0-20200923083010-c71f680932e2/src/conf/share.go (about) 1 package conf 2 3 import ( 4 "github.com/BurntSushi/toml" 5 "github.com/name5566/leaf/log" 6 ) 7 8 type Share struct { 9 CfgShareTasks []CfgShareTask 10 CfgShareCalcMethods []CfgShareCalcMethod 11 } 12 type CfgShareTask struct { 13 ID int 14 Real bool // true 表示获得 false 表示返利 15 Total int 16 Fee float64 17 Desc string 18 Info string 19 } 20 21 type CfgShareCalcMethod struct { 22 AchieveScope int //业绩区间范围(万) 23 BackMoney float64 //返佣金额比例(%) 24 DiffMoney float64 //代理差返佣百分比例 25 } 26 27 var ShareCfg Share 28 29 func ShareCfgInit() { 30 _, err := toml.DecodeFile("conf/share.toml", &ShareCfg) 31 if err != nil { 32 log.Error("读取share.toml失败,error:%v", err) 33 } 34 log.Release("*****************:%v", ShareCfg.CfgShareTasks) 35 } 36 func GetCfgShareTask() []CfgShareTask { 37 return ShareCfg.CfgShareTasks 38 } 39 40 func GetCfgShareCalcMethods() []CfgShareCalcMethod { 41 return ShareCfg.CfgShareCalcMethods 42 }