Jianghan 1 anno fa
parent
commit
e8d430a1db

+ 6 - 2
jyBXSubscribe/rpc/internal/logic/getsublistlogic.go

@@ -103,7 +103,11 @@ func (l *GetSubListLogic) GetSubList(in *bxsubscribe.SubscribeInfosReq) (*bxsubs
 	if in.UserType == model.EntnicheFlag {
 		spqp.UserId = common.InterfaceToStr(spqp.EntUserId)
 	}
-	hasNextPage, total, list := model.NewSubscribePush(in.UserType).Datas(spqp)
+
+	sp := model.NewSubscribePush(in.UserType)
+	//用户信息
+	bsp := sp.GetUserInfo(spqp)
+	hasNextPage, total, list := sp.Datas(spqp)
 	start1 := time.Now().Unix()
 	logx.Info("1、查询数据用户", start1-start)
 	/*
@@ -113,7 +117,7 @@ func (l *GetSubListLogic) GetSubList(in *bxsubscribe.SubscribeInfosReq) (*bxsubs
 	 */
 	//hasNextPage, total, list = model.NewSubscribePush(in.UserType).DefaultDatas(spqp)
 	if in.PageNum == 1 && spqp.IsEmpty() && len(list) == 0 && in.IsEnt == false {
-		hasNextPage, total, list = model.NewSubscribePush(in.UserType).DefaultDatas(spqp)
+		hasNextPage, total, list = model.NewSubscribePush(in.UserType).DefaultDatas(spqp, bsp)
 	}
 	start2 := time.Now().Unix()
 	logx.Info("2、查询数据用户", start2-start1)

+ 5 - 5
jyBXSubscribe/rpc/model/push.go

@@ -1064,14 +1064,14 @@ const (
 
 // 首次访问推送页面 默认生成推送数据
 // 默认匹配es 7天内数据
-func (s *subscribePush) DefaultDatas(spqp *SubPushQueryParam) (hasNextPage bool, total int64, result []*bxsubscribe.SubscribeInfo) {
+func (s *subscribePush) DefaultDatas(spqp *SubPushQueryParam, bsp *ViewCondition) (hasNextPage bool, total int64, result []*bxsubscribe.SubscribeInfo) {
 	if spqp.UserId == "" {
 		return false, 0, nil
 	}
 	t1 := time.Now()
 	logx.Info("userId:", spqp.UserId, "newUserId:", spqp.NewUserId)
 	//用户信息
-	bsp := s.getUserInfo(spqp)
+	//bsp := s.GetUserInfo(spqp)
 	logx.Info("获取用户信息耗时:", time.Since(t1))
 	t2 := time.Now()
 	if len(bsp.Keyword) > 0 {
@@ -1205,7 +1205,7 @@ func getKeys(title string, keywords []ViewKeyWord) (str []string) {
 
 // 获取查询语句
 func (s *subscribePush) getDefaultDatasSQL(bsp *ViewCondition) (str string) {
-	query := `{"query":{"bool":{"must":[%s],"should":[%s],"minimum_should_match": %d}}}`
+	query := `{"query":{"bool":{"must":[%s],"should":[%s],"minimum_should_match": %d}}, "size": 500}`
 	query_bool_should := `{"bool":{"should":[%s],"minimum_should_match": 1}}`
 	multi_match := `{"multi_match": {"query": %s,"type": "phrase", "fields": [%s]}}`
 	query_bool_must_and := `{"bool":{"must":[%s]%s}}`
@@ -1214,7 +1214,7 @@ func (s *subscribePush) getDefaultDatasSQL(bsp *ViewCondition) (str string) {
 	bools := []string{}
 	musts := []string{}
 	//发布时间最新7天(正式环境需要修改)
-	musts = append(musts, fmt.Sprintf(bidTime, time.Now().AddDate(0, 0, -7).Unix()))
+	musts = append(musts, fmt.Sprintf(bidTime, time.Now().AddDate(0, 0, -15).Unix()))
 	//省份
 	areaCity := []string{}
 	if len(bsp.Area) > 0 {
@@ -1349,7 +1349,7 @@ type ViewCondition struct {
 }
 
 // 获取用户信息
-func (s *subscribePush) getUserInfo(spqp *SubPushQueryParam) (vc *ViewCondition) {
+func (s *subscribePush) GetUserInfo(spqp *SubPushQueryParam) (vc *ViewCondition) {
 	var isPayBool = false
 	var tmpInfo = struct {
 		Items      []interface{}