package models import ( "encoding/json" "eta_gn/eta_api/utils" "eta_gn/eta_api/utils/mgodb" ) func init() { if utils.MgoUrlData != `` { var mgoConfig mgodb.MgoConfig if e := json.Unmarshal([]byte(utils.MgoUrlData), &mgoConfig); e != nil { panic("mongodb链接失败,Err:" + e.Error()) return } mgoCli := mgodb.MgoNewClient(mgoConfig) utils.MgoDataCli = mgoCli utils.MgoDataDbName = mgoConfig.Database } }