|
@@ -31,7 +31,7 @@ import (
|
|
|
const (
|
|
|
pageSize = 100
|
|
|
AllSubPushCacheSize = 200
|
|
|
- query = `{"query":{"terms":{"_id":["%s"]}},"_source":["_id","area","city", "publishtime", "s_subscopeclass", "subtype", "title", "toptype", "type", "buyerclass","bidamount","budget","projectname","buyer","bidopentime","s_winner","filetext","spidercode","site","buyertel","buyerperson","agency","agencyperson","agencytel","winnerperson","winnertel","signendtime","bidendtime","entidlist","isValidFile"],"from":0,"size":%d}`
|
|
|
+ query = `{"query":{"terms":{"_id":["%s"]}},"_source":["_id","area","city", "publishtime", "s_subscopeclass", "subtype", "title", "toptype", "type", "buyerclass","bidamount","budget","projectname","buyer","bidopentime","s_winner","filetext","spidercode","site","buyertel","buyerperson","agency","agencyperson","agencytel","winnerperson","winnertel","signendtime","bidendtime","entidlist","isValidFile", "detail"],"from":0,"size":%d}`
|
|
|
mongodb_fields = `{"_id":1,"area":1,"publishtime":1,"s_subscopeclass":1,"subtype":1,"title":1,"toptype":1,"type":1, "city":1,"buyerclass":1,"budget":1,"bidamount":1,"s_winner":1,"bidopentime":1,"buyer":1,"projectname":1,"filetext":1,"spidercode":1,"site":1,"buyertel":1,"buyerperson":1,"agency":1,"agencyperson":1,"agencytel":1,"winnerperson":1,"winnertel":1,"signendtime":1,"bidendtime":1,"entidlist":1,"isValidFile":1}`
|
|
|
|
|
|
SubFreeFlag = "fType"
|
|
@@ -519,6 +519,14 @@ func (s *subscribePush) inactiveQuery(spqp *SubPushQueryParam, bsp *ViewConditio
|
|
|
}
|
|
|
return array, count
|
|
|
}
|
|
|
+
|
|
|
+var topTypeMap = map[string]string{
|
|
|
+ "招标预告": "预告",
|
|
|
+ "招标公告": "招标",
|
|
|
+ "招标结果": "结果",
|
|
|
+ "招标信用信息": "其它",
|
|
|
+}
|
|
|
+
|
|
|
func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, endtime int64, size int, isLimit bool) (result []*bxsubscribe.SubscribeInfo, count int64) {
|
|
|
start := time.Now().Unix()
|
|
|
querys := []string{}
|
|
@@ -622,15 +630,52 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
|
|
|
}
|
|
|
//信息类型
|
|
|
if spqp.Subtype != "" {
|
|
|
- subtype := []string{}
|
|
|
- for _, v := range strings.Split(spqp.Subtype, ",") {
|
|
|
- subtype = append(subtype, P.BidCodeMapping.Subtype[v])
|
|
|
+ var topType []string
|
|
|
+ typeInt := 0
|
|
|
+ stype := strings.Split(spqp.Subtype, ",")
|
|
|
+ for _, v := range stype {
|
|
|
+ if tType := topTypeMap[v]; tType != "" {
|
|
|
+ topType = append(topType, tType)
|
|
|
+ typeInt += 1
|
|
|
+ continue
|
|
|
+ }
|
|
|
}
|
|
|
- if len(subtype) == 1 {
|
|
|
- subtype = append(subtype, "9999")
|
|
|
+ var subtype []string
|
|
|
+ var toptype []string
|
|
|
+ //subtype里都是二级级信息类型
|
|
|
+ if typeInt == 0 {
|
|
|
+ for _, v := range stype {
|
|
|
+ subtype = append(subtype, P.BidCodeMapping.Subtype[v])
|
|
|
+ }
|
|
|
+ if len(subtype) == 1 {
|
|
|
+ subtype = append(subtype, "9999")
|
|
|
+ }
|
|
|
+ } else if typeInt == len(stype) { // subtype里边 都是一级信息类型
|
|
|
+ for _, v := range topType {
|
|
|
+ toptype = append(toptype, P.BidCodeMapping.Toptype[v])
|
|
|
+ }
|
|
|
+ if len(subtype) == 1 {
|
|
|
+ toptype = append(toptype, "9999")
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ for _, v := range stype {
|
|
|
+ subtype = append(subtype, P.BidCodeMapping.Subtype[v])
|
|
|
+ }
|
|
|
+ if len(subtype) == 1 {
|
|
|
+ subtype = append(subtype, "9999")
|
|
|
+ }
|
|
|
+ for _, v := range topType {
|
|
|
+ toptype = append(toptype, P.BidCodeMapping.Toptype[v])
|
|
|
+ }
|
|
|
+ if len(subtype) == 1 {
|
|
|
+ toptype = append(toptype, "9999")
|
|
|
+ }
|
|
|
}
|
|
|
if len(subtype) > 0 {
|
|
|
- querys = append(querys, fmt.Sprintf("subtype in (%s)", strings.Join(subtype, ",")))
|
|
|
+ querys = append(querys, fmt.Sprintf("a.subtype in (%s)", strings.Join(subtype, ",")))
|
|
|
+ }
|
|
|
+ if len(toptype) > 0 {
|
|
|
+ querys = append(querys, fmt.Sprintf("a.toptype in (%s)", strings.Join(toptype, ",")))
|
|
|
}
|
|
|
}
|
|
|
//信息行业
|
|
@@ -1176,7 +1221,7 @@ func GetKeySet(t string, u *map[string]interface{}, data []string) (bool, []stri
|
|
|
const (
|
|
|
INDEX = "bidding"
|
|
|
TYPE = "bidding"
|
|
|
- bidField = `"_id","title","publishtime","toptype","subtype","type","area","city","s_subscopeclass","buyerclass","budget","bidamount","filetext","spidercode","site","buyer","bidopentime","buyertel","buyerperson","agency","agencyperson","agencytel","s_winner","winnerperson","winnertel","signendtime","bidendtime","entidlist"`
|
|
|
+ bidField = `"_id","title","publishtime","toptype","subtype","type","area","city","s_subscopeclass","buyerclass","budget","bidamount","filetext","spidercode","site","buyer","bidopentime","buyertel","buyerperson","agency","agencyperson","agencytel","s_winner","winnerperson","winnertel","signendtime","bidendtime","entidlist", "detail"`
|
|
|
bidTime = `{"range":{"publishtime":{"gt":%d}}}`
|
|
|
bidSort = `{"publishtime":"desc"}`
|
|
|
findfields = `"title"`
|
|
@@ -1419,12 +1464,13 @@ func (s *subscribePush) getFreeDatasSQL(bsp *ViewCondition, startTime, endTime i
|
|
|
boolsNum := 0 //should
|
|
|
if len(bsp.Keyword) > 0 {
|
|
|
boolsNum = 1
|
|
|
- if bsp.SelectType == "" || bsp.SelectType == "2" {
|
|
|
- bsp.SelectType = "detail\", \"title"
|
|
|
+ stype := ""
|
|
|
+ if len(bsp.SelectType) == 1 {
|
|
|
+ stype = bsp.SelectType[0]
|
|
|
} else {
|
|
|
- bsp.SelectType = "title"
|
|
|
+ stype = strings.Join(bsp.SelectType, "\",\"")
|
|
|
}
|
|
|
- multi_match = fmt.Sprintf(multi_match, "%s", "\""+bsp.SelectType+"\"")
|
|
|
+ multi_match = fmt.Sprintf(multi_match, "%s", "\""+stype+"\"")
|
|
|
for _, v := range bsp.Keyword {
|
|
|
shoulds := []string{}
|
|
|
must_not := []string{}
|
|
@@ -1544,12 +1590,13 @@ func (s *subscribePush) getDefaultDatasSQL(bsp *ViewCondition) (str string) {
|
|
|
boolsNum := 0 //should
|
|
|
if len(bsp.Keyword) > 0 {
|
|
|
boolsNum = 1
|
|
|
- if bsp.SelectType == "" || bsp.SelectType == "2" {
|
|
|
- bsp.SelectType = "detail\", \"title"
|
|
|
+ stype := ""
|
|
|
+ if len(bsp.SelectType) == 1 {
|
|
|
+ stype = bsp.SelectType[0]
|
|
|
} else {
|
|
|
- bsp.SelectType = "title"
|
|
|
+ stype = strings.Join(bsp.SelectType, "\",\"")
|
|
|
}
|
|
|
- multi_match = fmt.Sprintf(multi_match, "%s", "\""+bsp.SelectType+"\"")
|
|
|
+ multi_match = fmt.Sprintf(multi_match, "%s", "\""+stype+"\"")
|
|
|
for _, v := range bsp.Keyword {
|
|
|
shoulds := []string{}
|
|
|
must_not := []string{}
|
|
@@ -1610,7 +1657,7 @@ type ViewCondition struct {
|
|
|
District []string //区县
|
|
|
Buyerclass []string //采购行业
|
|
|
Keyword []ViewKeyWord //关键词
|
|
|
- SelectType string //筛选(正文 or 标题)
|
|
|
+ SelectType []string //筛选(正文 or 标题)
|
|
|
Subtype []string //信息类型
|
|
|
Size int //数量
|
|
|
}
|
|
@@ -1624,7 +1671,7 @@ func (s *subscribePush) GetUserInfo(spqp *SubPushQueryParam) (vc *ViewCondition)
|
|
|
SubType []interface{}
|
|
|
Area map[string]interface{}
|
|
|
District map[string]interface{}
|
|
|
- SelectType string
|
|
|
+ SelectType []string
|
|
|
}{}
|
|
|
switch s.ModuleFlag {
|
|
|
case MemberFlag:
|
|
@@ -1642,6 +1689,11 @@ func (s *subscribePush) GetUserInfo(spqp *SubPushQueryParam) (vc *ViewCondition)
|
|
|
tmpInfo.SubType, _ = o_member_jy["a_infotype"].([]interface{})
|
|
|
tmpInfo.Area, _ = o_member_jy["o_area"].(map[string]interface{})
|
|
|
tmpInfo.District, _ = o_member_jy["o_district"].(map[string]interface{})
|
|
|
+ if o_member_jy["i_matchmode"] != nil {
|
|
|
+ tmpInfo.SelectType = o_member_jy["i_matchmode"].([]string)
|
|
|
+ } else {
|
|
|
+ tmpInfo.SelectType = []string{"title"}
|
|
|
+ }
|
|
|
}
|
|
|
case SubVipFlag:
|
|
|
userMap, ok := IC.Mgo.FindById("user", spqp.UserId, `{"o_vipjy":1,"i_vip_status":1,"subpush_inactive":1}`)
|
|
@@ -1657,6 +1709,11 @@ func (s *subscribePush) GetUserInfo(spqp *SubPushQueryParam) (vc *ViewCondition)
|
|
|
tmpInfo.SubType, _ = o_vipjy["a_infotype"].([]interface{})
|
|
|
tmpInfo.Area, _ = o_vipjy["o_area"].(map[string]interface{})
|
|
|
tmpInfo.District, _ = o_vipjy["o_district"].(map[string]interface{})
|
|
|
+ if o_vipjy["i_matchmode"] != nil {
|
|
|
+ tmpInfo.SelectType = o_vipjy["i_matchmode"].([]string)
|
|
|
+ } else {
|
|
|
+ tmpInfo.SelectType = []string{"title"}
|
|
|
+ }
|
|
|
}
|
|
|
case EntnicheFlag:
|
|
|
//商机管理
|
|
@@ -1673,6 +1730,11 @@ func (s *subscribePush) GetUserInfo(spqp *SubPushQueryParam) (vc *ViewCondition)
|
|
|
//省份
|
|
|
tmpInfo.Area, _ = entInfo["o_area"].(map[string]interface{})
|
|
|
tmpInfo.District, _ = entInfo["o_district"].(map[string]interface{})
|
|
|
+ if entInfo["i_matchmode"] != nil {
|
|
|
+ tmpInfo.SelectType = entInfo["i_matchmode"].([]string)
|
|
|
+ } else {
|
|
|
+ tmpInfo.SelectType = []string{"title"}
|
|
|
+ }
|
|
|
if common.IntAllDef(entInfo["i_ppstatus"], 0) == 1 && entInfo["o_area_p"] != nil {
|
|
|
tmpInfo.Area, _ = entInfo["o_area_p"].(map[string]interface{})
|
|
|
}
|
|
@@ -1684,6 +1746,11 @@ func (s *subscribePush) GetUserInfo(spqp *SubPushQueryParam) (vc *ViewCondition)
|
|
|
tmpInfo.SubType, _ = entInfo["a_infotype"].([]interface{})
|
|
|
tmpInfo.Area, _ = entInfo["o_area"].(map[string]interface{})
|
|
|
tmpInfo.District, _ = entInfo["o_district"].(map[string]interface{})
|
|
|
+ if entInfo["i_matchmode"] != nil {
|
|
|
+ tmpInfo.SelectType = entInfo["i_matchmode"].([]string)
|
|
|
+ } else {
|
|
|
+ tmpInfo.SelectType = []string{"title"}
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
default:
|
|
@@ -1700,6 +1767,11 @@ func (s *subscribePush) GetUserInfo(spqp *SubPushQueryParam) (vc *ViewCondition)
|
|
|
//省份
|
|
|
tmpInfo.Area, _ = o_jy["o_area"].(map[string]interface{})
|
|
|
tmpInfo.District, _ = o_jy["o_district"].(map[string]interface{})
|
|
|
+ if o_jy["i_matchmode"] != nil {
|
|
|
+ tmpInfo.SelectType = o_jy["i_matchmode"].([]string)
|
|
|
+ } else {
|
|
|
+ tmpInfo.SelectType = []string{"title"}
|
|
|
+ }
|
|
|
if common.IntAllDef(o_jy["i_ppstatus"], 0) == 1 && o_jy["o_area_p"] != nil {
|
|
|
tmpInfo.Area, _ = o_jy["o_area_p"].(map[string]interface{})
|
|
|
}
|
|
@@ -1711,7 +1783,7 @@ func (s *subscribePush) GetUserInfo(spqp *SubPushQueryParam) (vc *ViewCondition)
|
|
|
Area: getStringArrFromDbResult(tmpInfo.Area, 1),
|
|
|
City: getStringArrFromDbResult(tmpInfo.Area, 2),
|
|
|
District: districtHandle(tmpInfo.District),
|
|
|
- SelectType: "1",
|
|
|
+ SelectType: tmpInfo.SelectType,
|
|
|
}
|
|
|
//付费用户
|
|
|
if isPayBool {
|