film/config/dadi.go

34 lines
565 B
Go
Raw Normal View History

2023-04-09 11:38:30 +08:00
package config
import (
"encoding/json"
"io/ioutil"
)
type Dadi struct {
2023-04-09 13:01:04 +08:00
Enable bool `json:"enable"`
BidProfit int64 `json:"bidProfit"`
CouponCost int64 `json:"couponCost"`
Discount float64 `json:"discount"`
Token string `json:"token"`
2023-04-09 11:38:30 +08:00
}
var (
dadiConfig *Dadi = nil
)
func LoadDadiConfig() {
body, err := ioutil.ReadFile("conf/dadi.json")
if err != nil {
panic(err)
}
dadiConfig = new(Dadi)
if err := json.Unmarshal([]byte(body), dadiConfig); err != nil {
panic(err)
}
}
func GetDadiConfig() *Dadi {
return dadiConfig
}