|
@@ -88,6 +88,7 @@ type UserSubMsg struct {
|
|
|
Ppendtime int64 `json:"ppend"` //省份订阅包结束时间
|
|
|
}
|
|
|
|
|
|
+//推送预览总数
|
|
|
func DataCount(uid, item string, index int) int64 {
|
|
|
sql := GetSqlObjFromFreeId(uid, item, index)
|
|
|
if item != "" && index >= 0 && (sql.Keyword == nil || len(sql.Keyword) == 0) {
|
|
@@ -98,30 +99,20 @@ func DataCount(uid, item string, index int) int64 {
|
|
|
return elastic.Count(INDEX, TYPE, qstr)
|
|
|
}
|
|
|
|
|
|
+//match 默认精准 0
|
|
|
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,
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
+ viewKeyWords = append(viewKeyWords, ViewKeyWord{
|
|
|
+ Keyword: strings.Split(key, " "),
|
|
|
+ Exclude: strings.Split(notkey, " "),
|
|
|
+ MatchWay: matchway,
|
|
|
+ })
|
|
|
sql.Keyword = viewKeyWords
|
|
|
qstr := GetVIPViewSql(userId, sql)
|
|
|
return elastic.Count(INDEX, TYPE, qstr)
|
|
@@ -144,6 +135,7 @@ func SubViewDatas(userId, allquery string, pageNum int) (keys []interface{}, lis
|
|
|
keys = append(keys, strings.Join(keys_one, "++"))
|
|
|
}
|
|
|
qstr := GetVIPViewSql(userId, sql)
|
|
|
+ log.Println("qstr:", qstr)
|
|
|
list = elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSearch_sort, bidSearch_field, (pageNum-1)*view_pageSize, view_pageSize, 0, false)
|
|
|
if list != nil {
|
|
|
for _, v := range *list {
|
|
@@ -219,8 +211,7 @@ func (pi *ParamInfo) GetSubMsg() UserSubMsg {
|
|
|
return res
|
|
|
}
|
|
|
|
|
|
-//
|
|
|
-//member_jy
|
|
|
+//免费用户对象
|
|
|
func GetSqlObjFromFreeId(_id, item string, index int) *ViewCondition {
|
|
|
var (
|
|
|
query *map[string]interface{}
|
|
@@ -237,33 +228,34 @@ func GetSqlObjFromFreeId(_id, item string, index int) *ViewCondition {
|
|
|
//关键词组
|
|
|
a_items := []interface{}{}
|
|
|
a_items = append(a_items, o_jy["a_key"])
|
|
|
- // fmt.Println(a_items)
|
|
|
//采购单位类型
|
|
|
a_buyerclass := []interface{}{}
|
|
|
//信息类型
|
|
|
- a_infotype := []interface{}{}
|
|
|
+ a_infotype := []string{}
|
|
|
+ infotypeArr := ""
|
|
|
+ if o_jy["a_infotype"] != nil {
|
|
|
+ a_infotype = qutil.ObjArrToStringArr(o_jy["a_infotype"].([]interface{}))
|
|
|
+ for k, v := range a_infotype {
|
|
|
+ infotype := v
|
|
|
+ infotypeArr += getstype(infotype)
|
|
|
+ if k != len(a_infotype)-1 {
|
|
|
+ infotypeArr += ","
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if infotypeArr != "" {
|
|
|
+ a_infotype = strings.Split(infotypeArr, ",")
|
|
|
+ }
|
|
|
//省份
|
|
|
- o_area := map[string]interface{}{}
|
|
|
- //未升级版免费订阅
|
|
|
- // isUpgrade := true
|
|
|
- // if o_jy["o_area"] == nil {
|
|
|
- // isUpgrade = false
|
|
|
- // }
|
|
|
- // if o_member_jy["a_items"] != nil {
|
|
|
- // a_items = o_member_jy["a_items"].([]interface{})
|
|
|
- // }
|
|
|
- // if o_member_jy["a_infotype"] != nil {
|
|
|
- // a_infotype = o_member_jy["a_infotype"].([]interface{})
|
|
|
- // }
|
|
|
- // if o_member_jy["o_area"] != nil {
|
|
|
- // o_area = o_member_jy["o_area"].(map[string]interface{})
|
|
|
- // }
|
|
|
+ o_area := qutil.ObjToMap(o_jy["o_area"])
|
|
|
+ if qutil.IntAllDef(o_jy["i_ppstatus"], 0) == 1 && o_jy["o_area_p"] != nil {
|
|
|
+ o_area = qutil.ObjToMap(o_jy["o_area_p"])
|
|
|
+ }
|
|
|
return &ViewCondition{
|
|
|
Keyword: getKeyWordArrFromDbResult(a_items, item, index), //关键词
|
|
|
Buyerclass: qutil.ObjArrToStringArr(a_buyerclass), //采购单位类型
|
|
|
- Subtype: qutil.ObjArrToStringArr(a_infotype), //信息类型
|
|
|
- Area: getStringArrFromDbResult(o_area, 1), //省份
|
|
|
- City: getStringArrFromDbResult(o_area, 2), //城市
|
|
|
+ Subtype: a_infotype, //信息类型
|
|
|
+ Area: getStringArrFromDbResult(*o_area, 1), //省份
|
|
|
SelectType: strconv.Itoa(qutil.IntAll(o_jy["i_matchway"])), //匹配方式
|
|
|
}
|
|
|
}
|
|
@@ -276,23 +268,11 @@ func getKeyWordArrFromDbResult(a_items []interface{}, item string, index int) (a
|
|
|
for _, v := range a_items {
|
|
|
vmr, _ := v.([]interface{})
|
|
|
vm, _ := vmr[0].(map[string]interface{})
|
|
|
- // vm, _ := v.(map[string]interface{})
|
|
|
- // b, _ := json.Marshal(vm)
|
|
|
- // fmt.Println("vm", string(b), reflect.TypeOf(vm))
|
|
|
if item != "" && index >= 0 && item != qutil.ObjToString(vm["s_item"]) {
|
|
|
continue
|
|
|
}
|
|
|
- // b, _ = json.Marshal(a_items)
|
|
|
- // fmt.Println("a_items", string(b), reflect.TypeOf(a_items))
|
|
|
- // b, _ = json.Marshal(v)
|
|
|
- // fmt.Println("v", string(b), reflect.TypeOf(v))
|
|
|
- // // kwsArr := vm["a_key"]
|
|
|
kwsArr := vmr
|
|
|
- // fmt.Println(kwsArr)
|
|
|
- // kwsArr, _ := vm.([]interface{})
|
|
|
- // for i, k := range kwsArr.([]interface{}) {
|
|
|
for i, k := range kwsArr {
|
|
|
- // for i, k := range kwsArr {
|
|
|
if item != "" && index >= 0 && i != index {
|
|
|
continue
|
|
|
}
|
|
@@ -383,3 +363,18 @@ func (pi *ParamInfo) UpdateAreaPackTip() bool {
|
|
|
},
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
+//
|
|
|
+func getstype(stype string) string {
|
|
|
+ switch stype {
|
|
|
+ case "招标":
|
|
|
+ stype = "招标,邀标,询价,竞谈,单一,竞价,变更"
|
|
|
+ case "结果":
|
|
|
+ stype = "中标,成交,废标,流标,结果变更"
|
|
|
+ case "其它":
|
|
|
+ stype = "合同,验收,违规"
|
|
|
+ case "预告":
|
|
|
+ stype = "预告,需求公示,预审,论证意见,预审结果"
|
|
|
+ }
|
|
|
+ return stype
|
|
|
+}
|