xuzhiheng 4 years ago
parent
commit
52dbea7ffb
5 changed files with 17 additions and 13 deletions
  1. 6 6
      customerdata/src/config.json
  2. 1 0
      customerdata/src/util/mgodb/mgo.go
  3. 1 1
      src/config.json
  4. 7 6
      src/util/config.go
  5. 2 0
      src/util/mgodb/mgo.go

+ 6 - 6
customerdata/src/config.json

@@ -10,18 +10,18 @@
     "db": "mixdata",
     "hospcoll": "buyer_rank",
     "size": 15,
-    "username": "jyDevGroup",
-    "password": "jy@DevGroup",
-    "replSet": "mixdata"
+    "username": "JS3Z_Rbid_ProG",
+    "password": "JS3Z@B5I3aR7Ch",
+    "replSet": ""
   },
   "enterprise": {
     "addr": "192.168.3.207:27001,192.168.3.206:27002",
     "coll": "qyxy_std",
     "db": "mixdata",
     "size": 15,
-    "username": "jyDevGroup",
-    "password": "jy@DevGroup",
-    "replSet": "mixdata"
+    "username": "JS3Z_Rbid_ProG",
+    "password": "JS3Z@B5I3aR7Ch",
+    "replSet": ""
   },
   "save": {
     "addr": "192.168.3.128:27080",

+ 1 - 0
customerdata/src/util/mgodb/mgo.go

@@ -150,6 +150,7 @@ func (m *MongodbSim) InitPool() {
 	opts.SetConnectTimeout(3 * time.Second)
 	opts.ApplyURI("mongodb://" + m.MongodbAddr)
 	opts.SetMaxPoolSize(uint64(m.Size))
+	opts.SetHosts(strings.Split(m.MongodbAddr, ","))
 	if m.ReplSet != "" {
 		opts.SetReplicaSet(m.ReplSet)
 		opts.SetDirect(false)

+ 1 - 1
src/config.json

@@ -1,5 +1,5 @@
 {
-  "port": "7000",
+  "port": "7001",
   "udpport": ":11117",
   "mgodb": "192.168.3.207:27092",
   "dbsize": 5,

+ 7 - 6
src/util/config.go

@@ -2,8 +2,6 @@ package util
 
 import (
 	"bytes"
-	"golang.org/x/text/encoding/simplifiedchinese"
-	"golang.org/x/text/transform"
 	"io/ioutil"
 	"qfw/mongodb"
 	qu "qfw/util"
@@ -13,6 +11,9 @@ import (
 	"sort"
 	"util/chain-zhang/pinyin"
 	mgo "util/mgodb"
+
+	"golang.org/x/text/encoding/simplifiedchinese"
+	"golang.org/x/text/transform"
 )
 
 var (
@@ -63,10 +64,10 @@ var (
 	MatchTypeMap  *[]map[string]interface{} //匹配方式
 	MatchTypeMap2 map[string]interface{}    //匹配方式
 	MatchTypeMap3 *[]map[string]interface{} //匹配方式
-	ExistFiled *[]map[string]interface{}    //存在的字段
+	ExistFiled    *[]map[string]interface{} //存在的字段
 	ScopeClassMap *[]map[string]interface{} //公告行业
-	TagFieldMap *[]map[string]interface{}   //标签属性值
-	TaskTypeMap *[]map[string]interface{}   //任务类型
+	TagFieldMap   *[]map[string]interface{} //标签属性值
+	TaskTypeMap   *[]map[string]interface{} //任务类型
 	BuryClassType map[string]interface{}
 	ProvinceMap   map[string]interface{}
 )
@@ -108,7 +109,7 @@ func InitOther() {
 	initScopeClass()
 	initTaskType()
 	initEs()
-	initMgoEn()
+	// initMgoEn()
 	Subday = qu.Float64All(Sysconfig["subday"])
 	PreviewHref = qu.ObjToString(Sysconfig["preview_href"])
 	initTagField()

+ 2 - 0
src/util/mgodb/mgo.go

@@ -3,6 +3,7 @@ package mongodb
 import (
 	"context"
 	"log"
+	"strings"
 	"time"
 
 	"go.mongodb.org/mongo-driver/bson"
@@ -150,6 +151,7 @@ func (m *MongodbSim) InitPool() {
 	opts.SetConnectTimeout(3 * time.Second)
 	opts.ApplyURI("mongodb://" + m.MongodbAddr)
 	opts.SetMaxPoolSize(uint64(m.Size))
+	opts.SetHosts(strings.Split(m.MongodbAddr, ","))
 	if m.ReplSet != "" {
 		opts.SetReplicaSet(m.ReplSet)
 		opts.SetDirect(false)