/*
初始数据库应用
*/
package init

import (
	"jyBXSubscribe/entity"

	"app.yhyue.com/moapp/jybase/mongodb"
	"github.com/zeromicro/go-zero/core/logx"
)

var (
	MgoLog mongodb.MongodbSim
	Mgo    mongodb.MongodbSim
)

//
func MongoDBInit(em *entity.Mongo) {
	//
	if em.MgoLog.Address != "" {
		logx.Info("--初始化 mongodb log--")
		MgoLog = mongodb.MongodbSim{
			MongodbAddr: em.MgoLog.Address,
			Size:        em.MgoLog.Size,
			DbName:      em.MgoLog.DbName,
			UserName:    em.MgoLog.UserName,
			Password:    em.MgoLog.Password,
		}
		MgoLog.InitPool()
	}
	if em.Main.Address != "" {
		logx.Info("--初始化 mongodb log--")
		Mgo = mongodb.MongodbSim{
			MongodbAddr: em.Main.Address,
			Size:        em.Main.Size,
			DbName:      em.Main.DbName,
		}
		Mgo.InitPool()
	}
}
