film/config/daid.go

32 lines
486 B
Go

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