Răsfoiți Sursa

feat:最新标讯

wangshan 3 ani în urmă
părinte
comite
9416cd3bd2
2 a modificat fișierele cu 19 adăugiri și 17 ștergeri
  1. 4 4
      jyBXBase/rpc/etc/db.yaml
  2. 15 13
      jyBXBase/rpc/model/newestBidding.go

+ 4 - 4
jyBXBase/rpc/etc/db.yaml

@@ -36,17 +36,17 @@ es:
 mongo:
     main:
         dbName: qfw
-        size: 5
+        size: 50
         address: 192.168.3.206:27080
     ent:
         dbName: mixdata
-        size: 5
+        size: 50
         address: 192.168.3.206:27001
         userName: jyDevGroup
         password: DevGroup
     bidding:
-        address: 192.168.3.206:27001
-        size: 5
+        address: 192.168.3.207:27001,192.168.3.206:27002
+        size: 50
         dbName: qfw_data
         collection: bidding
         collectionChange: bidding_back

+ 15 - 13
jyBXBase/rpc/model/newestBidding.go

@@ -5,6 +5,7 @@ import (
 	ME "app.yhyue.com/moapp/jybase/encrypt"
 	elastic "app.yhyue.com/moapp/jybase/esv1"
 	"app.yhyue.com/moapp/jybase/mongodb"
+	"app.yhyue.com/moapp/jybase/mysql"
 	"fmt"
 	"github.com/zeromicro/go-zero/core/logx"
 	"go.mongodb.org/mongo-driver/bson/primitive"
@@ -29,6 +30,7 @@ const (
 type NewestInfo struct {
 	TableName string
 	UserId    string
+	MysqlDb   *mysql.Mysql
 }
 
 var mysqlTables = map[string]string{
@@ -39,21 +41,22 @@ var mysqlTables = map[string]string{
 }
 
 func GetNewestInfo(userId, userType string) *NewestInfo {
-	return &NewestInfo{
+	nt := &NewestInfo{
 		UserId:    userId,
 		TableName: mysqlTables[userType],
+		MysqlDb:   IC.PushMysql,
 	}
+	switch userType {
+	case "m":
+		nt.MysqlDb = IC.BigmemberPushMysql
+	case "e":
+		nt.MysqlDb = IC.EntnichePushMysql
+	}
+	return nt
 }
 func (n *NewestInfo) GetPushHistory() (res []*bxbase.NewestList) {
 	findSQL := "select infoid,matchkeys,attachment_count,budget,bidamount from " + n.TableName + " where userid = '" + n.UserId + "'  and date >= %d order by id desc limit 50"
-	list := &[]map[string]interface{}{}
-	if n.TableName == "pushmember" { //大会员
-		list = IC.BigmemberPushMysql.SelectBySql(fmt.Sprintf(findSQL, time.Now().AddDate(0, 0, -7).Unix()))
-	} else if n.TableName == "pushentniche" { //商机管理
-		list = IC.EntnichePushMysql.SelectBySql(fmt.Sprintf(findSQL, time.Now().AddDate(0, 0, -7).Unix()))
-	} else {
-		list = IC.PushMysql.SelectBySql(fmt.Sprintf(findSQL, time.Now().AddDate(0, 0, -7).Unix()))
-	}
+	list := n.MysqlDb.SelectBySql(fmt.Sprintf(findSQL, time.Now().AddDate(0, 0, -7).Unix()))
 	if len(*list) > 0 {
 		m := map[string]bool{}
 		es_ids := []string{}
@@ -95,9 +98,8 @@ func (n *NewestInfo) GetPushHistory() (res []*bxbase.NewestList) {
 		//mongodb bidding
 		mgo_ids := []primitive.ObjectID{}
 		for _, v := range es_ids {
-			if infos[v] == nil {
-				_id, _ := primitive.ObjectIDFromHex(v)
-				mgo_ids = append(mgo_ids, _id)
+			if infos[v].Title == "" {
+				mgo_ids = append(mgo_ids, mongodb.StringTOBsonId(v))
 			}
 		}
 		if len(mgo_ids) > 0 {
@@ -121,7 +123,7 @@ func (n *NewestInfo) GetPushHistory() (res []*bxbase.NewestList) {
 		//mongodb bidding_back
 		mgo_back_ids := []primitive.ObjectID{}
 		for _, v := range mgo_ids {
-			if infos[mongodb.BsonIdToSId(v)] == nil {
+			if infos[mongodb.BsonIdToSId(v)].Title == "" {
 				mgo_back_ids = append(mgo_back_ids, v)
 			}
 		}