dizhiyue 3 years ago
parent
commit
54cb9c4fad

+ 29 - 0
src/jfw/modules/publicapply/src/subscribe/entity/entity.go

@@ -91,6 +91,35 @@ func DataCount(uid, item string, index int) int64 {
 	return elastic.Count(INDEX, TYPE, qstr)
 }
 
+func KeysetDataCount(userId, key, notkey string, matchway int) int64 {
+	key = strings.TrimSpace(key)
+	notkey = strings.TrimSpace(notkey)
+	if key == "" {
+		return 0
+	}
+	// sql := GetSqlObjFromId(userId, "", -1)
+	sql := GetSqlObjFromFreeId(userId, "", -1)
+	viewKeyWords := []ViewKeyWord{}
+	if matchway == 0 {
+		viewKeyWords = append(viewKeyWords, ViewKeyWord{
+			Keyword:  strings.Split(key, " "),
+			Exclude:  strings.Split(notkey, " "),
+			MatchWay: matchway,
+		})
+	} else {
+		for _, v := range strings.Split(key, " ") {
+			viewKeyWords = append(viewKeyWords, ViewKeyWord{
+				Keyword:  []string{v},
+				Exclude:  strings.Split(notkey, " "),
+				MatchWay: matchway,
+			})
+		}
+	}
+	sql.Keyword = viewKeyWords
+	qstr := GetVIPViewSql(userId, sql)
+	return elastic.Count(INDEX, TYPE, qstr)
+}
+
 func SubViewDatas(userId, allquery string, pageNum int) (keys []interface{}, list *[]map[string]interface{}, hasNextPage bool) {
 	if userId == "" {
 		return

+ 6 - 5
src/jfw/modules/publicapply/src/subscribe/service/action.go

@@ -6,9 +6,10 @@ import (
 
 type ServiceStruct struct {
 	*xweb.Action
-	subscribeMsg   xweb.Mapper `xweb:"/free/subscribe"`      //获取用户订阅信息
-	getPushCount   xweb.Mapper `xweb:"/free/pushcount"`      //推送结果预览 计数
-	getPushView    xweb.Mapper `xweb:"/free/pushview"`       //推送结果预览
-	areaPackEndTip xweb.Mapper `xweb:"/free/areapack/(.*)"`  //省份订阅包到期提醒
-	oneProvinceSet xweb.Mapper `xweb:"/free/oneProvinceSet"` //免费老用户点击去升级订阅设置
+	subscribeMsg     xweb.Mapper `xweb:"/free/subscribe"`      //获取用户订阅信息
+	getPushCount     xweb.Mapper `xweb:"/free/pushcount"`      //推送结果预览 计数
+	getPushView      xweb.Mapper `xweb:"/free/pushview"`       //推送结果预览
+	getPushCountitem xweb.Mapper `xweb:"/free/pushcountitem"`  //单组推送结果预览 计数
+	areaPackEndTip   xweb.Mapper `xweb:"/free/areapack/(.*)"`  //省份订阅包到期提醒
+	oneProvinceSet   xweb.Mapper `xweb:"/free/oneProvinceSet"` //免费老用户点击去升级订阅设置
 }

+ 11 - 0
src/jfw/modules/publicapply/src/subscribe/service/service.go

@@ -67,6 +67,17 @@ func (this *ServiceStruct) GetPushCount() {
 	}
 }
 
+func (this *ServiceStruct) GetPushCountitem() {
+	defer qu.Catch()
+	userId, _ := this.GetSession("userId").(string)
+	if userId != "" {
+		matchway, _ := this.GetInteger("matchway")
+		this.ServeJson(map[string]interface{}{
+			"count": entity.KeysetDataCount(userId, this.GetString("key"), this.GetString("notkey"), matchway),
+		})
+	}
+}
+
 //
 func (this *ServiceStruct) AreaPackEndTip(types string) {
 	userId, _ := this.GetSession("userId").(string)