film/config/dadi.go

34 lines
565 B
Go

package config
import (
"encoding/json"
"io/ioutil"
)
type Dadi struct {
Enable bool `json:"enable"`
BidProfit int64 `json:"bidProfit"`
CouponCost int64 `json:"couponCost"`
Discount float64 `json:"discount"`
Token string `json:"token"`
}
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
}