|
@@ -10,12 +10,11 @@ import (
|
|
|
)
|
|
|
|
|
|
var (
|
|
|
- DbConf *dbConf
|
|
|
- MainMysql *mysql.Mysql
|
|
|
- PushMysql *mysql.Mysql
|
|
|
- MemberPushMysql *mysql.Mysql
|
|
|
- MQFW m.MongodbSim
|
|
|
- Mgo_Log m.MongodbSim
|
|
|
+ DbConf *dbConf
|
|
|
+ MainMysql *mysql.Mysql
|
|
|
+ BaseService *mysql.Mysql
|
|
|
+ MQFW m.MongodbSim
|
|
|
+ Mgo_Log m.MongodbSim
|
|
|
)
|
|
|
|
|
|
type dbConf struct {
|
|
@@ -33,9 +32,8 @@ type dbConf struct {
|
|
|
Main *redisConf
|
|
|
}
|
|
|
Mysql struct {
|
|
|
- Main *mysqlConf //大会员&订单
|
|
|
- Push *mysqlConf //推送
|
|
|
- MemberPush *mysqlConf //推送
|
|
|
+ Main *mysqlConf //大会员&订单
|
|
|
+ BaseService *mysqlConf //tidb
|
|
|
}
|
|
|
}
|
|
|
type mgoConf struct {
|
|
@@ -110,30 +108,17 @@ func init() {
|
|
|
MainMysql.Init()
|
|
|
}
|
|
|
|
|
|
- if DbConf.Mysql.Push != nil {
|
|
|
- log.Println("初始化 Push mysql")
|
|
|
- PushMysql = &mysql.Mysql{
|
|
|
- Address: DbConf.Mysql.Push.Address,
|
|
|
- UserName: DbConf.Mysql.Push.UserName,
|
|
|
- PassWord: DbConf.Mysql.Push.PassWord,
|
|
|
- DBName: DbConf.Mysql.Push.DbName,
|
|
|
- MaxOpenConns: DbConf.Mysql.Push.MaxOpenConns,
|
|
|
- MaxIdleConns: DbConf.Mysql.Push.MaxIdleConns,
|
|
|
+ if DbConf.Mysql.BaseService != nil {
|
|
|
+ log.Println("初始化 BaseService")
|
|
|
+ BaseService = &mysql.Mysql{
|
|
|
+ Address: DbConf.Mysql.BaseService.Address,
|
|
|
+ UserName: DbConf.Mysql.BaseService.UserName,
|
|
|
+ PassWord: DbConf.Mysql.BaseService.PassWord,
|
|
|
+ DBName: DbConf.Mysql.BaseService.DbName,
|
|
|
+ MaxOpenConns: DbConf.Mysql.BaseService.MaxOpenConns,
|
|
|
+ MaxIdleConns: DbConf.Mysql.BaseService.MaxIdleConns,
|
|
|
}
|
|
|
- PushMysql.Init()
|
|
|
- }
|
|
|
-
|
|
|
- if DbConf.Mysql.MemberPush != nil {
|
|
|
- log.Println("初始化 member Push mysql")
|
|
|
- MemberPushMysql = &mysql.Mysql{
|
|
|
- Address: DbConf.Mysql.MemberPush.Address,
|
|
|
- UserName: DbConf.Mysql.MemberPush.UserName,
|
|
|
- PassWord: DbConf.Mysql.MemberPush.PassWord,
|
|
|
- DBName: DbConf.Mysql.MemberPush.DbName,
|
|
|
- MaxOpenConns: DbConf.Mysql.MemberPush.MaxOpenConns,
|
|
|
- MaxIdleConns: DbConf.Mysql.MemberPush.MaxIdleConns,
|
|
|
- }
|
|
|
- MemberPushMysql.Init()
|
|
|
+ BaseService.Init()
|
|
|
}
|
|
|
}
|
|
|
}
|