瀏覽代碼

Merge branch 'dev/v1.1.51_dx' of BaseService/jyMicroservices into feature/v1.1.51

duxin 1 年之前
父節點
當前提交
f08a552efb

+ 12 - 0
jyBXBase/rpc/internal/logic/addsearchlogic.go

@@ -53,6 +53,18 @@ func (l *AddSearchLogic) AddSearch(in *bxbase.AddSearchReq) (res *bxbase.CommonR
 		if ValueSort(util.TopTypesLeadingProject) == in.Subtype {
 			in.Subtype = ""
 		}
+	case util.SearchGroupAnnouncementProject:
+		if in.Subtype == "" {
+			in.Subtype = "招标公告"
+		}
+	case util.SearchGroupForetellProject:
+		if in.Subtype == "" {
+			in.Subtype = "招标预告"
+		}
+	case util.SearchGroupResultProject:
+		if in.Subtype == "" {
+			in.Subtype = "招标结果"
+		}
 	}
 	newData["keywords"] = in.Keywords
 	newData["type"] = in.Type

+ 17 - 2
jyBXBase/rpc/internal/logic/checksearchlogic.go

@@ -80,10 +80,25 @@ func (l *CheckSearchLogic) CheckSearch(in *bxbase.AddSearchReq) (res *bxbase.Che
 		if ValueSort(util.TopTypesLeadingProject) == in.Subtype {
 			in.Subtype = ""
 		}
+	case util.SearchGroupAnnouncementProject:
+		if in.Subtype == "" {
+			in.Subtype = "招标公告"
+		}
+	case util.SearchGroupForetellProject:
+		if in.Subtype == "" {
+			in.Subtype = "招标预告"
+		}
+	case util.SearchGroupResultProject:
+		if in.Subtype == "" {
+			in.Subtype = "招标结果"
+		}
+	}
+	switch in.SearchGroup {
+	case 3, 4, 5: //移动栏目 去重统一字段
+		in.SearchGroup = 1
 	}
-
 	inMap := common.StructToMapMore(in)
-	areaArr := []string{}
+	var areaArr []string
 	for k, v := range in.RegionMap {
 		if v.Area == nil {
 			areaArr = append(areaArr, fmt.Sprintf("%s_%s_%s", k, "", ""))

+ 10 - 7
jyBXBase/rpc/util/common.go

@@ -19,13 +19,16 @@ import (
 )
 
 const (
-	query                     = `{"query":{"terms":{"_id":["%s"]}},"_source":["_id","subtype","s_winner","buyertel","winnertel","buyerclass"],"from":0,"size":%d}`
-	mongodb_fields            = `{"_id":1,"area":1,"publishtime":1,"s_subscopeclass":1,"subtype":1,"title":1,"toptype":1,"type":1, "buyerclass":1,"budget":1,"bidamount":1,"winnertel":1,"s_winner":1,"buyertel":1,"attach_text":1}`
-	querys                    = `{"query":{"terms":{"_id":["%s"]}},"_source":["_id","title","detail","area","city","publishtime","projectname","buyer","buyerclass","s_winner","bidamount","subtype","toptype","projectcode","buyertel","budget","bidopentime","agency","projectscope","winnerperson","winnertel"],"from":0,"size":%d}}`
-	SearchGroupBidding        = 1 // 搜索分组:1:招标采购公告;2:超前项目
-	SearchGroupLeadingProject = 2 // 搜索分组:1:招标采购公告;2:超前项目
-	TopTypesBidding           = "招标预告,招标公告,招标结果,招标信用信息"
-	TopTypesLeadingProject    = "拟建,采购意向"
+	query                          = `{"query":{"terms":{"_id":["%s"]}},"_source":["_id","subtype","s_winner","buyertel","winnertel","buyerclass"],"from":0,"size":%d}`
+	mongodb_fields                 = `{"_id":1,"area":1,"publishtime":1,"s_subscopeclass":1,"subtype":1,"title":1,"toptype":1,"type":1, "buyerclass":1,"budget":1,"bidamount":1,"winnertel":1,"s_winner":1,"buyertel":1,"attach_text":1}`
+	querys                         = `{"query":{"terms":{"_id":["%s"]}},"_source":["_id","title","detail","area","city","publishtime","projectname","buyer","buyerclass","s_winner","bidamount","subtype","toptype","projectcode","buyertel","budget","bidopentime","agency","projectscope","winnerperson","winnertel"],"from":0,"size":%d}}`
+	SearchGroupBidding             = 1 // 搜索分组:1:招标采购公告;2:超前项目
+	SearchGroupLeadingProject      = 2 // 搜索分组:1:招标采购公告;2:超前项目
+	SearchGroupAnnouncementProject = 3 // 搜索分组:招标公告
+	SearchGroupForetellProject     = 4 // 搜索分组:招标预告
+	SearchGroupResultProject       = 5 // 搜索分组:招标结果
+	TopTypesBidding                = "招标预告,招标公告,招标结果,招标信用信息"
+	TopTypesLeadingProject         = "拟建,采购意向"
 )
 
 // 是否是付费用户 -bool: true:是 fasle:不是

+ 8 - 0
jyBXCore/api/bxcore.api

@@ -207,6 +207,12 @@ type (
 		PageSize        int64    `json:"pageSize,optional"`        //
 		PageNum         int64    `json:"pageNum,optional"`         //
 	}
+
+	mobileHotWordReq {
+		AppId   string `header:"appId"`
+		UserId  string `header:"userId,optional"`
+		Refresh int64  `json:"refresh,optional"`
+	}
 )
 service bxcore-api {
 	@handler searchList
@@ -241,4 +247,6 @@ service bxcore-api {
 	post /jybx/core/statistics/projectDetails (ProjectDetailReq) returns (commonResp)
 	@handler searchCriteria //物业搜索条件返回
 	post /jybx/core/property/searchCriteria () returns (commonResp)
+	@handler mobileHotWord
+	post /jybx/core/mobileHotWord (mobileHotWordReq) returns (commonResp)
 }

File diff suppressed because it is too large
+ 2 - 0
jyBXCore/api/etc/bxcore-api.yaml


+ 6 - 1
jyBXCore/api/etc/db.yaml

@@ -4,4 +4,9 @@ mongo:
         size: 5
         dbName: qfw
         userName: admin
-        password: "123456"
+        password: "123456"
+
+redis:
+    addr:
+        - other=192.168.3.149:1712
+        - newother=192.168.3.149:1712

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

@@ -5,8 +5,11 @@ package init
 
 import (
 	"app.yhyue.com/moapp/jybase/mongodb"
-	"log"
+	"app.yhyue.com/moapp/jybase/redis"
+	"github.com/zeromicro/go-zero/core/logx"
 	"jyBXCore/entity"
+	"log"
+	"strings"
 )
 
 var (
@@ -27,3 +30,11 @@ func MongoDBInit(em *entity.Mongo) {
 		MgoLog.InitPool()
 	}
 }
+
+func RedisInit(rm *entity.RedisStuct) {
+	//初始化 redis
+	if len(rm.Addr) > 0 {
+		logx.Info("--初始化 redis--")
+		redis.InitRedisBySize(strings.Join(rm.Addr, ","), 100, 30, 300)
+	}
+}

+ 42 - 0
jyBXCore/api/init/init.go

@@ -7,6 +7,7 @@ import (
 	"jyBXCore/api/internal/config"
 	"log"
 	"regexp"
+	"time"
 )
 
 var configFile = flag.String("cf", "etc/bxcore-api.yaml", "the config file")
@@ -20,12 +21,16 @@ var routesFile = flag.String("rf", "etc/routes.yaml", "the routes file")
 var Routes config.Routes
 var ExcludeUrl = []*regexp.Regexp{}
 
+var HotKeyArrLoginEd, HotKeyArrUnLogin []string
+
 func init() {
 	log.Println("初始化配置")
 	//读取基础配置
 	conf.MustLoad(*configFile, &C)
 	//读取数据库配置
 	conf.MustLoad(*dbFile, &DB)
+	//初始redis
+	RedisInit(&DB.Redis)
 	//初始mongodb
 	MongoDBInit(&DB.Mongo)
 	//读取路由配置
@@ -35,4 +40,41 @@ func init() {
 			ExcludeUrl = append(ExcludeUrl, regexp.MustCompile(MC.ObjToString(v)))
 		}
 	}
+	// 每隔5分钟更新一次随机词
+	go func() {
+		HotKeyArrLoginEd, HotKeyArrUnLogin = GetIndexHotKey(), getIndexHotKeyNoLoginFunc()
+		for range time.NewTicker(300 * time.Second).C {
+			HotKeyArrLoginEd, HotKeyArrUnLogin = GetIndexHotKey(), getIndexHotKeyNoLoginFunc()
+		}
+	}()
+}
+
+var getIndexHotKeyNoLoginFunc = func() (loginEd []string) {
+	// 定义一个函数,用于从数组words中随机取出几个词
+	m := map[string]bool{}
+	for _, v := range C.MobileIndexHotKeyUnLogin {
+		m[v] = true
+	}
+	for key, _ := range m {
+		loginEd = append(loginEd, key)
+		if len(loginEd) == int(C.MobileIndexHotKeyLimit) {
+			break
+		}
+	}
+	return
+}
+
+func GetIndexHotKey() (loginEd []string) {
+	// 定义一个函数,用于从数组words中随机取出几个词
+	m := map[string]bool{}
+	for _, v := range C.MobileIndexHotKey {
+		m[v] = true
+	}
+	for key, _ := range m {
+		loginEd = append(loginEd, key)
+		if len(loginEd) == int(C.MobileIndexHotKeyLimit) {
+			break
+		}
+	}
+	return
 }

+ 11 - 7
jyBXCore/api/internal/config/config.go

@@ -13,16 +13,20 @@ type Config struct {
 		ServerCode string
 		Etcd       []string
 	}
-	Core            zrpc.RpcClientConf
-	MgoLogsName     string
-	MgoLogsCount    int
-	DetailMosaicTxt string
-	SearchMosaic    map[string]bool
-	SearchLog       SaveLogConfig
+	Core                     zrpc.RpcClientConf
+	MgoLogsName              string
+	MgoLogsCount             int
+	DetailMosaicTxt          string
+	SearchMosaic             map[string]bool
+	SearchLog                SaveLogConfig
+	MobileIndexHotKeyLimit   int64
+	MobileIndexHotKeyUnLogin []string
+	MobileIndexHotKey        []string
 }
 
 type Db struct {
-	Mongo entity.Mongo `json:"mongo"`
+	Mongo entity.Mongo      `json:"mongo"`
+	Redis entity.RedisStuct `json:"redis"`
 }
 
 type Routes struct {

+ 5 - 0
jyBXCore/api/internal/handler/routes.go

@@ -92,6 +92,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
 				Path:    "/jybx/core/property/searchCriteria",
 				Handler: searchCriteriaHandler(serverCtx),
 			},
+			{
+				Method:  http.MethodPost,
+				Path:    "/jybx/core/mobileHotWord",
+				Handler: mobileHotWordHandler(serverCtx),
+			},
 		},
 	)
 }

+ 6 - 0
jyBXCore/api/internal/types/types.go

@@ -203,3 +203,9 @@ type ProjectDetailReq struct {
 	PageSize        int64    `json:"pageSize,optional"`        //
 	PageNum         int64    `json:"pageNum,optional"`         //
 }
+
+type MobileHotWordReq struct {
+	AppId   string `header:"appId"`
+	UserId  string `header:"userId,optional"`
+	Refresh int64  `json:"refresh,optional"`
+}

+ 2 - 1
jyBXCore/rpc/entity/search.go

@@ -191,7 +191,8 @@ func (kws *KeyWordsSearch) SearchParamsHandle(in *bxcore.SearchReq) []string {
 	in.SelectType = strings.Join(queryItems, ",")
 	// in.SearchGroup 搜索分组 搜索分组:默认0:全部;1:招标采购公告;2:超前项目
 	//	详情页判断是否能使用超前项目  老版超级订阅、大会员、商机管理有权限
-	if in.SearchGroup < 0 || in.SearchGroup > 2 {
+	//P494 移动端取消招标搜索 部分栏目外化 3 招标预告 4招标公告 5 招标结果
+	if in.SearchGroup < 0 || in.SearchGroup > 5 {
 		in.SearchGroup = 1
 	}
 	//信息类型

+ 3 - 0
jyBXCore/rpc/etc/bxcore.yaml

@@ -40,6 +40,9 @@ DefaultBidInfo: #默认搜索
 DefaultTopTypes:
   - 招标预告,招标公告,招标结果,招标信用信息
   - 拟建,采购意向
+  - 招标预告
+  - 招标公告
+  - 招标结果
 JYKeyMark: " "
 ContextOldVipLimit: 1664553600
 Middleground:

+ 1 - 1
jyBXCore/rpc/internal/logic/getsearchlistlogic.go

@@ -50,7 +50,7 @@ func (l *GetSearchListLogic) GetSearchList(in *bxcore.SearchReq) (*bxcore.Search
 			KeyWords:   in.KeyWords,
 			Platform:   in.Platform,
 			UserType:   in.UserType,
-			Subtype:    "招标预告,招标公告,招标结果,招标信用信息",
+			//Subtype:    "招标预告,招标公告,招标结果,招标信用信息",
 		}
 		// 搜索范围只允许筛选 标题和正文 其他的过滤掉
 		var selectType []string

Some files were not shown because too many files changed in this diff