Przeglądaj źródła

分发数据保存修改

WH01243 2 lat temu
rodzic
commit
8de6c34b4c

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

@@ -13,6 +13,13 @@ mysql:
         password: '=PDT49#80Z!RVv52_z'
         maxOpenConns: 80
         maxIdleConns: 5
+    push:
+        dbName: push
+        address: 192.168.3.14:4000
+        userName: root
+        password: '=PDT49#80Z!RVv52_z'
+        maxOpenConns: 5
+        maxIdleConns: 5
 redis:
     addr:
         - other=192.168.3.206:1712

+ 14 - 0
jyBXBase/rpc/init/db.go

@@ -17,6 +17,7 @@ import (
 var (
 	MainMysql        *mysql.Mysql
 	BaseServiceMysql *mysql.Mysql
+	PushMysql        *mysql.Mysql
 	Mgo              mongodb.MongodbSim
 	MgoEnt           mongodb.MongodbSim
 	MgoBidding       mongodb.MongodbSim
@@ -102,6 +103,19 @@ func MysqlInit(em *entity.Mysql) {
 		}
 		MainMysql.Init()
 	}
+	//初始化 mysql-push
+	if em.Push.Address != "" {
+		logx.Info("--初始化 push mysql--")
+		PushMysql = &mysql.Mysql{
+			Address:      em.Push.Address,
+			UserName:     em.Push.UserName,
+			PassWord:     em.Push.Password,
+			DBName:       em.Push.DbName,
+			MaxOpenConns: em.Push.MaxOpenConns,
+			MaxIdleConns: em.Push.MaxIdleConns,
+		}
+		PushMysql.Init()
+	}
 	if em.BaseService.Address != "" {
 		logx.Info("--初始化 BaseServiceMysql tidb--")
 		BaseServiceMysql = &mysql.Mysql{

+ 4 - 2
jyBXBase/rpc/model/newestBidding.go

@@ -35,6 +35,7 @@ type NewestInfo struct {
 	UserId    string
 	MysqlDb   *mysql.Mysql
 	NewUserId int64
+	PushMysql *mysql.Mysql
 }
 
 var mysqlTables = map[string]string{
@@ -50,14 +51,15 @@ func GetNewestInfo(userId, userType string, newUserId int64) *NewestInfo {
 		TableName: mysqlTables[userType],
 		MysqlDb:   IC.BaseServiceMysql,
 		NewUserId: newUserId,
+		PushMysql: IC.PushMysql,
 	}
 	return nt
 }
 func (n *NewestInfo) GetPushHistory() (res []*bxbase.NewestList) {
-	findSQL := "select a.infoid,a.matchkeys,b.isvalidfile as attachment_count,b.budget,b.bidamount from %s a INNER JOIN %s b ON a.userid=%d and a.date>=%d and a.infoid=b.infoid order by a.id desc limit 50"
+	findSQL := "select a.infoid,a.matchkeys,a.attachment_count,a.budget,a.bidamount from %s a  order by a.id desc limit 50"
 	findSQL = fmt.Sprintf(findSQL, n.TableName, Pushbidding, n.NewUserId, time.Now().AddDate(0, 0, -7).Unix())
 	logx.Info(n.TableName, "-------", n.NewUserId, ",findSQL:", findSQL)
-	list := n.MysqlDb.SelectBySql(findSQL)
+	list := n.PushMysql.SelectBySql(findSQL)
 	if len(*list) > 0 && list != nil {
 		m := map[string]bool{}
 		es_ids := []string{}

+ 0 - 9
jyBXSubscribe/rpc/init/init.go

@@ -48,14 +48,5 @@ func InitC() {
 			logx.Info(v, "--日志记录")
 		}
 	}
-	/*//代码表服务加载
-	codeClient := zrpc.MustNewClient(zrpc.RpcClientConf{
-		Etcd: discov.EtcdConf{
-			Hosts: C.CodeServiceConf.Etcd.Hosts,
-			Key:   C.CodeServiceConf.Etcd.Key,
-		},
-	})
-	logx.Info("CodeService初始化")
-	CodeLib = codePb.NewCodeService(codeClient)*/
 	PushMapping.Init()
 }

+ 2 - 2
jyBXSubscribe/rpc/internal/logic/msgdistributorlogic.go

@@ -86,8 +86,8 @@ func (l *MsgDistributorLogic) MsgDistributor(in *bxsubscribe.MsgDistributorReq)
 	}
 	//分发数据库修改
 	ok := IC.PushMysql.ExecTx("分发数据库修改", func(tx *sql.Tx) bool {
-		insertRow := []string{"entid", "deptid", "infoid", "matchkeys", "type", "product", "matchways", "matchitems", "disid", "source", "date", "userid", "isvisit", "visittime", "pid"}
-		msgItems := []string{"entid", "deptid", "infoid", "matchkeys", "type", "product", "matchways", "matchitems", "disid"}
+		insertRow := []string{"entid", "deptid", "infoid", "matchkeys", "type", "product", "matchways", "matchitems", "disid", "area", "city", "buyerclass", "toptype", "subtype", "subscopeclass", "budget", "bidamount", "attachment_count", "source", "date", "userid", "isvisit", "visittime", "pid"}
+		msgItems := []string{"entid", "deptid", "infoid", "matchkeys", "type", "product", "matchways", "matchitems", "disid", "area", "city", "buyerclass", "toptype", "subtype", "subscopeclass", "budget", "bidamount", "attachment_count"}
 		dateNew := time.Now().Unix()
 		for _, m := range *msgRes {
 			var msgValues, insertValue []interface{}

+ 0 - 1
jyBXSubscribe/rpc/model/push.go

@@ -520,7 +520,6 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
 				}
 			}
 		}
-
 		if spqp.IsEnt {
 			var staffs []string
 			userStr += fmt.Sprintf(" and  a.entid='%s' ", spqp.EntId)