瀏覽代碼

feat:访问日志记录

wangshan 3 年之前
父節點
當前提交
5e24cc626e

+ 4 - 2
jyBXBase/api/bxbase.go

@@ -36,8 +36,10 @@ func main() {
 	//全局中间件
 	server.Use(func(next http.HandlerFunc) http.HandlerFunc {
 		return func(w http.ResponseWriter, r *http.Request) {
-			go MC.AddMgoLogs(IC.MgoLog, r, IC.C.MgoLogsName, IC.ExcludeUrl)
-			next(w, r)
+			defer func() {
+				MC.AddMgoLogs(IC.MgoLog, r, IC.C.MgoLogsName, IC.ExcludeUrl, IC.C.MgoLogsCount)
+			}()
+			next.ServeHTTP(w, r)
 		}
 	})
 	handler.RegisterHandlers(server, ctx)

+ 3 - 2
jyBXBase/api/etc/bxbase-api.yaml

@@ -1,6 +1,6 @@
 Name: bxbase-api
 Host: 0.0.0.0
-Port: 8010
+Port: 8006
 Gateway:
   ServerCode: jyinfo
   Etcd:
@@ -10,5 +10,6 @@ BxBase:
     Hosts:
       - 127.0.0.1:2379
     Key: bxbase.rpc
-Webrpcport: 8020
+Webrpcport: 8016
 MgoLogsName: jybxbase_logs
+MgoLogsCount: 5

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

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

+ 0 - 6
jyBXBase/api/etc/db.yaml

@@ -1,6 +0,0 @@
-MgoLog:
-  address: 192.168.3.206:27090
-  size: 5
-  dbName: qfw_data
-  userName: admin
-  passWord: 123456

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

@@ -4,7 +4,6 @@
 package init
 
 import (
-	"app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/mongodb"
 	"github.com/zeromicro/go-zero/core/logx"
 	"jyBXBase/api/internal/config"
@@ -24,7 +23,7 @@ func MongoDBInit(em *config.Db) {
 			Size:        em.MgoLog.Size,
 			DbName:      em.MgoLog.DbName,
 			UserName:    em.MgoLog.UserName,
-			Password:    common.ObjToString(em.MgoLog.PassWord),
+			Password:    em.MgoLog.Password,
 		}
 		MgoLog.InitPool()
 	}

+ 4 - 3
jyBXBase/api/internal/config/config.go

@@ -13,12 +13,13 @@ type Config struct {
 		ServerCode string
 		Etcd       []string
 	}
-	BxBase      zrpc.RpcClientConf
-	MgoLogsName string
+	BxBase       zrpc.RpcClientConf
+	MgoLogsName  string
+	MgoLogsCount int
 }
 
 type Db struct {
-	MgoLog *entity.LogMongoDBStruct
+	MgoLog *entity.MongoDBStruct `json:"mgoLog,omitempty"`
 }
 
 type Routes struct {

+ 15 - 38
jyBXBase/entity/db.go

@@ -1,45 +1,22 @@
 package entity
 
-type MongoDb struct {
-	Main *MainMongoDBStruct
-	Ent  *EntMongoStruct
-	Bid  *BiddingMongoDBStruct
+type MongoDB struct {
+	Main    *MongoDBStruct `json:"main,omitempty"`
+	Ent     *MongoDBStruct `json:"ent,omitempty"`
+	Bidding *MongoDBStruct `json:"bidding,omitempty"`
 }
 
 //
-type MainMongoDBStruct struct {
-	Address string `json:"address"`
-	Size    int    `json:"size"`
-	DbName  string `json:"dbName"`
-}
-
-//mgo_ent
-type EntMongoStruct struct {
-	Address  string `json:"address"`
-	Size     int    `json:"size"`
-	DbName   string `json:"dbName"`
-	UserName string `json:"userName"`
-	Password string `json:"password"`
-}
-
-//
-type BiddingMongoDBStruct struct {
-	Address          string `json:"address"`
-	Size             int    `json:"size"`
-	DbName           string `json:"dbName"`
-	Collection       string `json:"collection"`
-	CollectionChange string `json:"collectionChange"`
-	UserName         string `json:"userName"`
-	PassWord         string `json:"passWord"`
-}
-
-//
-type LogMongoDBStruct struct {
-	Address  string `json:"address"`
-	Size     int    `json:"size"`
-	DbName   string `json:"dbName"`
-	UserName string `json:"userName"`
-	PassWord int64  `json:"passWord"`
+type MongoDBStruct struct {
+	Address        string `json:"address"`
+	Size           int    `json:"size"`
+	DbName         string `json:"dbName"`
+	UserName       string `json:"userName,optional"`
+	Password       string `json:"password,optional"`
+	Collection     string `json:"collection,optional"`
+	CollectionBack string `json:"collectionBack,optional"`
+	MaxOpenConns   int    `json:"maxOpenConns,optional"`
+	MaxIdleConns   int    `json:"maxIdleConns,optional"`
 }
 
 //mysql
@@ -47,7 +24,7 @@ type MysqlStruct struct {
 	DbName       string `json:"dbName"`
 	Address      string `json:"address"`
 	UserName     string `json:"userName"`
-	PassWord     string `json:"passWord"`
+	Password     string `json:"password"`
 	MaxOpenConns int    `json:"maxOpenConns"`
 	MaxIdleConns int    `json:"maxIdleConns"`
 }

+ 1 - 1
jyBXBase/go.mod

@@ -3,7 +3,7 @@ module jyBXBase
 go 1.16
 
 require (
-	app.yhyue.com/moapp/jybase v0.0.0-20220526053450-00c4fb8cd746
+	app.yhyue.com/moapp/jybase v0.0.0-20220527014844-2736644c3090
 	github.com/go-sql-driver/mysql v1.6.0
 	github.com/zeromicro/go-zero v1.3.3
 	go.mongodb.org/mongo-driver v1.9.0

+ 2 - 2
jyBXBase/go.sum

@@ -4,8 +4,8 @@ app.yhyue.com/moapp/jybase v0.0.0-20220415064050-37ce64b3e2d4/go.mod h1:qNRA0sHu
 app.yhyue.com/moapp/jybase v0.0.0-20220418104200-46c3fff161c7/go.mod h1:qNRA0sHuYqcLoYoP8irpaWnW9YsXixe6obBIkwaXpD0=
 app.yhyue.com/moapp/jybase v0.0.0-20220420032112-668025915ee4/go.mod h1:qNRA0sHuYqcLoYoP8irpaWnW9YsXixe6obBIkwaXpD0=
 app.yhyue.com/moapp/jybase v0.0.0-20220421060131-a1001013ba46/go.mod h1:qNRA0sHuYqcLoYoP8irpaWnW9YsXixe6obBIkwaXpD0=
-app.yhyue.com/moapp/jybase v0.0.0-20220526053450-00c4fb8cd746 h1:OSRWZ3Mnb7KobtmMp3NOrwJ6Y2P3/RRspBb5dkBhZJg=
-app.yhyue.com/moapp/jybase v0.0.0-20220526053450-00c4fb8cd746/go.mod h1:qNRA0sHuYqcLoYoP8irpaWnW9YsXixe6obBIkwaXpD0=
+app.yhyue.com/moapp/jybase v0.0.0-20220527014844-2736644c3090 h1:K2FTqMDQkkKvM9t/oqa9MLKciZDngrxDH1OkriDGOZM=
+app.yhyue.com/moapp/jybase v0.0.0-20220527014844-2736644c3090/go.mod h1:qNRA0sHuYqcLoYoP8irpaWnW9YsXixe6obBIkwaXpD0=
 bp.jydev.jianyu360.cn/BP/jynsq v0.0.0-20220222052708-ebc43af90698/go.mod h1:ojo/AUH9Yr1wzarEjOaNMkj1Cet/9r8IgLyba64Z52E=
 bp.jydev.jianyu360.cn/BaseService/gateway v0.0.0-20220419090715-88ddb32961be/go.mod h1:Yj4oabIGItuMoF0BXYLz2XAnF581kxgXBrvlUtIJrkI=
 bp.jydev.jianyu360.cn/BaseService/gateway v0.0.0-20220505015640-56e56f06bc5c h1:p2WctRqfE6wdLPHnACIO983CfYV2LLaaLC2ADpSaNn0=

+ 2 - 2
jyBXBase/rpc/etc/bxbase.yaml

@@ -1,7 +1,7 @@
 Name: bxbase.rpc
-ListenOn: 127.0.0.1:8080
+ListenOn: 127.0.0.1:8005
 Etcd:
   Hosts:
   - 127.0.0.1:2379
   Key: bxbase.rpc
-Webrpcport: 8012
+Webrpcport: 8015

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

@@ -0,0 +1,40 @@
+{
+  "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
+  }
+}

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

@@ -1,32 +0,0 @@
-MysqlMain:
-  dbName: jianyu
-  address: 192.168.3.11:3366
-  userName: root
-  passWord: Topnet123
-  maxOpenConns: 5
-  maxIdleConns: 5
-RedisDB:
-  addr:
-    - other=192.168.3.206:1712
-Es:
-  addr: http://192.168.3.206:9800
-  size: 5
-MongoDb:
-  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
-  Bid:
-    address: 192.168.3.206:27001
-    size: 5
-    dbName: qfw_data
-    collection: bidding
-    collectionChange: bidding_back
-    userName: jyDevGroup
-    passWord: jy@DevGroup

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

@@ -23,7 +23,7 @@ var (
 )
 
 //
-func MongoDBInit(em *entity.MongoDb) {
+func MongoDBInit(em *entity.MongoDB) {
 	//初始化 mongodb
 	if em.Main.Address != "" {
 		logx.Info("--初始化 mongodb--")
@@ -35,14 +35,14 @@ func MongoDBInit(em *entity.MongoDb) {
 		Mgo.InitPool()
 	}
 	//
-	if em.Bid.Address != "" {
+	if em.Bidding.Address != "" {
 		logx.Info("--初始化 mongodb bidding--")
 		MgoBidding = mongodb.MongodbSim{
-			MongodbAddr: em.Bid.Address,
-			Size:        em.Bid.Size,
-			DbName:      em.Bid.DbName,
-			UserName:    em.Bid.UserName,
-			Password:    em.Bid.PassWord,
+			MongodbAddr: em.Bidding.Address,
+			Size:        em.Bidding.Size,
+			DbName:      em.Bidding.DbName,
+			UserName:    em.Bidding.UserName,
+			Password:    em.Bidding.Password,
 		}
 		MgoBidding.InitPool()
 	}
@@ -50,11 +50,11 @@ func MongoDBInit(em *entity.MongoDb) {
 	if em.Ent.Address != "" {
 		logx.Info("--初始化 mongodb ent--")
 		MgoEnt = mongodb.MongodbSim{
-			MongodbAddr: em.Bid.Address,
-			Size:        em.Bid.Size,
-			DbName:      em.Bid.DbName,
-			UserName:    em.Bid.UserName,
-			Password:    em.Bid.PassWord,
+			MongodbAddr: em.Ent.Address,
+			Size:        em.Ent.Size,
+			DbName:      em.Ent.DbName,
+			UserName:    em.Ent.UserName,
+			Password:    em.Ent.Password,
 		}
 		MgoEnt.InitPool()
 	}
@@ -68,7 +68,7 @@ func MysqlInit(em *entity.MysqlStruct) {
 		MainMysql = &mysql.Mysql{
 			Address:      em.Address,
 			UserName:     em.UserName,
-			PassWord:     em.PassWord,
+			PassWord:     em.Password,
 			DBName:       em.DbName,
 			MaxOpenConns: em.MaxOpenConns,
 			MaxIdleConns: em.MaxIdleConns,

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

@@ -27,7 +27,7 @@ func init() {
 	//数据库配置
 	conf.MustLoad(*dbFile, &DB)
 	//初始mongodb
-	MongoDBInit(&DB.MongoDb)
+	MongoDBInit(&DB.MongoDB)
 	//初始化msyql
 	MysqlInit(&DB.MysqlMain)
 	//初始redis

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

@@ -11,8 +11,8 @@ type Config struct {
 }
 
 type Db struct {
-	MysqlMain entity.MysqlStruct
-	RedisDB   entity.RedisDBStuct
-	Es        entity.EsStruct
-	MongoDb   entity.MongoDb
+	MysqlMain entity.MysqlStruct  `json:"mysqlMain"`
+	RedisDB   entity.RedisDBStuct `json:"redisDB"`
+	Es        entity.EsStruct     `json:"es"`
+	MongoDB   entity.MongoDB      `json:"mongoDB"`
 }

+ 2 - 2
jyBXCore/api/etc/bxcore-api.yaml

@@ -1,8 +1,8 @@
 Name: bxcore-api
 Host: 0.0.0.0
-Port: 8002
+Port: 8004
 Timeout: 5000
-Webrpcport: 8012
+Webrpcport: 8014
 Gateway:
   ServerCode: jyinfo
   Etcd:

+ 2 - 2
jyBXCore/api/etc/db.json

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

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

@@ -23,7 +23,7 @@ func MongoDBInit(em *config.Db) {
 			Size:        em.MgoLog.Size,
 			DbName:      em.MgoLog.DbName,
 			UserName:    em.MgoLog.UserName,
-			Password:    em.MgoLog.PassWord,
+			Password:    em.MgoLog.Password,
 		}
 		MgoLog.InitPool()
 	}

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

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

+ 10 - 24
jyBXCore/entity/db.go

@@ -1,35 +1,21 @@
 package entity
 
 type MongoDB struct {
-	Main    *MainMongoDBStruct    `json:"main"`
-	Bidding *BiddingMongoDBStruct `json:"bidding"`
+	Main    *MongoDBStruct `json:"main"`
+	Bidding *MongoDBStruct `json:"bidding"`
 }
 
 //
-type MainMongoDBStruct struct {
-	Address string `json:"address"`
-	Size    int    `json:"size"`
-	DbName  string `json:"dbName"`
-}
-
-//
-type LogMongoDBStruct struct {
-	Address  string `json:"address"`
-	Size     int    `json:"size"`
-	DbName   string `json:"dbName"`
-	UserName string `json:"userName"`
-	PassWord string `json:"passWord"`
-}
-
-//
-type BiddingMongoDBStruct struct {
+type MongoDBStruct struct {
 	Address        string `json:"address"`
 	Size           int    `json:"size"`
 	DbName         string `json:"dbName"`
-	Collection     string `json:"collection"`
-	CollectionBack string `json:"collectionBack"`
-	UserName       string `json:"userName"`
-	PassWord       string `json:"passWord"`
+	UserName       string `json:"userName,optional"`
+	Password       string `json:"password,optional"`
+	Collection     string `json:"collection,optional"`
+	CollectionBack string `json:"collectionBack,optional"`
+	MaxOpenConns   int    `json:"maxOpenConns,optional"`
+	MaxIdleConns   int    `json:"maxIdleConns,optional"`
 }
 
 //
@@ -42,7 +28,7 @@ type MysqlStruct struct {
 	DbName       string `json:"dbName"`
 	Address      string `json:"address"`
 	UserName     string `json:"userName"`
-	PassWord     string `json:"passWord"`
+	Password     string `json:"password"`
 	MaxOpenConns int    `json:"maxOpenConns"`
 	MaxIdleConns int    `json:"maxIdleConns"`
 }

+ 2 - 2
jyBXCore/rpc/etc/db.json

@@ -12,7 +12,7 @@
       "collection": "bidding",
       "collectionBack": "bidding_back",
       "userName": "jyDevGroup",
-      "passWord": "jy@DevGroup"
+      "password": "jy@DevGroup"
     }
   },
   "es": {
@@ -27,7 +27,7 @@
       "dbName": "jianyu",
       "address": "192.168.3.11:3366",
       "userName": "root",
-      "passWord": "Topnet123",
+      "password": "Topnet123",
       "maxOpenConns": 5,
       "maxIdleConns": 5
     }

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

@@ -41,7 +41,7 @@ func MongoDBInit(em *entity.MongoDB) {
 			Size:        em.Bidding.Size,
 			DbName:      em.Bidding.DbName,
 			UserName:    em.Bidding.UserName,
-			Password:    em.Bidding.PassWord,
+			Password:    em.Bidding.Password,
 		}
 		MgoBidding.InitPool()
 	}
@@ -55,7 +55,7 @@ func MysqlInit(mm *entity.Mysql) {
 		MainMysql = &mysql.Mysql{
 			Address:      mm.Main.Address,
 			UserName:     mm.Main.UserName,
-			PassWord:     mm.Main.PassWord,
+			PassWord:     mm.Main.Password,
 			DBName:       mm.Main.DbName,
 			MaxOpenConns: mm.Main.MaxOpenConns,
 			MaxIdleConns: mm.Main.MaxIdleConns,

+ 4 - 2
jyBXSubscribe/api/bxsubscribe.go

@@ -38,8 +38,10 @@ func main() {
 	//全局中间件
 	server.Use(func(next http.HandlerFunc) http.HandlerFunc {
 		return func(w http.ResponseWriter, r *http.Request) {
-			go MC.AddMgoLogs(IC.MgoLog, r, IC.C.MgoLogsName, IC.ExcludeUrl)
-			next(w, r)
+			defer func() {
+				MC.AddMgoLogs(IC.MgoLog, r, IC.C.MgoLogsName, IC.ExcludeUrl, IC.C.MgoLogsCount)
+			}()
+			next.ServeHTTP(w, r)
 		}
 	})
 	handler.RegisterHandlers(server, ctx)

+ 3 - 2
jyBXSubscribe/api/etc/bxsubscribe-api.yaml

@@ -1,7 +1,7 @@
 Name: bxsubscribe-api
 Host: 0.0.0.0
-Port: 8001
-Webrpcport: 8011
+Port: 8002
+Webrpcport: 8012
 Gateway:
   ServerCode: jyinfo
   Etcd:
@@ -13,3 +13,4 @@ Subscribe:
     Key: bxsubscribe.rpc
 AppId: 10000
 MgoLogsName: jybxsubscribe_logs
+MgoLogsCount: 5

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

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

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

@@ -1,6 +0,0 @@
-MgoLog:
-  address: 192.168.3.206:27090
-  size: 5
-  dbName: qfw_data
-  userName: admin
-  passWord: 123456

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

@@ -4,7 +4,6 @@
 package init
 
 import (
-	"app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/mongodb"
 	"github.com/zeromicro/go-zero/core/logx"
 	"jyBXSubscribe/api/internal/config"
@@ -24,7 +23,7 @@ func MongoDBInit(em *config.Db) {
 			Size:        em.MgoLog.Size,
 			DbName:      em.MgoLog.DbName,
 			UserName:    em.MgoLog.UserName,
-			Password:    common.ObjToString(em.MgoLog.PassWord),
+			Password:    em.MgoLog.Password,
 		}
 		MgoLog.InitPool()
 	}

+ 4 - 3
jyBXSubscribe/api/internal/config/config.go

@@ -14,12 +14,13 @@ type Config struct {
 		ServerCode string
 		Etcd       []string
 	}
-	Subscribe   zrpc.RpcClientConf
-	MgoLogsName string
+	Subscribe    zrpc.RpcClientConf
+	MgoLogsName  string
+	MgoLogsCount int
 }
 
 type Db struct {
-	MgoLog entity.LogMongoDBStruct
+	MgoLog entity.MongoDBStruct `json:"mgoLog"`
 }
 
 type Routes struct {

+ 17 - 32
jyBXSubscribe/entity/db.go

@@ -1,44 +1,29 @@
 package entity
 
 type MongoDB struct {
-	Main    *MainMongoDBStruct
-	Log     *LogMongoDBStruct
-	Bidding *BiddingMongoDBStruct
+	Main    *MongoDBStruct `json:"main,omitempty"`
+	Bidding *MongoDBStruct `json:"bidding,omitempty"`
 }
 
 //
-type MainMongoDBStruct struct {
-	Address string `json:"address"`
-	Size    int    `json:"size"`
-	DbName  string `json:"dbName"`
-}
-
-//
-type LogMongoDBStruct struct {
-	Address  string `json:"address"`
-	Size     int    `json:"size"`
-	DbName   string `json:"dbName"`
-	UserName string `json:"userName"`
-	PassWord int64  `json:"passWord"`
-}
-
-//
-type BiddingMongoDBStruct struct {
-	Address          string `json:"address"`
-	Size             int    `json:"size"`
-	DbName           string `json:"dbName"`
-	Collection       string `json:"collection"`
-	CollectionChange string `json:"collectionChange"`
-	UserName         string `json:"userName"`
-	PassWord         string `json:"passWord"`
+type MongoDBStruct struct {
+	Address        string `json:"address"`
+	Size           int    `json:"size"`
+	DbName         string `json:"dbName"`
+	UserName       string `json:"userName,optional"`
+	Password       string `json:"password,optional"`
+	Collection     string `json:"collection,optional"`
+	CollectionBack string `json:"collectionBack,optional"`
+	MaxOpenConns   int    `json:"maxOpenConns,optional"`
+	MaxIdleConns   int    `json:"maxIdleConns,optional"`
 }
 
 //
 type Mysql struct {
-	Main         *MysqlStruct
-	Push         *MysqlStruct
-	MemberPush   *MysqlStruct
-	EntnichePush *MysqlStruct
+	Main         *MysqlStruct `json:"main,omitempty"`
+	Push         *MysqlStruct `json:"push,omitempty"`
+	MemberPush   *MysqlStruct `json:"memberPush,omitempty"`
+	EntnichePush *MysqlStruct `json:"entnichePush,omitempty"`
 }
 
 //mysql
@@ -46,7 +31,7 @@ type MysqlStruct struct {
 	DbName       string `json:"dbName"`
 	Address      string `json:"address"`
 	UserName     string `json:"userName"`
-	PassWord     string `json:"passWord"`
+	Password     string `json:"password"`
 	MaxOpenConns int    `json:"maxOpenConns"`
 	MaxIdleConns int    `json:"maxIdleConns"`
 }

+ 1 - 1
jyBXSubscribe/go.mod

@@ -3,7 +3,7 @@ module jyBXSubscribe
 go 1.16
 
 require (
-	app.yhyue.com/moapp/jybase v0.0.0-20220526053450-00c4fb8cd746
+	app.yhyue.com/moapp/jybase v0.0.0-20220527014844-2736644c3090
 	bp.jydev.jianyu360.cn/BaseService/gateway v0.0.0-20220505015640-56e56f06bc5c
 	github.com/go-sql-driver/mysql v1.6.0
 	github.com/golang/protobuf v1.5.2

+ 2 - 2
jyBXSubscribe/go.sum

@@ -4,8 +4,8 @@ app.yhyue.com/moapp/jybase v0.0.0-20220415064050-37ce64b3e2d4/go.mod h1:qNRA0sHu
 app.yhyue.com/moapp/jybase v0.0.0-20220418104200-46c3fff161c7/go.mod h1:qNRA0sHuYqcLoYoP8irpaWnW9YsXixe6obBIkwaXpD0=
 app.yhyue.com/moapp/jybase v0.0.0-20220420032112-668025915ee4/go.mod h1:qNRA0sHuYqcLoYoP8irpaWnW9YsXixe6obBIkwaXpD0=
 app.yhyue.com/moapp/jybase v0.0.0-20220421060131-a1001013ba46/go.mod h1:qNRA0sHuYqcLoYoP8irpaWnW9YsXixe6obBIkwaXpD0=
-app.yhyue.com/moapp/jybase v0.0.0-20220526053450-00c4fb8cd746 h1:OSRWZ3Mnb7KobtmMp3NOrwJ6Y2P3/RRspBb5dkBhZJg=
-app.yhyue.com/moapp/jybase v0.0.0-20220526053450-00c4fb8cd746/go.mod h1:qNRA0sHuYqcLoYoP8irpaWnW9YsXixe6obBIkwaXpD0=
+app.yhyue.com/moapp/jybase v0.0.0-20220527014844-2736644c3090 h1:K2FTqMDQkkKvM9t/oqa9MLKciZDngrxDH1OkriDGOZM=
+app.yhyue.com/moapp/jybase v0.0.0-20220527014844-2736644c3090/go.mod h1:qNRA0sHuYqcLoYoP8irpaWnW9YsXixe6obBIkwaXpD0=
 bp.jydev.jianyu360.cn/BP/jynsq v0.0.0-20220222052708-ebc43af90698/go.mod h1:ojo/AUH9Yr1wzarEjOaNMkj1Cet/9r8IgLyba64Z52E=
 bp.jydev.jianyu360.cn/BaseService/gateway v0.0.0-20220419090715-88ddb32961be/go.mod h1:Yj4oabIGItuMoF0BXYLz2XAnF581kxgXBrvlUtIJrkI=
 bp.jydev.jianyu360.cn/BaseService/gateway v0.0.0-20220505015640-56e56f06bc5c h1:p2WctRqfE6wdLPHnACIO983CfYV2LLaaLC2ADpSaNn0=

+ 2 - 2
jyBXSubscribe/rpc/etc/bxsubscribe.yaml

@@ -1,7 +1,7 @@
 Name: bxsubscribe.rpc
-ListenOn: 0.0.0.0:8080
+ListenOn: 0.0.0.0:8001
 Etcd:
   Hosts:
   - 127.0.0.1:2379
   Key: bxsubscribe.rpc
-Webrpcport: 8014
+Webrpcport: 8011

+ 59 - 0
jyBXSubscribe/rpc/etc/db.json

@@ -0,0 +1,59 @@
+{
+  "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
+    },
+    "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
+    }
+  }
+}

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

@@ -1,58 +0,0 @@
-
-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
-RedisDB:
-  addr:
-    - other=192.168.3.206:1712
-    - pushcache_1=192.168.3.206:5000
-    - pushcache_2_a=192.168.3.206:5001
-    - pushcache_2_b=192.168.3.206:5002
-Es:
-  addr: http://192.168.3.206:9800
-  size: 5
-MongoDB:
-  Main:
-    address: 192.168.3.206:27080
-    size: 5
-    dbName: qfw
-  Log:
-    address: 192.168.3.206:27090
-    size: 5
-    dbName: qfw_data
-    userName: admin
-    passWord: 123456
-  Bidding:
-    address: 192.168.3.206:27001
-    size: 5
-    dbName: qfw_data
-    collection: bidding
-    collectionChange: bidding_back
-    userName: jyDevGroup
-    passWord: jy@DevGroup

+ 5 - 18
jyBXSubscribe/rpc/init/db.go

@@ -4,7 +4,6 @@
 package init
 
 import (
-	"app.yhyue.com/moapp/jybase/common"
 	"github.com/zeromicro/go-zero/core/logx"
 	"strings"
 
@@ -39,18 +38,6 @@ func MongoDBInit(em *entity.MongoDB) {
 		Mgo.InitPool()
 	}
 	//
-	if em.Log.Address != "" {
-		logx.Info("--初始化 mongodb log--")
-		MgoLog = mongodb.MongodbSim{
-			MongodbAddr: em.Log.Address,
-			Size:        em.Log.Size,
-			DbName:      em.Log.DbName,
-			UserName:    em.Log.UserName,
-			Password:    common.ObjToString(em.Log.PassWord),
-		}
-		MgoLog.InitPool()
-	}
-	//
 	if em.Bidding.Address != "" {
 		logx.Info("--初始化 mongodb bidding--")
 		MgoBidding = mongodb.MongodbSim{
@@ -58,7 +45,7 @@ func MongoDBInit(em *entity.MongoDB) {
 			Size:        em.Bidding.Size,
 			DbName:      em.Bidding.DbName,
 			UserName:    em.Bidding.UserName,
-			Password:    em.Bidding.PassWord,
+			Password:    em.Bidding.Password,
 		}
 		MgoBidding.InitPool()
 	}
@@ -72,7 +59,7 @@ func MysqlInit(mm *entity.Mysql) {
 		MainMysql = &mysql.Mysql{
 			Address:      mm.Main.Address,
 			UserName:     mm.Main.UserName,
-			PassWord:     mm.Main.PassWord,
+			PassWord:     mm.Main.Password,
 			DBName:       mm.Main.DbName,
 			MaxOpenConns: mm.Main.MaxOpenConns,
 			MaxIdleConns: mm.Main.MaxIdleConns,
@@ -85,7 +72,7 @@ func MysqlInit(mm *entity.Mysql) {
 		PushMysql = &mysql.Mysql{
 			Address:      mm.Push.Address,
 			UserName:     mm.Push.UserName,
-			PassWord:     mm.Push.PassWord,
+			PassWord:     mm.Push.Password,
 			DBName:       mm.Push.DbName,
 			MaxOpenConns: mm.Push.MaxOpenConns,
 			MaxIdleConns: mm.Push.MaxIdleConns,
@@ -98,7 +85,7 @@ func MysqlInit(mm *entity.Mysql) {
 		MemberPushMysql = &mysql.Mysql{
 			Address:      mm.MemberPush.Address,
 			UserName:     mm.MemberPush.UserName,
-			PassWord:     mm.MemberPush.PassWord,
+			PassWord:     mm.MemberPush.Password,
 			DBName:       mm.MemberPush.DbName,
 			MaxOpenConns: mm.MemberPush.MaxOpenConns,
 			MaxIdleConns: mm.MemberPush.MaxIdleConns,
@@ -111,7 +98,7 @@ func MysqlInit(mm *entity.Mysql) {
 		EntnichePushMysql = &mysql.Mysql{
 			Address:      mm.EntnichePush.Address,
 			UserName:     mm.EntnichePush.UserName,
-			PassWord:     mm.EntnichePush.PassWord,
+			PassWord:     mm.EntnichePush.Password,
 			DBName:       mm.EntnichePush.DbName,
 			MaxOpenConns: mm.EntnichePush.MaxOpenConns,
 			MaxIdleConns: mm.EntnichePush.MaxIdleConns,

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

@@ -9,13 +9,13 @@ import (
 	"jyBXSubscribe/rpc/internal/config"
 )
 
-var configF = flag.String("f", "etc/bxsubscribe.yaml", "the config file")
+var configF = flag.String("cf", "etc/bxsubscribe.yaml", "the config file")
 
 var C config.Config
 var err error
 
 //
-var dbFile = flag.String("d", "etc/db.json", "the db file")
+var dbFile = flag.String("df", "etc/db.json", "the db file")
 var DB config.Db
 
 //

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

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

+ 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.CollectionChange, //招标信息备份数据 表名
-		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.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,                        //是否有附件
 	}
 	if in.UserType == "mType" {
 		spqp.PushMysql = IC.MemberPushMysql