瀏覽代碼

feat:更新

wangshan 3 年之前
父節點
當前提交
a2c8af0177

+ 0 - 9
jyBXBase/api/etc/db.json

@@ -1,9 +0,0 @@
-{
-  "mgoLog":{
-      "address": "192.168.3.206:27090",
-      "size": 5,
-      "dbName": "qfw",
-      "userName": "admin",
-      "password": "123456"
-    }
-}

+ 7 - 9
jyBXBase/api/etc/db.yaml

@@ -1,9 +1,7 @@
-{
-  "mgoLog":{
-      "address": "192.168.3.206:27090",
-      "size": 5,
-      "dbName": "qfw",
-      "userName": "admin",
-      "password": "123456"
-    }
-}
+mongo:
+    mgoLog:
+        address: 192.168.3.206:27090
+        size: 5
+        dbName: qfw
+        userName: admin
+        password: "123456"

+ 2 - 2
jyBXBase/api/init/db.go

@@ -6,7 +6,7 @@ package init
 import (
 	"app.yhyue.com/moapp/jybase/mongodb"
 	"github.com/zeromicro/go-zero/core/logx"
-	"jyBXBase/api/internal/config"
+	"jyBXBase/entity"
 )
 
 var (
@@ -14,7 +14,7 @@ var (
 )
 
 //
-func MongoDBInit(em *config.Db) {
+func MongoDBInit(em *entity.Mongo) {
 	//
 	if em.MgoLog.Address != "" {
 		logx.Info("--初始化 mongodb log--")

+ 2 - 3
jyBXBase/api/init/init.go

@@ -19,7 +19,7 @@ var logFile = flag.String("lf", "etc/logs.yaml", "the config file")
 var logc entity.Logc
 
 //
-var dbFile = flag.String("df", "etc/db.json", "the db file")
+var dbFile = flag.String("df", "etc/db.yaml", "the db file")
 var DB config.Db
 
 //
@@ -29,7 +29,6 @@ var ExcludeUrl = []*regexp.Regexp{}
 
 func init() {
 	conf.MustLoad(*configFile, &C)
-	log.Println("-----------", C.Tcount)
 	log.Println("初始化配置") //
 	//初始化日志信息
 	conf.MustLoad(*logFile, &logc)
@@ -47,7 +46,7 @@ func init() {
 	//读取数据库配置
 	conf.MustLoad(*dbFile, &DB)
 	//初始mongodb
-	MongoDBInit(&DB)
+	MongoDBInit(&DB.Mongo)
 	//读取路由配置
 	conf.MustLoad(*routesFile, &Routes)
 	if len(Routes.ExcludeRoute) > 0 {

+ 1 - 1
jyBXBase/api/internal/config/config.go

@@ -19,7 +19,7 @@ type Config struct {
 }
 
 type Db struct {
-	MgoLog *entity.MongoDBStruct `json:"mgoLog,omitempty"`
+	Mongo entity.Mongo `json:"mongo"`
 }
 
 type Routes struct {

+ 7 - 6
jyBXBase/entity/db.go

@@ -1,13 +1,14 @@
 package entity
 
-type MongoDB struct {
-	Main    *MongoDBStruct `json:"main,omitempty"`
-	Ent     *MongoDBStruct `json:"ent,omitempty"`
-	Bidding *MongoDBStruct `json:"bidding,omitempty"`
+type Mongo struct {
+	Main    *MongoStruct `json:"main,optional"`
+	MgoLog  *MongoStruct `json:"mgoLog,optional"`
+	Ent     *MongoStruct `json:"ent,optional"`
+	Bidding *MongoStruct `json:"bidding,optional"`
 }
 
 //
-type MongoDBStruct struct {
+type MongoStruct struct {
 	Address        string `json:"address"`
 	Size           int    `json:"size"`
 	DbName         string `json:"dbName"`
@@ -30,7 +31,7 @@ type MysqlStruct struct {
 }
 
 //redis
-type RedisDBStuct struct {
+type RedisStuct struct {
 	Addr []string `json:"addr"`
 }
 

+ 0 - 40
jyBXBase/rpc/etc/db.json

@@ -1,40 +0,0 @@
-{
-  "mongoDB": {
-    "main": {
-      "address": "192.168.3.206:27080",
-      "size": 5,
-      "dbName": "qfw"
-    },
-    "ent": {
-      "address": "192.168.3.206:27001",
-      "size": 5,
-      "dbName": "mixdata",
-      "userName": "jyDevGroup",
-      "password": "DevGroup"
-    },
-    "bidding": {
-      "address": "192.168.3.207:27001,192.168.3.206:27002",
-      "size": 5,
-      "dbName": "qfw_data",
-      "collection": "bidding",
-      "collectionBack": "bidding_back",
-      "userName": "jyDevGroup",
-      "password": "jy@DevGroup"
-    }
-  },
-  "es": {
-    "addr": "http://192.168.3.206:9800",
-    "size": 5
-  },
-  "redisDB": {
-    "addr": ["other=192.168.3.206:1712", "newother=192.168.3.206:1712"]
-  },
-  "mysqlMain": {
-    "dbName": "jianyu",
-    "address": "192.168.3.11:3366",
-    "userName": "root",
-    "password": "Topnet123",
-    "maxOpenConns": 5,
-    "maxIdleConns": 5
-  }
-}

+ 32 - 9
jyBXBase/rpc/etc/db.yaml

@@ -1,9 +1,32 @@
-{
-  "mgoLog":{
-      "address": "192.168.3.206:27090",
-      "size": 5,
-      "dbName": "qfw",
-      "userName": "admin",
-      "password": "123456"
-    }
-}
+mysql:
+    dbName: jianyu
+    address: 192.168.3.11:3366
+    userName: root
+    password: Topnet123
+    maxOpenConns: 5
+    maxIdleConns: 5
+redis:
+    addr:
+        - other=192.168.3.206:1712
+es:
+    addr: http://192.168.3.206:9800
+    size: 5
+mongo:
+    main:
+        dbName: qfw
+        size: 5
+        address: 192.168.3.206:27080
+    ent:
+        dbName: mixdata
+        size: 5
+        address: 192.168.3.206:27001
+        userName: jyDevGroup
+        password: DevGroup
+    bidding:
+        address: 192.168.3.206:27001
+        size: 5
+        dbName: qfw_data
+        collection: bidding
+        collectionChange: bidding_back
+        userName: jyDevGroup
+        password: jy@DevGroup

+ 2 - 2
jyBXBase/rpc/init/db.go

@@ -23,7 +23,7 @@ var (
 )
 
 //
-func MongoDBInit(em *entity.MongoDB) {
+func MongoDBInit(em *entity.Mongo) {
 	//初始化 mongodb
 	if em.Main.Address != "" {
 		logx.Info("--初始化 mongodb--")
@@ -78,7 +78,7 @@ func MysqlInit(em *entity.MysqlStruct) {
 }
 
 //
-func RedisInit(rm *entity.RedisDBStuct) {
+func RedisInit(rm *entity.RedisStuct) {
 	//初始化 redis
 	if len(rm.Addr) > 0 {
 		logx.Info("--初始化 redis--")

+ 4 - 4
jyBXBase/rpc/init/init.go

@@ -14,7 +14,7 @@ var C config.Config
 var err error
 
 //
-var dbFile = flag.String("df", "etc/db.json", "the db file")
+var dbFile = flag.String("df", "etc/db.yaml", "the db file")
 var DB config.Db
 
 //
@@ -27,11 +27,11 @@ func init() {
 	//数据库配置
 	conf.MustLoad(*dbFile, &DB)
 	//初始mongodb
-	MongoDBInit(&DB.MongoDB)
+	MongoDBInit(&DB.Mongo)
 	//初始化msyql
-	MysqlInit(&DB.MysqlMain)
+	MysqlInit(&DB.Mysql)
 	//初始redis
-	RedisInit(&DB.RedisDB)
+	RedisInit(&DB.Redis)
 	//初始es
 	EsInit(&DB.Es)
 	//初始化日志信息

+ 4 - 4
jyBXBase/rpc/internal/config/config.go

@@ -11,8 +11,8 @@ type Config struct {
 }
 
 type Db struct {
-	MysqlMain entity.MysqlStruct  `json:"mysqlMain"`
-	RedisDB   entity.RedisDBStuct `json:"redisDB"`
-	Es        entity.EsStruct     `json:"es"`
-	MongoDB   entity.MongoDB      `json:"mongoDB"`
+	Mysql entity.MysqlStruct `json:"mysql"`
+	Redis entity.RedisStuct  `json:"redis"`
+	Es    entity.EsStruct    `json:"es"`
+	Mongo entity.Mongo       `json:"mongo"`
 }

+ 0 - 9
jyBXCore/api/etc/db.json

@@ -1,9 +0,0 @@
-{
-  "mgoLog":{
-      "address": "192.168.3.206:27090",
-      "size": 5,
-      "dbName": "qfw",
-      "userName": "admin",
-      "password": "123456"
-    }
-}

+ 7 - 0
jyBXCore/api/etc/db.yaml

@@ -0,0 +1,7 @@
+mongo:
+    mgoLog:
+        address: 192.168.3.206:27090
+        size: 5
+        dbName: qfw
+        userName: admin
+        password: "123456"

+ 2 - 2
jyBXCore/api/init/db.go

@@ -6,7 +6,7 @@ package init
 import (
 	"app.yhyue.com/moapp/jybase/mongodb"
 	"github.com/zeromicro/go-zero/core/logx"
-	"jyBXCore/api/internal/config"
+	"jyBXCore/entity"
 )
 
 var (
@@ -14,7 +14,7 @@ var (
 )
 
 //
-func MongoDBInit(em *config.Db) {
+func MongoDBInit(em *entity.Mongo) {
 	//
 	if em.MgoLog.Address != "" {
 		logx.Info("--初始化 mongodb log--")

+ 2 - 2
jyBXCore/api/init/init.go

@@ -20,7 +20,7 @@ var logFile = flag.String("lf", "etc/logs.yaml", "the log file")
 var logc entity.Logc
 
 //
-var dbFile = flag.String("df", "etc/db.json", "the db file")
+var dbFile = flag.String("df", "etc/db.yaml", "the db file")
 var DB config.Db
 
 //
@@ -35,7 +35,7 @@ func init() {
 	//读取数据库配置
 	conf.MustLoad(*dbFile, &DB)
 	//初始mongodb
-	MongoDBInit(&DB)
+	MongoDBInit(&DB.Mongo)
 	//初始化日志信息
 	conf.MustLoad(*logFile, &logc)
 	if len(logc.Level) > 0 {

+ 1 - 1
jyBXCore/api/internal/config/config.go

@@ -19,7 +19,7 @@ type Config struct {
 }
 
 type Db struct {
-	MgoLog *entity.MongoDBStruct `json:"mgoLog,omitempty"`
+	Mongo entity.Mongo `json:"mongo"`
 }
 
 type Routes struct {

+ 6 - 5
jyBXCore/entity/db.go

@@ -1,12 +1,13 @@
 package entity
 
-type MongoDB struct {
-	Main    *MongoDBStruct `json:"main"`
-	Bidding *MongoDBStruct `json:"bidding"`
+type Mongo struct {
+	Main    *MongoStruct `json:"main,optional"`
+	MgoLog  *MongoStruct `json:"mgoLog,optional"`
+	Bidding *MongoStruct `json:"bidding,optional"`
 }
 
 //
-type MongoDBStruct struct {
+type MongoStruct struct {
 	Address        string `json:"address"`
 	Size           int    `json:"size"`
 	DbName         string `json:"dbName"`
@@ -34,7 +35,7 @@ type MysqlStruct struct {
 }
 
 //redis
-type RedisDBStuct struct {
+type RedisStuct struct {
 	Addr []string `json:"addr"`
 }
 

+ 0 - 35
jyBXCore/rpc/etc/db.json

@@ -1,35 +0,0 @@
-{
-  "mongoDB": {
-    "main": {
-      "address": "192.168.3.206:27080",
-      "size": 5,
-      "dbName": "qfw"
-    },
-    "bidding": {
-      "address": "192.168.3.207:27001,192.168.3.206:27002",
-      "size": 5,
-      "dbName": "qfw_data",
-      "collection": "bidding",
-      "collectionBack": "bidding_back",
-      "userName": "jyDevGroup",
-      "password": "jy@DevGroup"
-    }
-  },
-  "es": {
-    "addr": "http://192.168.3.206:9800",
-    "size": 5
-  },
-  "redisDB": {
-    "addr":["other=192.168.3.206:1712","newother=192.168.3.206:1712"]
-  },
-  "mysql": {
-    "main": {
-      "dbName": "jianyu",
-      "address": "192.168.3.11:3366",
-      "userName": "root",
-      "password": "Topnet123",
-      "maxOpenConns": 5,
-      "maxIdleConns": 5
-    }
-  }
-}

+ 27 - 0
jyBXCore/rpc/etc/db.yaml

@@ -0,0 +1,27 @@
+mysql:
+    main:
+        dbName: jianyu
+        address: 192.168.3.11:3366
+        userName: root
+        password: Topnet123
+        maxOpenConns: 5
+        maxIdleConns: 5
+redis:
+    addr:
+        - other=192.168.3.206:1712
+es:
+    addr: http://192.168.3.206:9800
+    size: 5
+mongo:
+    main:
+        dbName: qfw
+        size: 5
+        address: 192.168.3.206:27080
+    bidding:
+        address: 192.168.3.206:27001
+        size: 5
+        dbName: qfw_data
+        collection: bidding
+        collectionChange: bidding_back
+        userName: jyDevGroup
+        password: jy@DevGroup

+ 2 - 2
jyBXCore/rpc/init/db.go

@@ -22,7 +22,7 @@ var (
 )
 
 //
-func MongoDBInit(em *entity.MongoDB) {
+func MongoDBInit(em *entity.Mongo) {
 	//初始化 mongodb
 	if em.Main.Address != "" {
 		logx.Info("--初始化 mongodb--")
@@ -65,7 +65,7 @@ func MysqlInit(mm *entity.Mysql) {
 }
 
 //
-func RedisInit(rm *entity.RedisDBStuct) {
+func RedisInit(rm *entity.RedisStuct) {
 	//初始化 redis
 	if len(rm.Addr) > 0 {
 		logx.Info("--初始化 redis--")

+ 3 - 3
jyBXCore/rpc/init/init.go

@@ -14,7 +14,7 @@ var C config.Config
 var err error
 
 //
-var dbFile = flag.String("df", "etc/db.json", "the db file")
+var dbFile = flag.String("df", "etc/db.yaml", "the db file")
 var DB config.Db
 
 //
@@ -27,11 +27,11 @@ func init() {
 	//数据库配置
 	conf.MustLoad(*dbFile, &DB)
 	//初始mongodb
-	MongoDBInit(&DB.MongoDB)
+	MongoDBInit(&DB.Mongo)
 	//初始化msyql
 	MysqlInit(&DB.Mysql)
 	//初始redis
-	RedisInit(&DB.RedisDB)
+	RedisInit(&DB.Redis)
 	//初始es
 	EsInit(&DB.Es)
 	//初始化日志信息

+ 4 - 4
jyBXCore/rpc/internal/config/config.go

@@ -26,8 +26,8 @@ type Config struct {
 }
 
 type Db struct {
-	Mysql   entity.Mysql        `json:"mysql"`
-	RedisDB entity.RedisDBStuct `json:"redisDB"`
-	Es      entity.EsStruct     `json:"es"`
-	MongoDB entity.MongoDB      `json:"mongoDB"`
+	Mysql entity.Mysql      `json:"mysql"`
+	Redis entity.RedisStuct `json:"redis"`
+	Es    entity.EsStruct   `json:"es"`
+	Mongo entity.Mongo      `json:"mongo"`
 }

+ 0 - 9
jyBXSubscribe/api/etc/db.json

@@ -1,9 +0,0 @@
-{
-  "mgoLog":{
-      "address": "192.168.3.206:27090",
-      "size": 5,
-      "dbName": "qfw",
-      "userName": "admin",
-      "password": "123456"
-    }
-}

+ 7 - 0
jyBXSubscribe/api/etc/db.yaml

@@ -0,0 +1,7 @@
+mongo:
+    mgoLog:
+        address: 192.168.3.206:27090
+        size: 5
+        dbName: qfw
+        userName: admin
+        password: "123456"

+ 2 - 2
jyBXSubscribe/api/init/db.go

@@ -6,7 +6,7 @@ package init
 import (
 	"app.yhyue.com/moapp/jybase/mongodb"
 	"github.com/zeromicro/go-zero/core/logx"
-	"jyBXSubscribe/api/internal/config"
+	"jyBXSubscribe/entity"
 )
 
 var (
@@ -14,7 +14,7 @@ var (
 )
 
 //
-func MongoDBInit(em *config.Db) {
+func MongoDBInit(em *entity.Mongo) {
 	//
 	if em.MgoLog.Address != "" {
 		logx.Info("--初始化 mongodb log--")

+ 2 - 2
jyBXSubscribe/api/init/init.go

@@ -20,7 +20,7 @@ var logFile = flag.String("lf", "etc/logs.yaml", "the log file")
 var logc entity.Logc
 
 //
-var dbFile = flag.String("df", "etc/db.json", "the db file")
+var dbFile = flag.String("df", "etc/db.yaml", "the db file")
 var DB config.Db
 
 //
@@ -34,7 +34,7 @@ func init() {
 	//读取数据库配置
 	conf.MustLoad(*dbFile, &DB)
 	//初始mongodb
-	MongoDBInit(&DB)
+	MongoDBInit(&DB.Mongo)
 	//初始化日志信息
 	conf.MustLoad(*logFile, &logc)
 	if len(logc.Level) > 0 {

+ 1 - 1
jyBXSubscribe/api/internal/config/config.go

@@ -20,7 +20,7 @@ type Config struct {
 }
 
 type Db struct {
-	MgoLog entity.MongoDBStruct `json:"mgoLog"`
+	Mongo entity.Mongo `json:"mongo"`
 }
 
 type Routes struct {

+ 6 - 5
jyBXSubscribe/entity/db.go

@@ -1,12 +1,13 @@
 package entity
 
-type MongoDB struct {
-	Main    *MongoDBStruct `json:"main,omitempty"`
-	Bidding *MongoDBStruct `json:"bidding,omitempty"`
+type Mongo struct {
+	Main    *MongoStruct `json:"main,optional"`
+	MgoLog  *MongoStruct `json:"mgoLog,optional"`
+	Bidding *MongoStruct `json:"bidding,optional"`
 }
 
 //
-type MongoDBStruct struct {
+type MongoStruct struct {
 	Address        string `json:"address"`
 	Size           int    `json:"size"`
 	DbName         string `json:"dbName"`
@@ -37,7 +38,7 @@ type MysqlStruct struct {
 }
 
 //redis
-type RedisDBStuct struct {
+type RedisStuct struct {
 	Addr []string `json:"addr"`
 }
 

+ 48 - 0
jyBXSubscribe/rpc/etc/db.yaml

@@ -0,0 +1,48 @@
+mysql:
+    main:
+        dbName: jianyu
+        address: 192.168.3.11:3366
+        userName: root
+        password: Topnet123
+        maxOpenConns: 5
+        maxIdleConns: 5
+    push:
+        dbName: jianyu
+        address: 192.168.3.11:3366
+        userName: root
+        password: Topnet123
+        maxOpenConns: 5
+        maxIdleConns: 5
+    memberPush:
+        dbName: jianyu
+        address: 192.168.3.11:3366
+        userName: root
+        password: Topnet123
+        maxOpenConns: 5
+        maxIdleConns: 5
+    entnichePush:
+        dbName: jianyu
+        address: 192.168.3.11:3366
+        userName: root
+        password: Topnet123
+        maxOpenConns: 5
+        maxIdleConns: 5
+redis:
+    addr:
+        - other=192.168.3.206:1712
+es:
+    addr: http://192.168.3.206:9800
+    size: 5
+mongo:
+    main:
+        dbName: qfw
+        size: 5
+        address: 192.168.3.206:27080
+    bidding:
+        address: 192.168.3.206:27001
+        size: 5
+        dbName: qfw_data
+        collection: bidding
+        collectionChange: bidding_back
+        userName: jyDevGroup
+        password: jy@DevGroup

+ 2 - 2
jyBXSubscribe/rpc/init/db.go

@@ -26,7 +26,7 @@ var (
 )
 
 //
-func MongoDBInit(em *entity.MongoDB) {
+func MongoDBInit(em *entity.Mongo) {
 	//初始化 mongodb
 	if em.Main.Address != "" {
 		logx.Info("--初始化 mongodb--")
@@ -108,7 +108,7 @@ func MysqlInit(mm *entity.Mysql) {
 }
 
 //
-func RedisInit(rm *entity.RedisDBStuct) {
+func RedisInit(rm *entity.RedisStuct) {
 	//初始化 redis
 	if len(rm.Addr) > 0 {
 		logx.Info("--初始化 redis--")

+ 3 - 3
jyBXSubscribe/rpc/init/init.go

@@ -15,7 +15,7 @@ var C config.Config
 var err error
 
 //
-var dbFile = flag.String("df", "etc/db.json", "the db file")
+var dbFile = flag.String("df", "etc/db.yaml", "the db file")
 var DB config.Db
 
 //
@@ -28,11 +28,11 @@ func init() {
 	//初始化数据库配置
 	conf.MustLoad(*dbFile, &DB)
 	//初始mongodb
-	MongoDBInit(&DB.MongoDB)
+	MongoDBInit(&DB.Mongo)
 	//初始化msyql
 	MysqlInit(&DB.Mysql)
 	//初始redis
-	RedisInit(&DB.RedisDB)
+	RedisInit(&DB.Redis)
 	//初始es
 	EsInit(&DB.Es)
 	//初始化日志信息

+ 4 - 4
jyBXSubscribe/rpc/internal/config/config.go

@@ -11,8 +11,8 @@ type Config struct {
 }
 
 type Db struct {
-	Mysql   entity.Mysql        `json:"mysql"`
-	RedisDB entity.RedisDBStuct `json:"redisDB"`
-	Es      entity.EsStruct     `json:"es"`
-	MongoDB entity.MongoDB      `json:"mongoDB"`
+	Mysql entity.Mysql      `json:"mysql"`
+	Redis entity.RedisStuct `json:"redis"`
+	Es    entity.EsStruct   `json:"es"`
+	Mongo entity.Mongo      `json:"mongo"`
 }

+ 15 - 15
jyBXSubscribe/rpc/internal/logic/getsublistlogic.go

@@ -38,21 +38,21 @@ func (l *GetSubListLogic) GetSubList(in *bxsubscribe.SubscribeInfosReq) (*bxsubs
 		go util.UpdateUserPushUnread(in.UserId, in.UserType)
 	}
 	spqp := &util.SubPushQueryParam{
-		Mgo_bidding:   IC.MgoBidding,                        //mongo
-		Bidding:       IC.DB.MongoDB.Bidding.Collection,     //招标信息 表
-		Bidding_back:  IC.DB.MongoDB.Bidding.CollectionBack, //招标信息备份数据 表名
-		UserId:        in.UserId,                            //用户id
-		PageNum:       int(in.PageNum),                      //当前页码
-		PageSize:      int(in.PageSize),                     //每页多少条数据
-		SelectTime:    in.SelectTime,                        //时间跨度
-		Area:          in.Area,                              //省份
-		City:          in.City,                              //城市
-		Buyerclass:    in.BuyerClass,                        //采购单位类型
-		Subtype:       in.Subtype,                           //信息类型
-		Subscopeclass: in.Industry,                          //行业
-		Key:           in.KeyWords,                          //关键词
-		Price:         in.Price,                             //价格区间
-		FileExists:    in.FileExists,                        //是否有附件
+		Mgo_bidding:   IC.MgoBidding,                      //mongo
+		Bidding:       IC.DB.Mongo.Bidding.Collection,     //招标信息 表
+		Bidding_back:  IC.DB.Mongo.Bidding.CollectionBack, //招标信息备份数据 表名
+		UserId:        in.UserId,                          //用户id
+		PageNum:       int(in.PageNum),                    //当前页码
+		PageSize:      int(in.PageSize),                   //每页多少条数据
+		SelectTime:    in.SelectTime,                      //时间跨度
+		Area:          in.Area,                            //省份
+		City:          in.City,                            //城市
+		Buyerclass:    in.BuyerClass,                      //采购单位类型
+		Subtype:       in.Subtype,                         //信息类型
+		Subscopeclass: in.Industry,                        //行业
+		Key:           in.KeyWords,                        //关键词
+		Price:         in.Price,                           //价格区间
+		FileExists:    in.FileExists,                      //是否有附件
 	}
 	if in.UserType == "mType" {
 		spqp.PushMysql = IC.MemberPushMysql