|
@@ -6,6 +6,7 @@ import (
|
|
|
elastic "app.yhyue.com/moapp/jybase/esv1"
|
|
|
"app.yhyue.com/moapp/jybase/mongodb"
|
|
|
"fmt"
|
|
|
+ "github.com/zeromicro/go-zero/core/logx"
|
|
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
|
|
"jyBXBase/rpc/bxbase"
|
|
|
IC "jyBXBase/rpc/init"
|
|
@@ -21,11 +22,13 @@ const (
|
|
|
multi_match = `{"multi_match": {"query": %s,"type": "phrase", "fields": ["title"]}}`
|
|
|
query_bool_must = `{"terms":{"%s":[%s]}}`
|
|
|
query_bool_must_and = `{"bool":{"must":[%s],"must_not":[%s]}}`
|
|
|
+ search_field = `"_id","area", "publishtime", "s_subscopeclass", "subtype", "title", "toptype", "type", "buyerclass","bidamount","budget","projectname","buyer","bidopentime","s_winner","filetext"`
|
|
|
+ query_city_hkeys = `{"query":{"bool":{"must":[%s],"should":[%s],"minimum_should_match": 1}},"highlight": {"pre_tags": ["<a>"],"post_tags": ["</a>"],"fields": {"title": {"fragment_size": 0,"number_of_fragments": 1}}},"_source":[` + search_field + `],"sort":[{"publishtime":"desc"},{"budget":"desc"}],"from":0,"size":20}`
|
|
|
)
|
|
|
|
|
|
func GetPushHistory(userId string) (res []*bxbase.NewestList) {
|
|
|
findSQL := "select infoid,matchkeys,attachment_count,budget,bidamount from pushsubscribe where userid = '" + userId + "' and date >= %d order by id desc limit 50"
|
|
|
- list := IC.PushMysql.SelectBySql(fmt.Sprintf(findSQL, time.Now().AddDate(0, 0, -7).Unix()))
|
|
|
+ list := IC.PushMysql.SelectBySql(fmt.Sprintf(findSQL, time.Now().AddDate(-1, 0, -7).Unix()))
|
|
|
if len(*list) > 0 {
|
|
|
m := map[string]bool{}
|
|
|
es_ids := []string{}
|
|
@@ -131,7 +134,8 @@ func NewestQuery(city, keys string) (str string) {
|
|
|
if city != "" {
|
|
|
musts = append(musts, fmt.Sprintf(query_bool_must, "city", `"`+city+`"`))
|
|
|
}
|
|
|
- str = fmt.Sprintf(query, strings.Join(musts, ","), strings.Join(bools, ","))
|
|
|
+ str = fmt.Sprintf(query_city_hkeys, strings.Join(musts, ","), strings.Join(bools, ","))
|
|
|
+ logx.Info("str:", str)
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -144,8 +148,8 @@ func NewestES(doSearchStr string) (res []*bxbase.NewestList) {
|
|
|
res = append(res, &bxbase.NewestList{
|
|
|
Id: ME.EncodeArticleId2ByCheck(_id),
|
|
|
Title: MC.ObjToString(v["title"]),
|
|
|
- Subtype: MC.If(v["subtype"] != nil, v["subtype"], v["toptype"]).(string),
|
|
|
- Area: MC.If(MC.ObjToString(v["area"]) == "A", "全国", v["area"]).(string),
|
|
|
+ Subtype: MC.If(v["subtype"] != nil, MC.ObjToString(v["subtype"]), MC.ObjToString(v["toptype"])).(string),
|
|
|
+ Area: MC.If(MC.ObjToString(v["area"]) == "A", "全国", MC.ObjToString(v["area"])).(string),
|
|
|
Buyerclass: MC.ObjToString(v["buyerclass"]),
|
|
|
City: MC.ObjToString(v["city"]),
|
|
|
Industry: MC.If(MC.ObjToString(v["s_subscopeclass"]) != "", strings.Split(strings.Split(MC.ObjToString(v["s_subscopeclass"]), ",")[0], "_")[0], "").(string),
|