Browse Source

Merge branch 'master' into feature/v4.7.15

123456 3 years ago
parent
commit
82e778136a
45 changed files with 1507 additions and 161 deletions
  1. 3 1
      src/config.json
  2. 43 0
      src/jfw/filter/baseuserfilter.go
  3. 3 0
      src/jfw/filter/filter.go
  4. 11 0
      src/jfw/front/dataExport.go
  5. 1 0
      src/jfw/front/front.go
  6. 20 1
      src/jfw/front/login.go
  7. 2 2
      src/jfw/front/pcIndex.go
  8. 11 0
      src/jfw/front/pchelper.go
  9. 89 1
      src/jfw/front/shorturl.go
  10. 1 4
      src/jfw/front/supsearch.go
  11. 2 2
      src/jfw/front/swordfish.go
  12. 9 1
      src/jfw/front/ws_dataExport.go
  13. 5 1
      src/jfw/jyutil/jyutil.go
  14. 43 0
      src/jfw/modules/app/src/app/filter/baseuserfilter.go
  15. 3 0
      src/jfw/modules/app/src/app/filter/filter.go
  16. 58 5
      src/jfw/modules/app/src/app/front/login.go
  17. 4 0
      src/jfw/modules/app/src/app/front/me.go
  18. 9 1
      src/jfw/modules/app/src/app/front/ws_dataExport.go
  19. 4 1
      src/jfw/modules/app/src/config.json
  20. 1 1
      src/jfw/modules/app/src/web/templates/weixin/historypush.html
  21. 50 29
      src/jfw/modules/common/src/qfw/util/bidsearch/search.go
  22. 106 52
      src/jfw/modules/common/src/qfw/util/dataexport/dataexport.go
  23. 15 14
      src/jfw/modules/common/src/qfw/util/jy/bigVipPower.go
  24. 150 1
      src/jfw/modules/common/src/qfw/util/jy/subscribepush.go
  25. 4 2
      src/jfw/modules/common/src/qfw/util/jy/userMerge.go
  26. 1 0
      src/jfw/modules/publicapply/src/ad/entity/struct.go
  27. 7 20
      src/jfw/modules/publicapply/src/bidcollection/entity/entity.go
  28. 249 0
      src/jfw/modules/publicapply/src/subscribePush/entity/historyPush.go
  29. 241 0
      src/jfw/modules/publicapply/src/subscribePush/entity/service/entity.go
  30. 260 0
      src/jfw/modules/publicapply/src/subscribePush/entity/service/matchjob.go
  31. 4 1
      src/jfw/modules/publicapply/src/subscribePush/entity/vrew.go
  32. 6 4
      src/jfw/modules/publicapply/src/subscribePush/service/pushList.go
  33. 2 1
      src/jfw/modules/subscribepay/src/config.json
  34. 1 0
      src/jfw/modules/subscribepay/src/config/config.go
  35. 49 1
      src/jfw/modules/subscribepay/src/service/userAccountInfo.go
  36. BIN
      src/jfw/modules/subscribepay/src/subscribepay
  37. 6 5
      src/jfw/modules/weixin/src/config.json
  38. 13 0
      src/jfw/modules/weixin/src/wx/wx.go
  39. 1 1
      src/jfw/public/dataexport.go
  40. 1 3
      src/web/staticres/frontRouter/pc/coupon/js/coupon-item-template.js
  41. 3 0
      src/web/staticres/public-pc/js/article-content.js
  42. 1 1
      src/web/staticres/public-pc/js/header-nav.js
  43. 11 1
      src/web/templates/pc/biddetail_rec.html
  44. 3 3
      src/web/templates/pc/supsearch.html
  45. 1 1
      src/web/templates/weixin/historypush.html

+ 3 - 1
src/config.json

@@ -321,5 +321,7 @@
     "canReadNotice": 3,
     "canReadNotice": 3,
     "smsServiceRpc":"127.0.0.1:932",
     "smsServiceRpc":"127.0.0.1:932",
     "searchTypeSwitch": true,
     "searchTypeSwitch": true,
-    "fileSignBool":false
+    "fileSignBool":true,
+    "baseUserFilterFlag":false,
+    "userCenterApi":"https://web-zxl.jydev.jianyu360.com"
 }
 }

+ 43 - 0
src/jfw/filter/baseuserfilter.go

@@ -0,0 +1,43 @@
+package filter
+
+import (
+	"jfw/config"
+	"jfw/public"
+	"log"
+	"net/http"
+	"qfw/util"
+
+	"github.com/go-xweb/httpsession"
+)
+
+type baseUserFilter struct {
+	W          http.ResponseWriter
+	R          *http.Request
+	Session    *httpsession.Session
+	GetSession map[string]interface{}
+}
+
+//判断session中是否存在base_user_id 不存在则更新
+
+func (this *baseUserFilter) Do() bool {
+	if flag, _ := config.Sysconfig["baseUserFilterFlag"].(bool); !flag {
+		return true
+	}
+	if this.R.Method == "POST" {
+		return true
+	}
+	if uid := this.GetSession["userId"]; uid != nil && uid != "" {
+		base_user_id := this.GetSession["base_user_id"]
+		if base_user_id == nil || base_user_id == 0 {
+			data, ok := public.MQFW.FindById("user", util.ObjToString(uid), `{"base_user_id":1}`)
+			if data != nil && ok && len(*data) > 0 {
+				if base_user_id := util.Int64All((*data)["base_user_id"]); base_user_id > 0 {
+					this.Session.Set("base_user_id", (*data)["base_user_id"])
+				} else {
+					log.Printf("%s用户暂无base_user_id", uid)
+				}
+			}
+		}
+	}
+	return true
+}

+ 3 - 0
src/jfw/filter/filter.go

@@ -52,5 +52,8 @@ func (f *Filter) Do(w http.ResponseWriter, r *http.Request) bool {
 	if !(&pcFilter{w, r, session, getSession}).Do() {
 	if !(&pcFilter{w, r, session, getSession}).Do() {
 		return false
 		return false
 	}
 	}
+	if !(&baseUserFilter{w, r, session, getSession}).Do() {
+		return false
+	}
 	return true
 	return true
 }
 }

+ 11 - 0
src/jfw/front/dataExport.go

@@ -413,8 +413,19 @@ func (d *DataExport) SuperSearchExport() error {
 	saveData["s_openid"] = openid
 	saveData["s_openid"] = openid
 	saveData["s_userid"] = userId
 	saveData["s_userid"] = userId
 	saveData["comeinfrom"] = "supersearchPage"
 	saveData["comeinfrom"] = "supersearchPage"
+	//是否开启 正文 标题同时搜索只搜正文的开关
+	saveData["searchTypeSwitch"], _ = config.Sysconfig["searchTypeSwitch"].(bool)
+
+	region := util.If(reqData.Area == "全国", "", reqData.Area).(string)
+	if region != "" && reqData.City != "" {
+		region += "," + reqData.City
+	} else {
+		region = reqData.City
+	}
+	saveData["region"] = util.If(region != "", strings.Split(region, ","), []string{}).([]string)
 	//存入数据库
 	//存入数据库
 	_id := mongodb.Save(dataexport.ExportTable, saveData)
 	_id := mongodb.Save(dataexport.ExportTable, saveData)
+	log.Println(_id, "saveData:", saveData)
 	return d.Redirect("/front/dataExport/toCreateOrderPage/" + util.SE.Encode2Hex(_id))
 	return d.Redirect("/front/dataExport/toCreateOrderPage/" + util.SE.Encode2Hex(_id))
 }
 }
 func (d *DataExport) ToCreateOrderPage(_id string) error {
 func (d *DataExport) ToCreateOrderPage(_id string) error {

+ 1 - 0
src/jfw/front/front.go

@@ -655,6 +655,7 @@ func (f *Front) SignOut() error {
 	f.DelSession("entUserId")
 	f.DelSession("entUserId")
 	f.DelSession("frameworkEntId")
 	f.DelSession("frameworkEntId")
 	f.DelSession("frameworkEntName")
 	f.DelSession("frameworkEntName")
+	f.DelSession("base_user_id")
 	f.ServeJson("ok")
 	f.ServeJson("ok")
 	return nil
 	return nil
 }
 }

+ 20 - 1
src/jfw/front/login.go

@@ -7,6 +7,7 @@ import (
 	. "mongodb"
 	. "mongodb"
 	qutil "qfw/util"
 	qutil "qfw/util"
 	"qfw/util/jy"
 	"qfw/util/jy"
+	"qfw/util/usercenter"
 	"regexp"
 	"regexp"
 	"strings"
 	"strings"
 	"time"
 	"time"
@@ -23,7 +24,6 @@ type Login struct {
 	forgetPwd xweb.Mapper `xweb:"/phone/forgetPwd"` //忘记密码
 	forgetPwd xweb.Mapper `xweb:"/phone/forgetPwd"` //忘记密码
 	register  xweb.Mapper `xweb:"/phone/register"`  //注册
 	register  xweb.Mapper `xweb:"/phone/register"`  //注册
 	phoneBind xweb.Mapper `xweb:"/phone/bind"`      //绑定手机号
 	phoneBind xweb.Mapper `xweb:"/phone/bind"`      //绑定手机号
-
 }
 }
 
 
 var (
 var (
@@ -132,6 +132,19 @@ func (l *Login) Login() error {
 					}
 					}
 					_id := mongodb.Save("user", data)
 					_id := mongodb.Save("user", data)
 					if _id != "" {
 					if _id != "" {
+						func(phone, userid string) {
+							//用户中台存储  开始
+							formdata := map[string]interface{}{
+								"appid": "10000",
+								"phone": phone,
+							}
+							if s_company != "" {
+								formdata["company"] = s_company
+							}
+							ck, _ := l.GetCookie("SESSIONID")
+							usercenter.AddBaseUser(mongodb, qutil.ObjToString(config.Sysconfig["userCenterApi"]), userid, formdata, ck)
+							//用户中台存储  结束
+						}(phone, _id)
 						jy.ClearPhoneIdentSession(l.Session())
 						jy.ClearPhoneIdentSession(l.Session())
 						ok, _, userInfo := afterLogin(phone, l.Session())
 						ok, _, userInfo := afterLogin(phone, l.Session())
 						nsqPath, _ := config.Sysconfig["nsq"].(string)
 						nsqPath, _ := config.Sysconfig["nsq"].(string)
@@ -249,6 +262,12 @@ func (l *Login) ForgetPwd() error {
 				"$unset": map[string]interface{}{
 				"$unset": map[string]interface{}{
 					"s_m_phone": "",
 					"s_m_phone": "",
 				}}, false, false) {
 				}}, false, false) {
+				userid := BsonIdToSId(user["_id"])
+				//用户中台存储  开始
+				ck, _ := l.GetCookie("SESSIONID")
+				usercenter.UpdateBaseUser(mongodb, qutil.ObjToString(config.Sysconfig["userCenterApi"]), userid, ck)
+
+				//用户中台存储  结束
 				l.DelSession("forgetPwdStep")
 				l.DelSession("forgetPwdStep")
 				jy.ClearPhoneIdentSession(l.Session())
 				jy.ClearPhoneIdentSession(l.Session())
 				return "y"
 				return "y"

+ 2 - 2
src/jfw/front/pcIndex.go

@@ -151,7 +151,7 @@ func GetNewArticle(typ int) (list []map[string]interface{}) {
 	if l, ok := redis.Get("other", rediskey).([]interface{}); ok && l != nil && len(l) > 0 {
 	if l, ok := redis.Get("other", rediskey).([]interface{}); ok && l != nil && len(l) > 0 {
 		list = util.ObjArrToMapArr(l)
 		list = util.ObjArrToMapArr(l)
 	} else {
 	} else {
-		_, _, lists := bidsearch.GetPcBidSearchData("", "", "", "", subtype, "", "", "", "", "", "", "", "", 1, bidsearch.SearchPageSize_PC, false, nil, bidSearch_field_1, "", false)
+		_, _, lists := bidsearch.GetPcBidSearchData("", "", "", "", subtype, "", "", "", "", "", "", "", "", 1, bidsearch.SearchPageSize_PC, false, nil, bidSearch_field_1, "", false, false)
 		if lists != nil && len(*lists) > 5 {
 		if lists != nil && len(*lists) > 5 {
 			*lists = (*lists)[0:6]
 			*lists = (*lists)[0:6]
 			for _, v := range *lists {
 			for _, v := range *lists {
@@ -442,7 +442,7 @@ func (f *PcIndex) SearchResult(at, name string) error {
 				// if datas != nil && len(*datas) > limitcount {
 				// if datas != nil && len(*datas) > limitcount {
 				// 	*datas = (*datas)[0:limitcount]
 				// 	*datas = (*datas)[0:limitcount]
 				// } else {
 				// } else {
-				_, _, datas = bidsearch.GetPcBidSearchData(keywords, "", "", "", "", key_industry, "", "", "", "", "", "", "", 0, bidsearch.SearchPageSize_PC, true, nil, bidSearch_field_1, "", false)
+				_, _, datas = bidsearch.GetPcBidSearchData(keywords, "", "", "", "", key_industry, "", "", "", "", "", "", "", 0, bidsearch.SearchPageSize_PC, true, nil, bidSearch_field_1, "", false, false)
 				if datas != nil && len(*datas) > limitcount {
 				if datas != nil && len(*datas) > limitcount {
 					*datas = (*datas)[0:limitcount]
 					*datas = (*datas)[0:limitcount]
 				}
 				}

+ 11 - 0
src/jfw/front/pchelper.go

@@ -12,6 +12,7 @@ import (
 	"qfw/util"
 	"qfw/util"
 	"qfw/util/jy"
 	"qfw/util/jy"
 	"qfw/util/redis"
 	"qfw/util/redis"
+	"qfw/util/usercenter"
 	"strings"
 	"strings"
 	"time"
 	"time"
 
 
@@ -133,6 +134,16 @@ func (l *PcHelper) Login() error {
 						}
 						}
 						_id := mongodb.Save("user", data)
 						_id := mongodb.Save("user", data)
 						if _id != "" {
 						if _id != "" {
+							//用户中台存储  开始
+							func(phone, userId string) {
+								formdata := map[string]interface{}{
+									"appid": "10000",
+									"phone": phone,
+								}
+								ck, _ := l.GetCookie("SESSIONID")
+								usercenter.AddBaseUser(mongodb, util.ObjToString(config.Sysconfig["userCenterApi"]), userId, formdata, ck)
+							}(phone, _id)
+							//用户中台存储  结束
 							jy.ClearPhoneIdentSession(l.Session())
 							jy.ClearPhoneIdentSession(l.Session())
 							reToken = getUToken(mac, phone)
 							reToken = getUToken(mac, phone)
 							reOpenId = phone
 							reOpenId = phone

+ 89 - 1
src/jfw/front/shorturl.go

@@ -37,6 +37,7 @@ var mobileReg = regexp.MustCompile("(?i)(Android|Mobile|Phone)")
 var DateFullLayout = "2006-01-02 15:04:05"
 var DateFullLayout = "2006-01-02 15:04:05"
 var Map_stype = map[string]bool{
 var Map_stype = map[string]bool{
 	"content":      true,
 	"content":      true,
+	"entservice":   true,
 	"bdprivate":    true,
 	"bdprivate":    true,
 	"mailprivate":  true,
 	"mailprivate":  true,
 	"bdcontent":    true,
 	"bdcontent":    true,
@@ -126,6 +127,94 @@ func (s *Short) Article(stype, id string) error {
 		if stype == "bdcontent" {
 		if stype == "bdcontent" {
 			stype = "content"
 			stype = "content"
 		}
 		}
+	} else if stype == "entservice" { //大客户数据快照展示
+		//SE := util.SimpleEncrypt{"entservice"}
+		sid := util.SE3.DecodeString(id)
+		if len(sid) == 0 || (len(sid) > 0 && sid == "") {
+			s.Redirect("/notin/page", 302)
+			return nil
+		}
+		catchKey := fmt.Sprintf("jypcdetail_%s_%s_%s", userId, stype, sid)
+		if res := redis.Get("other", catchKey); res == nil || res == "" {
+			industry := s.GetString("industry")
+			var shareid = s.GetString("id")
+			if len(shareid) == 0 {
+				shareid = "10"
+			}
+			s.T["logid"] = config.Seoconfig["jysskzy"].(string)
+			s.T["shareid"] = se.EncodeString(shareid)
+			s.T["keywords"] = s.GetString("kds")
+			ssOpenid := s.Session().Get("s_m_openid")
+
+			po, bo, wo, obj := pcVRT(sid, industry, true)
+			if obj != nil && len(obj) > 0 {
+
+				if len(po) > 0 {
+					s.T["projectOther"] = po
+				}
+				if len(bo) > 0 {
+					s.T["buyerOther"] = bo
+				}
+				if len(wo) > 0 {
+					s.T["winnerOther"] = wo
+				}
+				obj["urlpath"] = s.Uri()
+				obj["industry"] = industry
+				if ssOpenid != nil {
+					obj["ucbsId"] = util.EncodeArticleId2ByCheck("ucbs#" + ssOpenid.(string) + "#" + id)
+				}
+				if isbid(obj["subtype"]) {
+					obj["winner_enttel"] = getwinnertel(obj["winner"])
+				}
+				//判断时间 //如果是seo页面超过时间访问的进入首页
+				comeinTime := time.Unix(util.Int64All(obj["comeintime"]), 0)
+				if stype == "indexcontent" {
+					if count := public.MQFW.Count("seobidding", map[string]interface{}{"bid": sid}); count <= 0 && comeinTime.Before(time.Now().Add(time.Duration(-util.IntAll(config.Sysconfig["seoBeforeTimeHour"]))*time.Hour)) {
+						return s.Redirect("/")
+					}
+				}
+				FieldProcessing(obj, ssOpenid, industry, id, from_userid, userId, stype, true, false)
+
+				if obj["projectname"] != nil {
+					s.SetSession("projectname", obj["projectname"])
+				}
+				if obj["entidlist"] != nil { //大会员中标企业跳转至画像
+					if winner := util.ObjToString(obj["winner"]); winner != "" {
+						s_winner := util.ObjToString(obj["s_winner"])
+						idObjs, _ := obj["entidlist"].([]interface{})
+						winnerId := ""
+						if names := strings.Split(s_winner, ","); len(names) > 1 {
+							index := 0
+							for i := 0; i < len(names); i++ {
+								if names[i] == winner {
+									index = i
+									break
+								}
+							}
+							if len(idObjs) > index {
+								winnerId = util.ObjToString(idObjs[index])
+							}
+						} else { //中标企业仅一个
+							if len(idObjs) > 0 {
+								winnerId = util.ObjToString(idObjs[0])
+							}
+						}
+						if winnerId != "" && winnerId != "-" {
+							obj["entId"] = util.EncodeArticleId2ByCheck(winnerId)
+						}
+					}
+				}
+				s.T["url"] = s.Uri()
+				s.T["obj"] = obj
+
+				content, _ := s.Render4Cache("/pc/biddetail_rec.html", &s.T)
+				timeout := 60 * 20
+				redis.Put("other", catchKey, string(content), timeout)
+				return s.SetBody(content)
+			}
+		} else {
+			return s.SetBody([]byte(res.(string)))
+		}
 	}
 	}
 	ssOpenid := s.Session().Get("s_m_openid")
 	ssOpenid := s.Session().Get("s_m_openid")
 	var res *map[string]interface{}
 	var res *map[string]interface{}
@@ -276,7 +365,6 @@ func (s *Short) Article(stype, id string) error {
 		} else {
 		} else {
 			nodeStr = "false"
 			nodeStr = "false"
 		}
 		}
-		fmt.Println(s.T["canRead"])
 		if userId != "" && stype == "indexcontent" { //已登录用户直接跳转至正常三级页
 		if userId != "" && stype == "indexcontent" { //已登录用户直接跳转至正常三级页
 			return s.Redirect(fmt.Sprintf("/article/content/%s.html", util.CommonEncodeArticle("content", sid)))
 			return s.Redirect(fmt.Sprintf("/article/content/%s.html", util.CommonEncodeArticle("content", sid)))
 		}
 		}

+ 1 - 4
src/jfw/front/supsearch.go

@@ -54,12 +54,9 @@ func init() {
 	PCSLock.Unlock()
 	PCSLock.Unlock()
 	//搜索字段添加 附件标识
 	//搜索字段添加 附件标识
 	if FileSignBool, _ = config.Sysconfig["fileSignBool"].(bool); FileSignBool {
 	if FileSignBool, _ = config.Sysconfig["fileSignBool"].(bool); FileSignBool {
-		log.Println(FileSignBool, "------")
 		bidSearch_field_1 = bidSearch_field_1 + bidSearch_field_file
 		bidSearch_field_1 = bidSearch_field_1 + bidSearch_field_file
 		bidSearch_field = bidSearch_field + bidSearch_field_file
 		bidSearch_field = bidSearch_field + bidSearch_field_file
 	}
 	}
-	log.Println("bidSearch_field_1", bidSearch_field_1)
-	log.Println("bidSearch_field", bidSearch_field)
 }
 }
 
 
 //定时清理搜索列表页 从redis获取存入内存中的数据
 //定时清理搜索列表页 从redis获取存入内存中的数据
@@ -128,7 +125,7 @@ func (p *Pcsearch) ProposedProject() error {
 	var count int64
 	var count int64
 	if len(s_word) > 0 {
 	if len(s_word) > 0 {
 		status = 2
 		status = 2
-		count, totalPage, list = bidsearch.GetPcBidSearchData(s_word, area, "", publishtime, subtype, "", "", "", "", "", "", "", "", 0, bidsearch.SearchPageSize_PC, true, nil, bidSearch_field_1, "", false)
+		count, totalPage, list = bidsearch.GetPcBidSearchData(s_word, area, "", publishtime, subtype, "", "", "", "", "", "", "", "", 0, bidsearch.SearchPageSize_PC, true, nil, bidSearch_field_1, "", false, false)
 		listSize := 0
 		listSize := 0
 		if list != nil {
 		if list != nil {
 			listSize = len(*list)
 			listSize = len(*list)

+ 2 - 2
src/jfw/front/swordfish.go

@@ -36,7 +36,7 @@ var (
 	bidSearch_field_1    = `"_id","title","publishtime","toptype","subtype","type","area","city","s_subscopeclass","bidamount","budget","buyerclass","spidercode","site"`
 	bidSearch_field_1    = `"_id","title","publishtime","toptype","subtype","type","area","city","s_subscopeclass","bidamount","budget","buyerclass","spidercode","site"`
 	bidSearch_field      = bidSearch_field_1 + `,"bidopentime","winner","buyer","projectname","projectcode","projectinfo"`
 	bidSearch_field      = bidSearch_field_1 + `,"bidopentime","winner","buyer","projectname","projectcode","projectinfo"`
 	bidSearch_sort       = `{"publishtime":-1}`
 	bidSearch_sort       = `{"publishtime":-1}`
-	bidSearch_field_file = `,"filetext"`
+	bidSearch_field_file = `,"filetext","isValidFile"`
 )
 )
 
 
 //剑鱼标讯推送三级页点赞暂弃 改成剑鱼标讯实验室点赞功能
 //剑鱼标讯推送三级页点赞暂弃 改成剑鱼标讯实验室点赞功能
@@ -179,7 +179,7 @@ func (m *Front) PcAjaxReq() {
 func getLastNewsData(searchvalue, area, city, publishtime, subtype, industry, minprice, maxprice, buyerclass, hasBuyerTel, hasWinnerTel, fileExists, tabularflag string, start int, isGetCount bool, highlight bool, notkey string) (count int64, list *[]map[string]interface{}) {
 func getLastNewsData(searchvalue, area, city, publishtime, subtype, industry, minprice, maxprice, buyerclass, hasBuyerTel, hasWinnerTel, fileExists, tabularflag string, start int, isGetCount bool, highlight bool, notkey string) (count int64, list *[]map[string]interface{}) {
 	//最新招标信息
 	//最新招标信息
 	findfields := `"title"`
 	findfields := `"title"`
-	qstr := bidsearch.GetSearchQuery(searchvalue, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, fileExists, findfields, bidsearch.GetBidSearchQuery(area, city, publishtime, subtype, "", buyerclass), notkey)
+	qstr := bidsearch.GetSearchQuery(searchvalue, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, fileExists, findfields, bidsearch.GetBidSearchQuery(area, city, publishtime, subtype, "", buyerclass), notkey, false)
 	if isGetCount && start == 0 {
 	if isGetCount && start == 0 {
 		count = elastic.Count(INDEX, TYPE, qstr)
 		count = elastic.Count(INDEX, TYPE, qstr)
 	}
 	}

+ 9 - 1
src/jfw/front/ws_dataExport.go

@@ -375,7 +375,15 @@ func (wd *WsDataExport) SearchExport() error {
 	saveData["s_openid"] = openid
 	saveData["s_openid"] = openid
 	saveData["s_userid"] = userId
 	saveData["s_userid"] = userId
 	saveData["comeinfrom"] = "supersearchPage"
 	saveData["comeinfrom"] = "supersearchPage"
-
+	region := util.If(reqData.Area == "全国", "", reqData.Area).(string)
+	if region != "" && reqData.City != "" {
+		region += "," + reqData.City
+	} else {
+		region = reqData.City
+	}
+	saveData["region"] = strings.Split(region, ",")
+	//是否开启 正文 标题同时搜索只搜正文的开关
+	saveData["searchTypeSwitch"], _ = config.Sysconfig["searchTypeSwitch"].(bool)
 	//存入数据库
 	//存入数据库
 	_id := mongodb.Save(dataexport.ExportTable, saveData)
 	_id := mongodb.Save(dataexport.ExportTable, saveData)
 
 

+ 5 - 1
src/jfw/jyutil/jyutil.go

@@ -77,7 +77,7 @@ func Getopenid(code string) (openid string) {
 
 
 //
 //
 func GetSessionVal(q map[string]interface{}) (*map[string]interface{}, map[string]interface{}) {
 func GetSessionVal(q map[string]interface{}) (*map[string]interface{}, map[string]interface{}) {
-	person, ok := public.MQFW.FindOneByField("user", q, `{"_id":1,"i_shareknow":1,"s_m_openid":1,"s_nickname":1,"s_headimage":1,"s_headimageurl":1,"s_phone":1,"s_m_phone":1,"l_registedate":1,"b_merge_remind":1,"i_ispush":1,"i_unlimited":1,"s_jyname":1}`)
+	person, ok := public.MQFW.FindOneByField("user", q, `{"_id":1,"i_shareknow":1,"s_m_openid":1,"s_nickname":1,"s_headimage":1,"s_headimageurl":1,"s_phone":1,"s_m_phone":1,"l_registedate":1,"b_merge_remind":1,"i_ispush":1,"i_unlimited":1,"s_jyname":1,"base_user_id":1}`)
 	sessionVal := make(map[string]interface{})
 	sessionVal := make(map[string]interface{})
 	if !ok || person == nil || len(*person) == 0 {
 	if !ok || person == nil || len(*person) == 0 {
 		return nil, sessionVal
 		return nil, sessionVal
@@ -111,6 +111,10 @@ func GetSessionVal(q map[string]interface{}) (*map[string]interface{}, map[strin
 	}
 	}
 	sessionVal["phone"] = phone
 	sessionVal["phone"] = phone
 	sessionVal["i_unlimited"] = util.IntAll((*person)["i_unlimited"])
 	sessionVal["i_unlimited"] = util.IntAll((*person)["i_unlimited"])
+	base_uid := util.IntAllDef((*person)["base_user_id"], 0)
+	if base_uid != 0 {
+		sessionVal["base_user_id"] = base_uid //用户中台的uid
+	}
 	return person, sessionVal
 	return person, sessionVal
 }
 }
 
 

+ 43 - 0
src/jfw/modules/app/src/app/filter/baseuserfilter.go

@@ -0,0 +1,43 @@
+package filter
+
+import (
+	"jfw/config"
+	"jfw/public"
+	"log"
+	"net/http"
+	"qfw/util"
+
+	"github.com/go-xweb/httpsession"
+)
+
+type baseUserFilter struct {
+	W          http.ResponseWriter
+	R          *http.Request
+	Session    *httpsession.Session
+	GetSession map[string]interface{}
+}
+
+//判断session中是否存在base_user_id 不存在则更新
+
+func (this *baseUserFilter) Do() bool {
+	if flag, _ := config.Sysconfig["baseUserFilterFlag"].(bool); !flag {
+		return true
+	}
+	if this.R.Method == "POST" {
+		return true
+	}
+	if uid := this.GetSession["userId"]; uid != nil && uid != "" {
+		base_user_id := this.GetSession["base_user_id"]
+		if base_user_id == nil || base_user_id == 0 {
+			data, ok := public.MQFW.FindById("user", util.ObjToString(uid), `{"base_user_id":1}`)
+			if data != nil && ok && len(*data) > 0 {
+				if base_user_id := util.Int64All((*data)["base_user_id"]); base_user_id > 0 {
+					this.Session.Set("base_user_id", (*data)["base_user_id"])
+				} else {
+					log.Printf("%s用户暂无base_user_id", uid)
+				}
+			}
+		}
+	}
+	return true
+}

+ 3 - 0
src/jfw/modules/app/src/app/filter/filter.go

@@ -48,5 +48,8 @@ func (f *Filter) Do(w http.ResponseWriter, r *http.Request) bool {
 	if !(&phoneFilter{w, r, session, getSession}).Do() {
 	if !(&phoneFilter{w, r, session, getSession}).Do() {
 		return false
 		return false
 	}
 	}
+	if !(&baseUserFilter{w, r, session, getSession}).Do() {
+		return false
+	}
 	return true
 	return true
 }
 }

+ 58 - 5
src/jfw/modules/app/src/app/front/login.go

@@ -13,6 +13,7 @@ import (
 	"qfw/util/jy"
 	"qfw/util/jy"
 	"qfw/util/redis"
 	"qfw/util/redis"
 	qrpc "qfw/util/rpc"
 	qrpc "qfw/util/rpc"
+	"qfw/util/usercenter"
 	"regexp"
 	"regexp"
 	"strings"
 	"strings"
 	"sync"
 	"sync"
@@ -180,7 +181,7 @@ func (l *Login) Login() error {
 				deviceId := l.GetString("deviceId")
 				deviceId := l.GetString("deviceId")
 				if user == nil || len(user) == 0 {
 				if user == nil || len(user) == 0 {
 					client := l.Header("User-Agent")
 					client := l.Header("User-Agent")
-					log.Println("client:", client)
+					log.Println(client)
 					//clearRidByRid(rid)
 					//clearRidByRid(rid)
 					data := map[string]interface{}{
 					data := map[string]interface{}{
 						"i_appid":       2,
 						"i_appid":       2,
@@ -202,6 +203,15 @@ func (l *Login) Login() error {
 					data["s_regsource"] = isAndroidOrIOS(l.Header("User-Agent"))
 					data["s_regsource"] = isAndroidOrIOS(l.Header("User-Agent"))
 					_id := mongodb.Save("user", data)
 					_id := mongodb.Save("user", data)
 					if _id != "" {
 					if _id != "" {
+						//用户中台同步
+						func(userid string) {
+							formdata := map[string]interface{}{
+								"appid": "10000",
+								"phone": phone,
+							}
+							ck, _ := l.GetCookie("SESSIONID")
+							usercenter.AddBaseUser(mongodb, qutil.ObjToString(config.Sysconfig["userCenterApi"]), userid, formdata, ck)
+						}(_id)
 						jy.ClearPhoneIdentSession(l.Session())
 						jy.ClearPhoneIdentSession(l.Session())
 						returnSign = afterLogin(data, l.Session(), rid, oid, phoneType, channel, deviceId, true, l.ResponseWriter)
 						returnSign = afterLogin(data, l.Session(), rid, oid, phoneType, channel, deviceId, true, l.ResponseWriter)
 						addr, _ := config.Sysconfig["nsq"].(string)
 						addr, _ := config.Sysconfig["nsq"].(string)
@@ -442,6 +452,11 @@ func (l *Login) Register() error {
 						"$unset": map[string]interface{}{"s_m_phone": ""},
 						"$unset": map[string]interface{}{"s_m_phone": ""},
 					}, false, false)
 					}, false, false)
 					data["_id"] = wxuid
 					data["_id"] = wxuid
+					//用户中台同步
+					func(userid string) {
+						ck, _ := l.GetCookie("SESSIONID")
+						usercenter.UpdateBaseUser(mongodb, qutil.ObjToString(config.Sysconfig["userCenterApi"]), userid, ck)
+					}(qutil.ObjToString(wxuid))
 				} else {
 				} else {
 					data["i_appid"] = 2
 					data["i_appid"] = 2
 					data["l_registedate"] = time.Now().Unix()
 					data["l_registedate"] = time.Now().Unix()
@@ -457,6 +472,17 @@ func (l *Login) Register() error {
 					saveSuccess = saveid != ""
 					saveSuccess = saveid != ""
 				}
 				}
 				if saveSuccess && saveid != "" {
 				if saveSuccess && saveid != "" {
+					//用户中台同步
+					func(userid string) {
+						formdata := map[string]interface{}{
+							"appid":    "10000",
+							"phone":    phone,
+							"password": qutil.GetMd5String(password),
+							"company":  s_entname,
+						}
+						ck, _ := l.GetCookie("SESSIONID")
+						usercenter.AddBaseUser(mongodb, qutil.ObjToString(config.Sysconfig["userCenterApi"]), userid, formdata, ck)
+					}(saveid)
 					addr := config.Sysconfig["nsq"].(string)
 					addr := config.Sysconfig["nsq"].(string)
 					topic := config.Sysconfig["nsq_topic"].(string)
 					topic := config.Sysconfig["nsq_topic"].(string)
 					go func() {
 					go func() {
@@ -570,9 +596,14 @@ func (l *Login) WxLogin() {
 			if qutil.ObjToString((*user)["s_nickname"]) == "" && qutil.ObjToString((*user)["s_jyname"]) == "" {
 			if qutil.ObjToString((*user)["s_nickname"]) == "" && qutil.ObjToString((*user)["s_jyname"]) == "" {
 				upSet["s_jyname"] = jy.GetUserName("newother", config.Sysconfig["namePrefix"].(string))
 				upSet["s_jyname"] = jy.GetUserName("newother", config.Sysconfig["namePrefix"].(string))
 			}
 			}
-			go mongodb.UpdateById("user", BsonIdToSId((*user)["_id"]), map[string]interface{}{
-				"$set": upSet,
-			})
+			go func(userid string) {
+				mongodb.UpdateById("user", BsonIdToSId((*user)["_id"]), map[string]interface{}{
+					"$set": upSet,
+				})
+				ck, _ := l.GetCookie("SESSIONID")
+				usercenter.UpdateBaseUser(mongodb, qutil.ObjToString(config.Sysconfig["userCenterApi"]), userid, ck)
+			}(BsonIdToSId((*user)["_id"]))
+
 			returnSign = afterLogin(*user, l.Session(), rid, oid, phoneType, channel, deviceId, false, l.ResponseWriter)
 			returnSign = afterLogin(*user, l.Session(), rid, oid, phoneType, channel, deviceId, false, l.ResponseWriter)
 			return 1
 			return 1
 		} else {
 		} else {
@@ -604,6 +635,18 @@ func (l *Login) WxLogin() {
 			}
 			}
 			newUser["s_regsource"] = isAndroidOrIOS(l.Header("User-Agent")) //用户注册终端 ios 安卓 pc
 			newUser["s_regsource"] = isAndroidOrIOS(l.Header("User-Agent")) //用户注册终端 ios 安卓 pc
 			if _id := mongodb.Save("user", newUser); _id != "" {
 			if _id := mongodb.Save("user", newUser); _id != "" {
+				//用户中台同步
+				func(userid string) {
+					formdata := map[string]interface{}{
+						"appid":    "10000",
+						"nickname": qutil.If(u.Nickname == "", newUser["s_jyname"], u.Nickname),
+						"headimg":  u.HeadImageUrl,
+						"a_openid": u.OpenId,
+						"unionid":  u.UnionId,
+					}
+					ck, _ := l.GetCookie("SESSIONID")
+					usercenter.AddBaseUser(mongodb, qutil.ObjToString(config.Sysconfig["userCenterApi"]), userid, formdata, ck)
+				}(_id)
 				returnSign = afterLogin(newUser, l.Session(), rid, oid, phoneType, channel, deviceId, true, l.ResponseWriter)
 				returnSign = afterLogin(newUser, l.Session(), rid, oid, phoneType, channel, deviceId, true, l.ResponseWriter)
 				if disWord != "" {
 				if disWord != "" {
 					redisDis := redis.GetStr("other", "DIS_"+disWord[1:])
 					redisDis := redis.GetStr("other", "DIS_"+disWord[1:])
@@ -705,6 +748,10 @@ func (l *Login) ForgetPwd() error {
 				}}, false, false) {
 				}}, false, false) {
 				l.DelSession("forgetPwdStep")
 				l.DelSession("forgetPwdStep")
 				jy.ClearPhoneIdentSession(l.Session())
 				jy.ClearPhoneIdentSession(l.Session())
+				func(userid string) {
+					ck, _ := l.GetCookie("SESSIONID")
+					usercenter.UpdateBaseUser(mongodb, qutil.ObjToString(config.Sysconfig["userCenterApi"]), userid, ck)
+				}(BsonIdToSId(user["_id"]))
 				return "y"
 				return "y"
 			}
 			}
 			return "saveError"
 			return "saveError"
@@ -911,7 +958,7 @@ func createSession(s *httpsession.Session, person map[string]interface{}, loginI
 		default:
 		default:
 			return false
 			return false
 		}
 		}
-		field := `{"s_m_openid":1,"s_phone":1,"s_jpushid":1,"s_opushid":1,"s_appponetype":1,"s_headimageurl":1,"s_phone":1,"s_nickname":1,"s_appversion":1,"i_unlimited":1,"s_jyname":1}`
+		field := `{"s_m_openid":1,"s_phone":1,"s_jpushid":1,"s_opushid":1,"s_appponetype":1,"s_headimageurl":1,"s_phone":1,"s_nickname":1,"s_appversion":1,"i_unlimited":1,"s_jyname":1,"base_user_id":1}`
 		data, ok := mongodb.FindOneByField("user", query, field)
 		data, ok := mongodb.FindOneByField("user", query, field)
 		if !ok {
 		if !ok {
 			return false
 			return false
@@ -939,6 +986,9 @@ func createSession(s *httpsession.Session, person map[string]interface{}, loginI
 	s.Set("s_appversion", person["s_appversion"])
 	s.Set("s_appversion", person["s_appversion"])
 	s.Set("s_headimageurl", strings.Replace(qutil.ObjToString(person["s_headimageurl"]), "http://", "https://", 1))
 	s.Set("s_headimageurl", strings.Replace(qutil.ObjToString(person["s_headimageurl"]), "http://", "https://", 1))
 	s.Set("i_unlimited", qutil.IntAll(person["i_unlimited"]))
 	s.Set("i_unlimited", qutil.IntAll(person["i_unlimited"]))
+	if base_userid := qutil.IntAllDef(person["base_user_id"], 0); base_userid != 0 {
+		s.Set("base_user_id", base_userid)
+	}
 	if qutil.ObjToString(person["s_phone"]) != "" {
 	if qutil.ObjToString(person["s_phone"]) != "" {
 		phone := person["s_phone"].(string)
 		phone := person["s_phone"].(string)
 		s.Set("s_phone", phone)
 		s.Set("s_phone", phone)
@@ -1011,6 +1061,9 @@ func ClearSession(s *httpsession.Session) {
 	s.Del("phone")
 	s.Del("phone")
 	s.Del("i_unlimited")
 	s.Del("i_unlimited")
 	s.Del("s_jyname")
 	s.Del("s_jyname")
+	s.Del("base_user_id")
+	s.Del("user")
+	s.Del("nickname")
 }
 }
 
 
 //生成签名,返回手机端
 //生成签名,返回手机端

+ 4 - 0
src/jfw/modules/app/src/app/front/me.go

@@ -9,6 +9,7 @@ import (
 	qutil "qfw/util"
 	qutil "qfw/util"
 	"qfw/util/jy"
 	"qfw/util/jy"
 	"qfw/util/redis"
 	"qfw/util/redis"
+	"qfw/util/usercenter"
 	"strings"
 	"strings"
 	"time"
 	"time"
 
 
@@ -195,6 +196,9 @@ func (l *Me) Updatepwd() error {
 				"l_updatepwdtime": time.Now().Unix(), //增加修改密码时间
 				"l_updatepwdtime": time.Now().Unix(), //增加修改密码时间
 			},
 			},
 		}) {
 		}) {
+			//调用用户中台
+			ck, _ := l.GetCookie("SESSIONID")
+			usercenter.UpdateBaseUser(mongodb, qutil.ObjToString(config.Sysconfig["userCenterApi"]), userid, ck)
 			return "y"
 			return "y"
 		} else {
 		} else {
 			return "saveError"
 			return "saveError"

+ 9 - 1
src/jfw/modules/app/src/app/front/ws_dataExport.go

@@ -359,7 +359,15 @@ func (wd *WsDataExport) SearchExport() error {
 	saveData["s_openid"] = openid
 	saveData["s_openid"] = openid
 	saveData["s_userid"] = userId
 	saveData["s_userid"] = userId
 	saveData["comeinfrom"] = "supersearchPage"
 	saveData["comeinfrom"] = "supersearchPage"
-
+	region := util.If(reqData.Area == "全国", "", reqData.Area).(string)
+	if region != "" && reqData.City != "" {
+		region += "," + reqData.City
+	} else {
+		region = reqData.City
+	}
+	saveData["region"] = strings.Split(region, ",")
+	//是否开启 正文 标题同时搜索只搜正文的开关
+	saveData["searchTypeSwitch"], _ = config.Sysconfig["searchTypeSwitch"].(bool)
 	//存入数据库
 	//存入数据库
 	_id := mongodb.Save(dataexport.ExportTable, saveData)
 	_id := mongodb.Save(dataexport.ExportTable, saveData)
 
 

+ 4 - 1
src/jfw/modules/app/src/config.json

@@ -163,5 +163,8 @@
     "criticality":2,
     "criticality":2,
     "canReadNotice": 3,
     "canReadNotice": 3,
     "namePrefix":"JY_%s",
     "namePrefix":"JY_%s",
-    "smsServiceRpc":"127.0.0.1:932"
+    "smsServiceRpc":"127.0.0.1:932",
+    "searchTypeSwitch": true,
+    "baseUserFilterFlag":true,
+    "userCenterApi":"https://web-zxl.jydev.jianyu360.com"
 }
 }

+ 1 - 1
src/jfw/modules/app/src/web/templates/weixin/historypush.html

@@ -399,7 +399,7 @@
                                                 </span>
                                                 </span>
                                             </template>
                                             </template>
                                         </van-cell>
                                         </van-cell>
-                                        <van-cell center style="display: none; height: auto;"  @click="moreFiltersItemShow('fileItem', '附件')">
+                                        <van-cell center style="height: auto;"  @click="moreFiltersItemShow('fileItem', '附件')">
                                           <template #title>
                                           <template #title>
                                               <span v-if="screenShow" class="noticeText">附件</span>
                                               <span v-if="screenShow" class="noticeText">附件</span>
                                               <span v-else class="rootstyletitle">
                                               <span v-else class="rootstyletitle">

+ 50 - 29
src/jfw/modules/common/src/qfw/util/bidsearch/search.go

@@ -35,7 +35,7 @@ const (
 )
 )
 
 
 //GetWxsearchlistData 移动端招标信息搜索
 //GetWxsearchlistData 移动端招标信息搜索
-func GetWxsearchlistData(keywords, scope, city, publishtime, subtype, industry, minprice, maxprice, winner, buyerclass, hasBuyerTel, hasWinnerTel, fileExists string, pageNum, pageSize int, selectTypeArr []string, field, notkey string) (list *[]map[string]interface{}, b_word, a_word, s_word string) {
+func GetWxsearchlistData(keywords, scope, city, publishtime, subtype, industry, minprice, maxprice, winner, buyerclass, hasBuyerTel, hasWinnerTel, fileExists string, pageNum, pageSize int, selectTypeArr []string, field, notkey string, searchTypeSwitch bool) (list *[]map[string]interface{}, b_word, a_word, s_word string) {
 	var hightlightContent bool = false //是否高亮正文
 	var hightlightContent bool = false //是否高亮正文
 	for _, v := range selectTypeArr {
 	for _, v := range selectTypeArr {
 		if v == "detail" {
 		if v == "detail" {
@@ -53,7 +53,7 @@ func GetWxsearchlistData(keywords, scope, city, publishtime, subtype, industry,
 	} else {
 	} else {
 		findfields = fmt.Sprintf(`"%s"`, strings.Join(selectTypeArr, "\",\""))
 		findfields = fmt.Sprintf(`"%s"`, strings.Join(selectTypeArr, "\",\""))
 	}
 	}
-	qstr := GetSearchQuery(s_word, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, fileExists, findfields, GetBidSearchQuery(scope, city, publishtime, subtype, winner, buyerclass), notkey)
+	qstr := GetSearchQuery(s_word, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, fileExists, findfields, GetBidSearchQuery(scope, city, publishtime, subtype, winner, buyerclass), notkey, searchTypeSwitch)
 	if hightlightContent { //全文搜索
 	if hightlightContent { //全文搜索
 		list = elastic.GetAllByNgram(INDEX, TYPE, qstr, `"detail"`, bidSearch_sort, field, (pageNum-1)*pageSize, pageSize, 100, true)
 		list = elastic.GetAllByNgram(INDEX, TYPE, qstr, `"detail"`, bidSearch_sort, field, (pageNum-1)*pageSize, pageSize, 100, true)
 	} else { //标题搜索
 	} else { //标题搜索
@@ -69,7 +69,7 @@ func GetWxsearchlistData(keywords, scope, city, publishtime, subtype, industry,
 }
 }
 
 
 //GetPcBidSearchData pc端招标信息搜索
 //GetPcBidSearchData pc端招标信息搜索
-func GetPcBidSearchData(searchvalue, area, city, publishtime, subtype, industry, minprice, maxprice, winner, buyerclass, hasBuyerTel, hasWinnerTel, fileExists string, start, pageSize int, isGetCount bool, selectTypeArr []string, field, notkey string, ispayed bool) (count, totalPage int64, list *[]map[string]interface{}) {
+func GetPcBidSearchData(searchvalue, area, city, publishtime, subtype, industry, minprice, maxprice, winner, buyerclass, hasBuyerTel, hasWinnerTel, fileExists string, start, pageSize int, isGetCount bool, selectTypeArr []string, field, notkey string, ispayed, searchTypeSwitch bool) (count, totalPage int64, list *[]map[string]interface{}) {
 	var findfields string
 	var findfields string
 	var hightlightContent bool = false //是否高亮正文
 	var hightlightContent bool = false //是否高亮正文
 	for _, v := range selectTypeArr {
 	for _, v := range selectTypeArr {
@@ -83,11 +83,10 @@ func GetPcBidSearchData(searchvalue, area, city, publishtime, subtype, industry,
 	} else {
 	} else {
 		findfields = fmt.Sprintf(`"%s"`, strings.Join(selectTypeArr, "\",\""))
 		findfields = fmt.Sprintf(`"%s"`, strings.Join(selectTypeArr, "\",\""))
 	}
 	}
-	qstr := GetSearchQuery(searchvalue, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, fileExists, findfields, GetBidSearchQuery(area, city, publishtime, subtype, winner, buyerclass), notkey)
+	qstr := GetSearchQuery(searchvalue, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, fileExists, findfields, GetBidSearchQuery(area, city, publishtime, subtype, winner, buyerclass), notkey, searchTypeSwitch)
 	if isGetCount && qstr != "" && start == 0 {
 	if isGetCount && qstr != "" && start == 0 {
 		count = elastic.Count(INDEX, TYPE, qstr)
 		count = elastic.Count(INDEX, TYPE, qstr)
 	}
 	}
-	log.Println("field:", field)
 	if !isGetCount || count > 0 || start > 0 {
 	if !isGetCount || count > 0 || start > 0 {
 		var repl *[]map[string]interface{}
 		var repl *[]map[string]interface{}
 		if hightlightContent {
 		if hightlightContent {
@@ -238,27 +237,55 @@ func GetBidSearchQuery(area, city, publishtime, subtype, winner, buyerclass stri
 	return query
 	return query
 }
 }
 
 
-func GetSearchQuery(keyword, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, fileExists, findfields, mustquery, notkey string) (qstr string) {
+//包含正文或 附件 不包含标题
+func DetailFileORTitle(findfields string) bool {
+	return (strings.Contains(findfields, `"detail"`) || strings.Contains(findfields, `"filetext"`)) && !strings.Contains(findfields, `"title"`)
+}
+
+//包含标题和正文
+func DetailTitle(findfields string) bool {
+	return strings.Contains(findfields, `"detail"`) && strings.Contains(findfields, `"title"`)
+}
+func GetSearchQuery(keyword, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, fileExists, findfields, mustquery, notkey string, searchTypeSwitch bool) (qstr string) {
 	multi_match := `{"multi_match": {"query": "%s","type": "phrase", "fields": [%s]}}`
 	multi_match := `{"multi_match": {"query": "%s","type": "phrase", "fields": [%s]}}`
 	query := `{"query":{"bool":{"must":[%s],"must_not":[%s]}}}`
 	query := `{"query":{"bool":{"must":[%s],"must_not":[%s]}}}`
 	query_bool_should := `{"bool":{"should":[%s],"minimum_should_match": 1}}`
 	query_bool_should := `{"bool":{"should":[%s],"minimum_should_match": 1}}`
 	query_bools_must := `{"bool":{"must":[{"range":{"bidamount":{%s}}}]}},{"bool":{"must":[{"range":{"budget":{%s}}}],"must_not":[{"range":{"bidamount":{"gte":-1}}}]}}`
 	query_bools_must := `{"bool":{"must":[{"range":{"bidamount":{%s}}}]}},{"bool":{"must":[{"range":{"budget":{%s}}}],"must_not":[{"range":{"bidamount":{"gte":-1}}}]}}`
 	query_bool_must := `{"bool":{"must":[{"terms":{"s_subscopeclass":[%s]}}]}}`
 	query_bool_must := `{"bool":{"must":[{"terms":{"s_subscopeclass":[%s]}}]}}`
 	query_missing := `{"constant_score":{"filter":{"missing":{"field":"%s"}}}}`
 	query_missing := `{"constant_score":{"filter":{"missing":{"field":"%s"}}}}`
+	query_bool_must_term := `{"bool": {"must": [{ "term": {"isValidFile": %d }}]}}`
 	gte := `"gte": %s`
 	gte := `"gte": %s`
 	lte := `"lte": %s`
 	lte := `"lte": %s`
 	musts, must_not := []string{}, []string{}
 	musts, must_not := []string{}, []string{}
 	if mustquery != "" {
 	if mustquery != "" {
 		musts = append(musts, mustquery)
 		musts = append(musts, mustquery)
 	}
 	}
-
 	//搜索范围是否只有附件
 	//搜索范围是否只有附件
 	//搜索范围只选择附件,是否有附件条件无效;
 	//搜索范围只选择附件,是否有附件条件无效;
-	var isFileSearch bool = findfields == "filetext"
+	var isFileSearch bool = findfields == `"filetext"`
 	if keyword != "" {
 	if keyword != "" {
 		keyword_multi_match := fmt.Sprintf(multi_match, "%s", findfields)
 		keyword_multi_match := fmt.Sprintf(multi_match, "%s", findfields)
 		shoulds := []string{}
 		shoulds := []string{}
 		for _, v := range strings.Split(keyword, "+") {
 		for _, v := range strings.Split(keyword, "+") {
+			if elastic.ReplaceYH(v) == "" {
+				continue
+			}
+			if len([]rune(elastic.ReplaceYH(v))) == 1 {
+				//单个字 搜索范围 有全文或者附件 无标题 例如:学 虚拟机 detail  搜索的时候加上标题
+				if DetailFileORTitle(findfields) {
+					keyword_multi_match = fmt.Sprintf(multi_match, "%s", findfields+`,"title"`)
+				}
+			} else {
+				//标题+全文搜索 搜索类型开关打开 默认搜索全文;(全文包含标题)(单字排除)
+				if searchTypeSwitch && DetailTitle(findfields) {
+					if strings.Contains(findfields, `"title",`) {
+						findfields = strings.Replace(findfields, `"title",`, ``, -1)
+					} else if strings.Contains(findfields, `,"title"`) {
+						findfields = strings.Replace(findfields, `,"title"`, ``, -1)
+					}
+					keyword_multi_match = fmt.Sprintf(multi_match, "%s", findfields)
+				}
+			}
 			shoulds = append(shoulds, fmt.Sprintf(keyword_multi_match, elastic.ReplaceYH(v)))
 			shoulds = append(shoulds, fmt.Sprintf(keyword_multi_match, elastic.ReplaceYH(v)))
 		}
 		}
 		musts = append(musts, fmt.Sprintf(elastic.NgramMust, strings.Join(shoulds, ",")))
 		musts = append(musts, fmt.Sprintf(elastic.NgramMust, strings.Join(shoulds, ",")))
@@ -319,15 +346,22 @@ func GetSearchQuery(keyword, industry, minprice, maxprice, hasBuyerTel, hasWinne
 			if v == "" {
 			if v == "" {
 				continue
 				continue
 			}
 			}
+			if len([]rune(elastic.ReplaceYH(v))) == 1 {
+				//单个字 搜索范围 有全文或者附件 无标题 例如:学 虚拟机 detail  搜索的时候加上标题
+				if DetailFileORTitle(findfields) {
+					notkey_multi_match = fmt.Sprintf(multi_match, "%s", findfields+`,"title"`)
+				}
+			}
 			notkey_must_not = append(notkey_must_not, fmt.Sprintf(notkey_multi_match, elastic.ReplaceYH(v)))
 			notkey_must_not = append(notkey_must_not, fmt.Sprintf(notkey_multi_match, elastic.ReplaceYH(v)))
 		}
 		}
 		must_not = append(must_not, fmt.Sprintf(query_bool_should, strings.Join(notkey_must_not, ",")))
 		must_not = append(must_not, fmt.Sprintf(query_bool_should, strings.Join(notkey_must_not, ",")))
 	}
 	}
 	if !isFileSearch && fileExists != "" {
 	if !isFileSearch && fileExists != "" {
 		if fileExists == "1" { //有附件
 		if fileExists == "1" { //有附件
-			must_not = append(must_not, fmt.Sprintf(query_missing, "filetext"))
+			must_not = append(must_not, fmt.Sprintf(query_missing, "isValidFile"))
+			musts = append(musts, fmt.Sprintf(query_bool_must_term, 1))
 		} else if fileExists == "-1" { //无附件
 		} else if fileExists == "-1" { //无附件
-			musts = append(musts, fmt.Sprintf(query_missing, "filetext"))
+			musts = append(musts, fmt.Sprintf(query_missing, "isValidFile"))
 		}
 		}
 	}
 	}
 	qstr = fmt.Sprintf(query, strings.Join(musts, ","), strings.Join(must_not, ","))
 	qstr = fmt.Sprintf(query, strings.Join(musts, ","), strings.Join(must_not, ","))
@@ -368,12 +402,12 @@ func PublicSearch(userId, selectType, publishtime string, bidSearchOldUserLimit
 }
 }
 
 
 //所有的再次分词查询 只查标题
 //所有的再次分词查询 只查标题
-func IntegratedData(platform string, s_word, secondKWS, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, fileExists, secondFlag, area, city, publishtime, subtype, buyerclass, notkey string, queryItems []string, list *[]map[string]interface{}, field string) (string, string, string, string, *[]map[string]interface{}) {
+func IntegratedData(platform string, s_word, secondKWS, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, fileExists, secondFlag, area, city, publishtime, subtype, buyerclass, notkey string, queryItems []string, list *[]map[string]interface{}, field string, searchTypeSwitch bool) (string, string, string, string, *[]map[string]interface{}) {
 	var pcAjaxFlag string
 	var pcAjaxFlag string
 	var secRel *[]map[string]interface{} = list
 	var secRel *[]map[string]interface{} = list
 	if secondKWS = jy.HttpEs(s_word, "ik_smart", public.DbConf.Elasticsearch.Main.Address); secondKWS != "" {
 	if secondKWS = jy.HttpEs(s_word, "ik_smart", public.DbConf.Elasticsearch.Main.Address); secondKWS != "" {
 		findfields := `"title"`
 		findfields := `"title"`
-		qstr := GetSearchQuery(secondKWS, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, fileExists, findfields, GetBidSearchQuery(area, city, publishtime, subtype, "", buyerclass), notkey)
+		qstr := GetSearchQuery(secondKWS, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, fileExists, findfields, GetBidSearchQuery(area, city, publishtime, subtype, "", buyerclass), notkey, searchTypeSwitch)
 		secRel = elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSearch_sort, field, 0, 2*SearchPageSize_PC, 0, false)
 		secRel = elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSearch_sort, field, 0, 2*SearchPageSize_PC, 0, false)
 		if secRel != nil && len(*secRel) > 0 {
 		if secRel != nil && len(*secRel) > 0 {
 			public.BidListConvert(industry, secRel)
 			public.BidListConvert(industry, secRel)
@@ -457,7 +491,7 @@ func LisetData(stype, pageNum int, list *[]map[string]interface{}, secondFlag st
 				}
 				}
 				v["detail"] = detail
 				v["detail"] = detail
 				v["href"] = util.EncodeArticleId2ByCheck(util.GetRandom(20))
 				v["href"] = util.EncodeArticleId2ByCheck(util.GetRandom(20))
-				if v["filetext"] != nil {
+				if isValidFile, _ := v["isValidFile"].(bool); isValidFile {
 					delete(v, "filetext")
 					delete(v, "filetext")
 					v["fileExists"] = true
 					v["fileExists"] = true
 				}
 				}
@@ -491,33 +525,20 @@ func LisetData(stype, pageNum int, list *[]map[string]interface{}, secondFlag st
 func SearchData(platform string, request *http.Request, currentPage int, userId, secondKWS, s_word, area, city, publishtime, subtype, industry, minprice, maxprice, winner, buyerclass, hasBuyerTel, hasWinnerTel, fileExists string, start, pageSize int, isGetCount bool, queryItems []string, field, notkey string, isPayedUser, searchTypeSwitch bool) (second, b_word, a_word, pcAjaxFlag, secondFlag string, count, totalPage int64, list *[]map[string]interface{}) {
 func SearchData(platform string, request *http.Request, currentPage int, userId, secondKWS, s_word, area, city, publishtime, subtype, industry, minprice, maxprice, winner, buyerclass, hasBuyerTel, hasWinnerTel, fileExists string, start, pageSize int, isGetCount bool, queryItems []string, field, notkey string, isPayedUser, searchTypeSwitch bool) (second, b_word, a_word, pcAjaxFlag, secondFlag string, count, totalPage int64, list *[]map[string]interface{}) {
 	//包含标题才能进行二次搜索
 	//包含标题才能进行二次搜索
 	var secondSearch = strings.Contains(strings.Join(queryItems, ","), "title")
 	var secondSearch = strings.Contains(strings.Join(queryItems, ","), "title")
-	//标题 全文搜索 搜索类型开关打开 默认搜索全文;(全文包含标题)(单字排除)
-	if searchTypeSwitch {
-		findFields := strings.Join(queryItems, ",")
-		var switchBool = strings.Contains(findFields, "detail") && strings.Contains(findFields, "title")
-		if switchBool {
-			if strings.Contains(findFields, "title,") {
-				findFields = strings.Replace(findFields, "title,", "", -1)
-			} else if strings.Contains(findFields, `,title`) {
-				findFields = strings.Replace(findFields, ",title", "", -1)
-			}
-			queryItems = strings.Split(findFields, ",")
-		}
-	}
 	var searchvalue = s_word
 	var searchvalue = s_word
 	number := util.If(platform == "app" || platform == "wx", 1, 0)
 	number := util.If(platform == "app" || platform == "wx", 1, 0)
 	if platform == "app" || platform == "wx" {
 	if platform == "app" || platform == "wx" {
-		list, b_word, a_word, s_word = GetWxsearchlistData(s_word, area, city, publishtime, subtype, industry, minprice, maxprice, winner, buyerclass, hasBuyerTel, hasWinnerTel, fileExists, start, SearchPageSize_APP, queryItems, field, notkey)
+		list, b_word, a_word, s_word = GetWxsearchlistData(s_word, area, city, publishtime, subtype, industry, minprice, maxprice, winner, buyerclass, hasBuyerTel, hasWinnerTel, fileExists, start, SearchPageSize_APP, queryItems, field, notkey, searchTypeSwitch)
 		if list != nil && len(*list) != 0 {
 		if list != nil && len(*list) != 0 {
 			count = int64(len(*list))
 			count = int64(len(*list))
 		}
 		}
 	} else {
 	} else {
-		count, totalPage, list = GetPcBidSearchData(s_word, area, city, publishtime, subtype, industry, minprice, maxprice, winner, buyerclass, hasBuyerTel, hasWinnerTel, fileExists, start, pageSize, isGetCount, queryItems, field, notkey, isPayedUser)
+		count, totalPage, list = GetPcBidSearchData(s_word, area, city, publishtime, subtype, industry, minprice, maxprice, winner, buyerclass, hasBuyerTel, hasWinnerTel, fileExists, start, pageSize, isGetCount, queryItems, field, notkey, isPayedUser, searchTypeSwitch)
 	}
 	}
 
 
 	if len([]rune(s_word)) > 3 && int(count) < SearchPageSize_PC && start == number && secondSearch {
 	if len([]rune(s_word)) > 3 && int(count) < SearchPageSize_PC && start == number && secondSearch {
 		var paramList = list
 		var paramList = list
-		s_word, pcAjaxFlag, secondFlag, second, list = IntegratedData(platform, s_word, secondKWS, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, fileExists, secondFlag, area, city, publishtime, subtype, buyerclass, notkey, queryItems, paramList, field)
+		s_word, pcAjaxFlag, secondFlag, second, list = IntegratedData(platform, s_word, secondKWS, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, fileExists, secondFlag, area, city, publishtime, subtype, buyerclass, notkey, queryItems, paramList, field, searchTypeSwitch)
 	}
 	}
 
 
 	listSize := 0
 	listSize := 0

+ 106 - 52
src/jfw/modules/common/src/qfw/util/dataexport/dataexport.go

@@ -28,27 +28,28 @@ type KeyWord struct {
 
 
 /*筛选条件*/
 /*筛选条件*/
 type SieveCondition struct {
 type SieveCondition struct {
-	Id           string    `json:"id"`
-	PublishTime  string    `json:"publishtime"`  //发布时间
-	Area         []string  `json:"area"`         //地区-省份
-	City         []string  `json:"city"`         //地区-城市
-	Region       []string  `json:"region"`       //地区-省份+城市
-	Industry     []string  `json:"industry"`     //行业
-	Keyword      []KeyWord `json:"keywords"`     //关键词
-	Buyer        []string  `json:"buyer"`        //招标单位(采购单位)
-	Buyerclass   []string  `json:"buyerclass"`   //采购单位类型
-	HasBuyerTel  string    `json:"hasBuyertel"`  //是否有采购单位电话
-	Winner       []string  `json:"winner"`       //中标单位
-	HasWinnerTel string    `json:"hasWinnertel"` //是否有中标单位电话
-	ComeInTime   int64     `json:"comeintime"`   //入库时间(秒)
-	OpenId       string    `json:"openid"`       //用户openid
-	MinPrice     string    `json:"minprice"`     //金额——最少
-	MaxPrice     string    `json:"maxprice"`     //金额——最多
-	SelectType   string    `json:"selectType"`   //筛选(正文 or 标题)
-	Subtype      string    `json:"subtype"`      //信息类型
-	SelectIds    []string  `json:"selectId"`     //选择信息导出
-	Comeinfrom   string    `json:"comeinfrom"`   //查询来源
-	FileExists   string    `json:"fileExists"`   //是否有附件
+	Id               string    `json:"id"`
+	PublishTime      string    `json:"publishtime"`      //发布时间
+	Area             []string  `json:"area"`             //地区-省份
+	City             []string  `json:"city"`             //地区-城市
+	Region           []string  `json:"region"`           //地区-省份+城市
+	Industry         []string  `json:"industry"`         //行业
+	Keyword          []KeyWord `json:"keywords"`         //关键词
+	Buyer            []string  `json:"buyer"`            //招标单位(采购单位)
+	Buyerclass       []string  `json:"buyerclass"`       //采购单位类型
+	HasBuyerTel      string    `json:"hasBuyertel"`      //是否有采购单位电话
+	Winner           []string  `json:"winner"`           //中标单位
+	HasWinnerTel     string    `json:"hasWinnertel"`     //是否有中标单位电话
+	ComeInTime       int64     `json:"comeintime"`       //入库时间(秒)
+	OpenId           string    `json:"openid"`           //用户openid
+	MinPrice         string    `json:"minprice"`         //金额——最少
+	MaxPrice         string    `json:"maxprice"`         //金额——最多
+	SelectType       string    `json:"selectType"`       //筛选(正文 or 标题)
+	Subtype          string    `json:"subtype"`          //信息类型
+	SelectIds        []string  `json:"selectId"`         //选择信息导出
+	Comeinfrom       string    `json:"comeinfrom"`       //查询来源
+	FileExists       string    `json:"fileExists"`       //是否有附件
+	SearchTypeSwitch bool      `json:"searchTypeSwitch"` //是否开启 正文 标题同时搜索只搜正文的开关
 }
 }
 
 
 const (
 const (
@@ -68,6 +69,18 @@ var topType = map[string]string{
 	"招标公告":   "招标",
 	"招标公告":   "招标",
 	"招标结果":   "结果",
 	"招标结果":   "结果",
 	"招标信用信息": "其它",
 	"招标信用信息": "其它",
+	"拟建项目":   "拟建",
+	"采购意向":   "采购意向",
+}
+
+//包含正文或 附件 不包含标题
+func DetailFileORTitle(findfields string) bool {
+	return (strings.Contains(findfields, "detail") || strings.Contains(findfields, "filetext")) && !strings.Contains(findfields, "title")
+}
+
+//包含正文包含标题
+func DetailANDTitle(findfields string) bool {
+	return strings.Contains(findfields, "detail") && strings.Contains(findfields, "title")
 }
 }
 
 
 //获取数据导出查询语句
 //获取数据导出查询语句
@@ -84,6 +97,7 @@ func getDataExportSql(scd *SieveCondition) string {
 	query_bool_must := `{"terms":{"%s":[%s]}}`
 	query_bool_must := `{"terms":{"%s":[%s]}}`
 	query_bool_must_and := `{"bool":{"must":[%s]%s}}`
 	query_bool_must_and := `{"bool":{"must":[%s]%s}}`
 	query_missing := `{"constant_score":{"filter":{"missing":{"field":"%s"}}}}`
 	query_missing := `{"constant_score":{"filter":{"missing":{"field":"%s"}}}}`
+	query_bool_must_term := `{"bool": {"must": [{ "term": {"isValidFile": %d }}]}}`
 	gte := `"gte": %s`
 	gte := `"gte": %s`
 	lte := `"lte": %s`
 	lte := `"lte": %s`
 
 
@@ -223,18 +237,27 @@ func getDataExportSql(scd *SieveCondition) string {
 		}
 		}
 	}
 	}
 	boolsNum := 0
 	boolsNum := 0
+	selectType := scd.SelectType
 	//should
 	//should
 	if len(scd.Keyword) > 0 {
 	if len(scd.Keyword) > 0 {
 		boolsNum = 1
 		boolsNum = 1
 		queryItem := ""
 		queryItem := ""
-		if scd.SelectType == "" {
+		if selectType == "" {
 			queryItem = "title"
 			queryItem = "title"
-		} else if scd.SelectType == "all" {
+		} else if selectType == "all" {
 			queryItem = "detail\", \"title"
 			queryItem = "detail\", \"title"
 		} else {
 		} else {
-			queryItem = strings.ReplaceAll(scd.SelectType, ",", "\",\"")
+			if scd.SearchTypeSwitch && DetailANDTitle(selectType) {
+				if strings.Contains(selectType, "title,") {
+					selectType = strings.Replace(selectType, "title,", "", -1)
+				} else if strings.Contains(selectType, ",title") {
+					selectType = strings.Replace(selectType, ",title", "", -1)
+				}
+
+			}
+			queryItem = strings.ReplaceAll(selectType, ",", "\",\"")
 		}
 		}
-		multi_match = fmt.Sprintf(multi_match, "%s", "\""+queryItem+"\"")
+		multi_match_new := fmt.Sprintf(multi_match, "%s", "\""+queryItem+"\"")
 
 
 		if scd.Comeinfrom == "supersearchPage" {
 		if scd.Comeinfrom == "supersearchPage" {
 			var keywordArr []string
 			var keywordArr []string
@@ -258,25 +281,53 @@ func getDataExportSql(scd *SieveCondition) string {
 			if v.Keyword != "" {
 			if v.Keyword != "" {
 				if strings.Contains(v.Keyword, "+") {
 				if strings.Contains(v.Keyword, "+") {
 					for _, vk := range strings.Split(v.Keyword, "+") {
 					for _, vk := range strings.Split(v.Keyword, "+") {
-						shoulds = append(shoulds, fmt.Sprintf(multi_match, "\""+vk+"\""))
+						//单个字 搜索范围 有全文或者附件 无标题 例如:学 虚拟机 detail  搜索的时候加上标题
+						if scd.Comeinfrom == "supersearchPage" && DetailFileORTitle(selectType) && len([]rune(elastic.ReplaceYH(vk))) == 1 {
+							queryItem = strings.ReplaceAll(selectType+",title", ",", "\",\"")
+							shouldsKey := fmt.Sprintf(multi_match, "\""+vk+"\"", "\""+queryItem+"\"")
+							shoulds = append(shoulds, shouldsKey)
+						} else {
+							shoulds = append(shoulds, fmt.Sprintf(multi_match_new, "\""+vk+"\""))
+						}
 					}
 					}
 				} else if strings.Contains(v.Keyword, " ") {
 				} else if strings.Contains(v.Keyword, " ") {
 					for _, vk := range strings.Split(v.Keyword, " ") {
 					for _, vk := range strings.Split(v.Keyword, " ") {
-						shoulds = append(shoulds, fmt.Sprintf(multi_match, "\""+vk+"\""))
+						//单个字 搜索范围 有全文或者附件 无标题 例如:学 虚拟机 detail  搜索的时候加上标题
+						if scd.Comeinfrom == "supersearchPage" && DetailFileORTitle(selectType) && len([]rune(elastic.ReplaceYH(vk))) == 1 {
+							queryItem = strings.ReplaceAll(selectType+",title", ",", "\",\"")
+							shouldsKey := fmt.Sprintf(multi_match, "\""+vk+"\"", "\""+queryItem+"\"")
+							shoulds = append(shoulds, shouldsKey)
+						} else {
+							shoulds = append(shoulds, fmt.Sprintf(multi_match_new, "\""+vk+"\""))
+						}
 					}
 					}
 				} else {
 				} else {
-					shoulds = append(shoulds, fmt.Sprintf(multi_match, "\""+v.Keyword+"\""))
+					//单个字 搜索范围 有全文或者附件 无标题 例如:学 虚拟机 detail  搜索的时候加上标题
+					if scd.Comeinfrom == "supersearchPage" && DetailFileORTitle(selectType) && len([]rune(elastic.ReplaceYH(v.Keyword))) == 1 {
+						queryItem = strings.ReplaceAll(selectType+",title", ",", "\",\"")
+						shouldsKey := fmt.Sprintf(multi_match, "\""+v.Keyword+"\"", "\""+queryItem+"\"")
+						shoulds = append(shoulds, shouldsKey)
+					} else {
+						shoulds = append(shoulds, fmt.Sprintf(multi_match_new, "\""+v.Keyword+"\""))
+					}
 				}
 				}
 			}
 			}
 
 
 			//附加词
 			//附加词
 			for _, vv := range v.Appended {
 			for _, vv := range v.Appended {
-				shoulds = append(shoulds, fmt.Sprintf(multi_match, "\""+vv+"\""))
+				shoulds = append(shoulds, fmt.Sprintf(multi_match_new, "\""+vv+"\""))
 			}
 			}
 
 
 			//排除词
 			//排除词
 			for _, vv := range v.Exclude {
 			for _, vv := range v.Exclude {
-				must_not = append(must_not, fmt.Sprintf(multi_match, "\""+vv+"\""))
+				//单个字 搜索范围 有全文或者附件 无标题 例如:学 虚拟机 detail  搜索的时候加上标题
+				if scd.Comeinfrom == "supersearchPage" && DetailFileORTitle(selectType) && len([]rune(elastic.ReplaceYH(vv))) == 1 {
+					queryItem = strings.ReplaceAll(selectType+",title", ",", "\",\"")
+					shouldsKey := fmt.Sprintf(multi_match, "\""+vv+"\"", "\""+queryItem+"\"")
+					shoulds = append(shoulds, shouldsKey)
+				} else {
+					must_not = append(must_not, fmt.Sprintf(multi_match_new, "\""+vv+"\""))
+				}
 			}
 			}
 
 
 			//添加
 			//添加
@@ -306,12 +357,13 @@ func getDataExportSql(scd *SieveCondition) string {
 
 
 	//搜索范围是否只有附件
 	//搜索范围是否只有附件
 	//搜索范围只选择附件,是否有附件条件无效;
 	//搜索范围只选择附件,是否有附件条件无效;
-	var isFileSearch = strings.ReplaceAll(scd.SelectType, ",", "\",\"") == "filetext"
+	var isFileSearch = strings.ReplaceAll(selectType, ",", "\",\"") == "filetext"
 	if !isFileSearch && scd.FileExists != "" {
 	if !isFileSearch && scd.FileExists != "" {
 		if scd.FileExists == "1" { //有附件
 		if scd.FileExists == "1" { //有附件
-			must_not = append(must_not, fmt.Sprintf(query_missing, "filetext"))
+			must_not = append(must_not, fmt.Sprintf(query_missing, "isValidFile"))
+			musts = append(musts, fmt.Sprintf(query_bool_must_term, 1))
 		} else if scd.FileExists == "-1" { //无附件
 		} else if scd.FileExists == "-1" { //无附件
-			musts = append(musts, fmt.Sprintf(query_missing, "filetext"))
+			musts = append(musts, fmt.Sprintf(query_missing, "isValidFile"))
 		}
 		}
 	}
 	}
 	qstr := fmt.Sprintf(query, strings.Join(musts, ","), strings.Join(must_not, ","), strings.Join(bools, ","), boolsNum)
 	qstr := fmt.Sprintf(query, strings.Join(musts, ","), strings.Join(must_not, ","), strings.Join(bools, ","), boolsNum)
@@ -327,26 +379,28 @@ func GetSqlObjFromId(mongo mg.MongodbSim, _id string) *SieveCondition {
 	if query, ok = mongo.FindById(ExportTable, _id, nil); !ok {
 	if query, ok = mongo.FindById(ExportTable, _id, nil); !ok {
 		return nil
 		return nil
 	}
 	}
+	searchTypeSwitch, _ := (*query)["searchTypeSwitch"].(bool)
 	return &SieveCondition{
 	return &SieveCondition{
-		Id:           _id,
-		Keyword:      getKeyWordArrFromDbResult((*query)["keywords"]),
-		Industry:     getStringArrFromDbResult((*query)["industry"]),
-		MinPrice:     qutil.ObjToString((*query)["minprice"]),
-		MaxPrice:     qutil.ObjToString((*query)["maxprice"]),
-		Subtype:      qutil.ObjToString((*query)["subtype"]),
-		Area:         getStringArrFromDbResult((*query)["area"]),
-		City:         getStringArrFromDbResult((*query)["city"]),
-		SelectType:   qutil.ObjToString((*query)["selectType"]),
-		PublishTime:  qutil.ObjToString((*query)["publishtime"]),
-		Buyer:        getStringArrFromDbResult((*query)["buyer"]),
-		Buyerclass:   getStringArrFromDbResult((*query)["buyerclass"]),
-		HasBuyerTel:  qutil.ObjToString((*query)["hasBuyertel"]),
-		Winner:       getStringArrFromDbResult((*query)["winner"]),
-		HasWinnerTel: qutil.ObjToString((*query)["hasWinnertel"]),
-		ComeInTime:   qutil.Int64All((*query)["comeintime"]),
-		Comeinfrom:   qutil.ObjToString((*query)["comeinfrom"]),
-		SelectIds:    getStringArrFromDbResult((*query)["selectIds"]),
-		FileExists:   qutil.ObjToString((*query)["fileExists"]),
+		Id:               _id,
+		Keyword:          getKeyWordArrFromDbResult((*query)["keywords"]),
+		Industry:         getStringArrFromDbResult((*query)["industry"]),
+		MinPrice:         qutil.ObjToString((*query)["minprice"]),
+		MaxPrice:         qutil.ObjToString((*query)["maxprice"]),
+		Subtype:          qutil.ObjToString((*query)["subtype"]),
+		Area:             getStringArrFromDbResult((*query)["area"]),
+		City:             getStringArrFromDbResult((*query)["city"]),
+		SelectType:       qutil.ObjToString((*query)["selectType"]),
+		PublishTime:      qutil.ObjToString((*query)["publishtime"]),
+		Buyer:            getStringArrFromDbResult((*query)["buyer"]),
+		Buyerclass:       getStringArrFromDbResult((*query)["buyerclass"]),
+		HasBuyerTel:      qutil.ObjToString((*query)["hasBuyertel"]),
+		Winner:           getStringArrFromDbResult((*query)["winner"]),
+		HasWinnerTel:     qutil.ObjToString((*query)["hasWinnertel"]),
+		ComeInTime:       qutil.Int64All((*query)["comeintime"]),
+		Comeinfrom:       qutil.ObjToString((*query)["comeinfrom"]),
+		SelectIds:        getStringArrFromDbResult((*query)["selectIds"]),
+		FileExists:       qutil.ObjToString((*query)["fileExists"]),
+		SearchTypeSwitch: searchTypeSwitch,
 	}
 	}
 }
 }
 
 

+ 15 - 14
src/jfw/modules/common/src/qfw/util/jy/bigVipPower.go

@@ -88,22 +88,23 @@ func ClearBigVipUserPower(userId string) bool {
 	cacheKey := fmt.Sprintf(PowerCacheKey, userId)
 	cacheKey := fmt.Sprintf(PowerCacheKey, userId)
 	return redis.Del(PowerCacheDb, cacheKey)
 	return redis.Del(PowerCacheDb, cacheKey)
 }
 }
+
 //获取商机管理个人基本信息
 //获取商机管理个人基本信息
 func GetEntnicheState(userId string, mysql *mysql.Mysql, mg MongodbSim) *BigVipBaseMsg {
 func GetEntnicheState(userId string, mysql *mysql.Mysql, mg MongodbSim) *BigVipBaseMsg {
-    userPower := BigVipBaseMsg{}
-    userPower.EntnicheStatus = 0
-    //手机号
-    data, ok := mg.FindById("user", userId, `{"s_phone":1,"s_m_phone":1,i_member_status":1,"i_member_give":1,"s_member_mainid":1,"i_member_sub_status":1,"i_member_trial":1,"i_vip_status":1,"o_vipjy":1,"o_jy":1,"l_registedate":1}`)
-    if ok && *data != nil && len(*data) > 0 {
-        //查询是否是商机管理付费用户
-        phone, _ := qutil.If((*data)["s_phone"] != nil, (*data)["s_phone"], (*data)["s_m_phone"]).(string)
-        if phone != "" {
-            if count := mysql.CountBySql(`SELECT count(1) FROM entniche_user u LEFT JOIN entniche_info i ON u.ent_id=i.id WHERE u.phone=? and u.power=1 and i.status=1`, phone); count > 0 {
-                userPower.EntnicheStatus = 1
-            }
-        }
-    }
-    return &userPower
+	userPower := BigVipBaseMsg{}
+	userPower.EntnicheStatus = 0
+	//手机号
+	data, ok := mg.FindById("user", userId, `{"s_phone":1,"s_m_phone":1,i_member_status":1,"i_member_give":1,"s_member_mainid":1,"i_member_sub_status":1,"i_member_trial":1,"i_vip_status":1,"o_vipjy":1,"o_jy":1,"l_registedate":1}`)
+	if ok && *data != nil && len(*data) > 0 {
+		//查询是否是商机管理付费用户
+		phone, _ := qutil.If((*data)["s_phone"] != nil, (*data)["s_phone"], (*data)["s_m_phone"]).(string)
+		if phone != "" {
+			if count := mysql.CountBySql(`SELECT count(1) FROM entniche_user u LEFT JOIN entniche_info i ON u.ent_id=i.id WHERE u.phone=? and u.power=1 and i.status=1`, phone); count > 0 {
+				userPower.EntnicheStatus = 1
+			}
+		}
+	}
+	return &userPower
 }
 }
 
 
 //获取大会员个人基本信息
 //获取大会员个人基本信息

+ 150 - 1
src/jfw/modules/common/src/qfw/util/jy/subscribepush.go

@@ -11,6 +11,7 @@ import (
 	"qfw/util/redis"
 	"qfw/util/redis"
 	"strconv"
 	"strconv"
 	"strings"
 	"strings"
+	"sync"
 	"time"
 	"time"
 
 
 	"go.mongodb.org/mongo-driver/bson/primitive"
 	"go.mongodb.org/mongo-driver/bson/primitive"
@@ -586,7 +587,7 @@ func (s *subscribePush) GetInfoByIds(Mgo_bidding mg.MongodbSim, bidding, bidding
 	return array
 	return array
 }
 }
 
 
-//保存最近7天的数据到历史记录--普通用户
+//保存最近7天的数据到历史记录
 func (s *subscribePush) MakeHistoryDatas(MQFW mg.MongodbSim, PushMysql *mysql.Mysql, userId string, PushView func(userid, allquery, field string, pageNum, pageSize int) (keys []interface{}, list *[]map[string]interface{})) (bool, []*SubPushList) {
 func (s *subscribePush) MakeHistoryDatas(MQFW mg.MongodbSim, PushMysql *mysql.Mysql, userId string, PushView func(userid, allquery, field string, pageNum, pageSize int) (keys []interface{}, list *[]map[string]interface{})) (bool, []*SubPushList) {
 	log.Println("匹配最近7天数据", userId)
 	log.Println("匹配最近7天数据", userId)
 	field := `"_id","title","publishtime","toptype","subtype","type","area","city","s_subscopeclass","buyerclass","budget","bidamount","filetext","spidercode","site"`
 	field := `"_id","title","publishtime","toptype","subtype","type","area","city","s_subscopeclass","buyerclass","budget","bidamount","filetext","spidercode","site"`
@@ -841,3 +842,151 @@ func InfoFormats(info map[string]interface{}, tmp map[string]interface{}) map[st
 	info["type"] = infotype
 	info["type"] = infotype
 	return info
 	return info
 }
 }
+
+//保存最近7天的数据到历史记录--新
+/*已选条件--关键词*/
+type ViewKeyWord struct {
+	Keyword  []string `json:"key"`       //关键词
+	Appended []string `json:"appendkey"` //附加词
+	Exclude  []string `json:"notkey"`    //排除词
+	MatchWay int      `json:"matchway"`  //匹配模式
+}
+
+func (s *subscribePush) MakeHistoryDatasNew(PushMysql *mysql.Mysql, userId string, entId int, DefaultPushList func(userId, moduleFlag string, entId int) (keyword []byte, list *[]map[string]interface{}, deptId int)) (bool, []*SubPushList) {
+	log.Println(s.ModuleFlag, "匹配最近7天数据", userId, entId)
+	//
+	t1 := time.Now()
+	kw, list, deptId := DefaultPushList(userId, s.ModuleFlag, entId)
+	if list == nil || len(*list) == 0 {
+		return false, nil
+	}
+	var isNext = false
+	log.Println("es查询耗时:", time.Since(t1))
+	var resultList []*SubPushList
+	if list != nil && len(*list) > 0 {
+		keyword := []ViewKeyWord{}
+		if err := json.Unmarshal(kw, &keyword); err != nil {
+			return false, nil
+		}
+		//超过50条先处理50条 返回前50条
+		listOne := *list
+		if len(*list) > pageSize {
+			listOne = (*list)[:pageSize]
+		}
+		resultList = s.listManager(PushMysql, listOne, keyword, (len(listOne)+pageSize)/pageSize, entId, deptId, userId)
+		if len(*list) > pageSize {
+			isNext = true
+			listOther := (*list)[pageSize:]
+			go s.listManager(PushMysql, listOther, keyword, (len(listOther)+pageSize)/pageSize, entId, deptId, userId)
+		}
+	}
+	log.Println("第一批推送信息处理耗时:", time.Since(t1).Seconds(), len(resultList))
+	return isNext, resultList
+}
+
+//
+func (s *subscribePush) listManager(PushMysql *mysql.Mysql, list []map[string]interface{}, keyword []ViewKeyWord, ccount, entId, deptId int, userId string) (resultList []*SubPushList) {
+	t2 := time.Now()
+	now := time.Now()
+	var (
+		wg = &sync.WaitGroup{}
+		wc = make(chan bool, ccount)
+	)
+	for _, v := range list {
+		wg.Add(1)
+		wc <- true
+		go func(v map[string]interface{}) {
+			defer func() {
+				wg.Done()
+				<-wc
+			}()
+			redisKey := fmt.Sprintf("pushinfo_%s_%s", userId, ObjToString(v["_id"]))
+			title := strings.Replace(ObjToString(v["title"]), "\n", "", -1)
+			var myInsert = make(map[string]interface{})
+			myInsert["userid"] = userId
+			myInsert["infoid"] = ObjToString(v["_id"])
+			myInsert["date"] = now.Unix()
+			matchkeys := getKeys(title, keyword)
+			myInsert["matchkeys"] = strings.Join(matchkeys, " ")
+			if v["area"] != nil {
+				myInsert["area"] = If(ObjToString(v["area"]) == "A", 0, If(PushMapping.Area[ObjToString(v["area"])] > 0, PushMapping.Area[ObjToString(v["area"])], 0).(int)).(int)
+			}
+			if v["city"] != nil {
+				myInsert["city"] = If(PushMapping.City[ObjToString(v["city"])] > 0, PushMapping.City[ObjToString(v["city"])], 0).(int)
+			}
+			if v["subtype"] != nil {
+				myInsert["subtype"] = If(PushMapping.Subtype[ObjToString(v["subtype"])] > 0, PushMapping.Subtype[ObjToString(v["subtype"])], 0).(int)
+			}
+			if v["toptype"] != nil {
+				myInsert["toptype"] = If(PushMapping.Toptype[ObjToString(v["toptype"])] > 0, PushMapping.Toptype[ObjToString(v["toptype"])], 0).(int)
+			}
+			if v["buyerclass"] != nil {
+				myInsert["buyerclass"] = If(PushMapping.Buyerclass[ObjToString(v["buyerclass"])] > 0, PushMapping.Buyerclass[ObjToString(v["buyerclass"])], 0).(int)
+			}
+			if v["isValidFile"] != nil {
+				isValidFile, _ := v["isValidFile"].(bool)
+				myInsert["attachment_count"] = If(isValidFile, 1, 0).(int) //附件 :检索库 只有附件字段,无法识别附件数量 暂定为1;为识别有附件
+			}
+			if v["bidamount"] != nil {
+				myInsert["bidamount"] = Int64All(v["bidamount"])
+			}
+			if v["budget"] != nil {
+				myInsert["budget"] = Int64All(v["budget"])
+			}
+			if s_subscopeclass := ObjToString(v["s_subscopeclass"]); s_subscopeclass != "" {
+				subscopeclass := []string{}
+				for _, v := range strings.Split(s_subscopeclass, ",") {
+					if subscopeclass_mapping, ok := PushMapping.Subscopeclass[v]; ok {
+						subscopeclass = append(subscopeclass, fmt.Sprint(subscopeclass_mapping))
+					}
+				}
+				if len(subscopeclass) > 0 {
+					myInsert["subscopeclass"] = strings.Join(subscopeclass, ",")
+				}
+			}
+			//商机管理用户
+			if s.ModuleFlag == "s" {
+				myInsert["userid"] = userId
+				myInsert["entid"] = entId
+				myInsert["deptid"] = deptId
+			}
+			//保存推送表
+			id := PushMysql.Insert(aboutDbMsg[s.ModuleFlag].MysqlTable, myInsert)
+			if id > 0 {
+				redis.Put("pushcache_2_a", redisKey, 1, 86400)
+				resultList = append(resultList, s.InfoFormat(&PushCa{
+					InfoId:     ObjToString(v["_id"]),
+					Date:       now.Unix(),
+					Index:      id,
+					Keys:       matchkeys,
+					FileExists: v["filetext"] != nil,
+				}, &v))
+			}
+		}(v)
+	}
+	wg.Wait()
+	log.Println("数据处理耗时:", time.Since(t2))
+	return
+}
+
+//获取匹配得关键词
+func getKeys(title string, keywords []ViewKeyWord) (str []string) {
+	if len(keywords) > 0 {
+	L:
+		for _, v := range keywords {
+			for _, vk := range v.Keyword {
+				if strings.Contains(title, vk) {
+					str = append(str, v.Keyword...)
+					break L
+				}
+			}
+			for _, va := range v.Appended {
+				if strings.Contains(title, va) {
+					str = append(str, v.Appended...)
+					break L
+				}
+			}
+		}
+	}
+	return
+}

+ 4 - 2
src/jfw/modules/common/src/qfw/util/jy/userMerge.go

@@ -91,7 +91,7 @@ func (this *UserMerge) MergeQuery() (wId, pId, bPhone string, err error) {
 //更新session
 //更新session
 func (this *UserMerge) FlushSession(userData *map[string]interface{}, userId string) {
 func (this *UserMerge) FlushSession(userData *map[string]interface{}, userId string) {
 	if userData == nil {
 	if userData == nil {
-		userData, _ = this.mg.FindById("user", userId, `{"_id":1,"i_shareknow":1,"s_m_openid":1,"s_nickname":1,"s_headimage":1,"s_headimageurl":1,"s_phone":1,"s_m_phone":1,"s_jpushid":1,"s_opushid":1,"s_appponetype":1,"s_appversion":1}`)
+		userData, _ = this.mg.FindById("user", userId, `{"_id":1,"i_shareknow":1,"s_m_openid":1,"s_nickname":1,"s_headimage":1,"s_headimageurl":1,"s_phone":1,"s_m_phone":1,"s_jpushid":1,"s_opushid":1,"s_appponetype":1,"s_appversion":1,"base_user_id":1}`)
 	}
 	}
 	sessionVal := make(map[string]interface{})
 	sessionVal := make(map[string]interface{})
 	sessionVal["user"] = *userData
 	sessionVal["user"] = *userData
@@ -131,6 +131,8 @@ func (this *UserMerge) FlushSession(userData *map[string]interface{}, userId str
 	sessionVal["s_appponetype"], _ = (*userData)["s_appponetype"].(string)
 	sessionVal["s_appponetype"], _ = (*userData)["s_appponetype"].(string)
 	sessionVal["s_appversion"], _ = (*userData)["s_appversion"].(string)
 	sessionVal["s_appversion"], _ = (*userData)["s_appversion"].(string)
 	sessionVal["app_name"] = nickName
 	sessionVal["app_name"] = nickName
-
+	if base_userid := qutil.IntAllDef((*userData)["base_user_id"], 0); base_userid != 0 {
+		sessionVal["base_user_id"] = base_userid
+	}
 	this.sess.SetMultiple(sessionVal)
 	this.sess.SetMultiple(sessionVal)
 }
 }

+ 1 - 0
src/jfw/modules/publicapply/src/ad/entity/struct.go

@@ -18,6 +18,7 @@ type AdInfo struct {
 		StartTime string `json:"startTime"` //开始时间
 		StartTime string `json:"startTime"` //开始时间
 		EndTime   string `json:"endTime"`   //结束时间
 		EndTime   string `json:"endTime"`   //结束时间
 	} `json:"o_extend"` //拓展属性
 	} `json:"o_extend"` //拓展属性
+	S_script string `json:"s_script"` //脚本
 }
 }
 
 
 //Handle 广告位信息处理
 //Handle 广告位信息处理

+ 7 - 20
src/jfw/modules/publicapply/src/bidcollection/entity/entity.go

@@ -512,35 +512,22 @@ func GetInfoById(Mgo_bidding mg.MongodbSim, bidding, bidding_back string, idlist
 		return array
 		return array
 	}
 	}
 	m := map[string]bool{}
 	m := map[string]bool{}
-	ids := []string{}
+	es_ids := []string{}
 	for _, v := range idlist {
 	for _, v := range idlist {
 		if m[qu.ObjToString(v["bid"])] {
 		if m[qu.ObjToString(v["bid"])] {
 			continue
 			continue
 		}
 		}
 		m[qu.ObjToString(v["bid"])] = true
 		m[qu.ObjToString(v["bid"])] = true
-		ids = append(ids, qu.ObjToString(v["bid"]))
+		es_ids = append(es_ids, qu.ObjToString(v["bid"]))
 	}
 	}
 	infos := map[string]map[string]interface{}{}
 	infos := map[string]map[string]interface{}{}
-	// log.Println("ids:", len(ids))
-	//redis
-	es_ids := ids
-	for _, v := range ids {
-		info_i := redis.Get("pushcache_1", fmt.Sprintf("info_%s", v))
-		if info_i != nil {
-			info_m, _ := info_i.(map[string]interface{})
-			info_m["_id"] = v
-			infos[v] = info_m
-		} else {
-			es_ids = append(es_ids, v)
-		}
-	}
 	// log.Println("es_ids:", len(es_ids))
 	// log.Println("es_ids:", len(es_ids))
 	if len(es_ids) > 0 {
 	if len(es_ids) > 0 {
 		list := elastic.Get("bidding", "bidding", fmt.Sprintf(querys, strings.Join(es_ids, `","`), len(es_ids)))
 		list := elastic.Get("bidding", "bidding", fmt.Sprintf(querys, strings.Join(es_ids, `","`), len(es_ids)))
 		if list != nil {
 		if list != nil {
 			for _, v := range *list {
 			for _, v := range *list {
 				_id := qu.ObjToString(v["_id"])
 				_id := qu.ObjToString(v["_id"])
-				v["attachment_count"] = qu.If(v["filetext"] != nil, 1, 0).(int)
+				v["isValidFile"], _ = v["isValidFile"].(bool)
 				infos[_id] = v
 				infos[_id] = v
 			}
 			}
 		}
 		}
@@ -549,7 +536,7 @@ func GetInfoById(Mgo_bidding mg.MongodbSim, bidding, bidding_back string, idlist
 	//mongodb bidding
 	//mongodb bidding
 	//fmt.Println(1)
 	//fmt.Println(1)
 	mgo_ids := []primitive.ObjectID{}
 	mgo_ids := []primitive.ObjectID{}
-	for _, v := range ids {
+	for _, v := range es_ids {
 		if infos[v] == nil {
 		if infos[v] == nil {
 			_id, _ := primitive.ObjectIDFromHex(v)
 			_id, _ := primitive.ObjectIDFromHex(v)
 			mgo_ids = append(mgo_ids, _id)
 			mgo_ids = append(mgo_ids, _id)
@@ -561,7 +548,7 @@ func GetInfoById(Mgo_bidding mg.MongodbSim, bidding, bidding_back string, idlist
 			for _, v := range *list {
 			for _, v := range *list {
 				_id := mg.BsonIdToSId(v["_id"])
 				_id := mg.BsonIdToSId(v["_id"])
 				v["_id"] = _id
 				v["_id"] = _id
-				v["attachment_count"] = qu.If(v["attach_text"] != nil, 1, 0).(int)
+				v["isValidFile"], _ = v["isValidFile"].(bool)
 				infos[_id] = v
 				infos[_id] = v
 			}
 			}
 		}
 		}
@@ -580,7 +567,7 @@ func GetInfoById(Mgo_bidding mg.MongodbSim, bidding, bidding_back string, idlist
 			for _, v := range *list {
 			for _, v := range *list {
 				_id := mg.BsonIdToSId(v["_id"])
 				_id := mg.BsonIdToSId(v["_id"])
 				v["_id"] = _id
 				v["_id"] = _id
-				v["attachment_count"] = qu.If(v["attach_text"] != nil, 1, 0).(int)
+				v["isValidFile"], _ = v["isValidFile"].(bool)
 				infos[_id] = v
 				infos[_id] = v
 			}
 			}
 		}
 		}
@@ -642,7 +629,7 @@ func InfoFormat(p string, info *map[string]interface{}) *InfoList {
 		Buyer:           qu.ObjToString((*info)["buyer"]),
 		Buyer:           qu.ObjToString((*info)["buyer"]),
 		S_winner:        qu.ObjToString((*info)["s_winner"]),
 		S_winner:        qu.ObjToString((*info)["s_winner"]),
 		Bidopentime:     qu.Int64All((*info)["bidopentime"]),
 		Bidopentime:     qu.Int64All((*info)["bidopentime"]),
-		FileExists:      qu.If(config.Config.FileSignBool, qu.IntAll((*info)["attachment_count"]) > 0, false).(bool),
+		FileExists:      qu.If(config.Config.FileSignBool && (*info)["isValidFile"] != nil, (*info)["isValidFile"], false).(bool),
 		Site:            qu.ObjToString((*info)["site"]),
 		Site:            qu.ObjToString((*info)["site"]),
 		Spidercode:      qu.ObjToString((*info)["spidercode"]),
 		Spidercode:      qu.ObjToString((*info)["spidercode"]),
 	}
 	}

+ 249 - 0
src/jfw/modules/publicapply/src/subscribePush/entity/historyPush.go

@@ -3,9 +3,15 @@ package entity
 import (
 import (
 	"db"
 	"db"
 	"encoding/json"
 	"encoding/json"
+	"fmt"
+	"log"
 	"qfw/util"
 	"qfw/util"
 	"qfw/util/elastic"
 	"qfw/util/elastic"
 	"qfw/util/jy"
 	"qfw/util/jy"
+	"strconv"
+	"strings"
+	es "subscribePush/entity/service"
+	"time"
 )
 )
 
 
 type historyPush struct {
 type historyPush struct {
@@ -71,3 +77,246 @@ func PushView(userid, allquery, field string, pageNum, pageSize int) (keys []int
 	list = elastic.GetResForJY(INDEX, TYPE, allkeys, allquery, `"title"`, `{"publishtime":"desc"}`, field, (pageNum-1)*pageSize, pageSize)
 	list = elastic.GetResForJY(INDEX, TYPE, allkeys, allquery, `"title"`, `{"publishtime":"desc"}`, field, (pageNum-1)*pageSize, pageSize)
 	return
 	return
 }
 }
+
+const (
+	bidField   = `"_id","title","publishtime","toptype","subtype","type","area","city","s_subscopeclass","buyerclass","budget","bidamount","isValidFile","spidercode","site"`
+	bidTime    = `{"range":{"publishtime":{"gt":%d}}}`
+	bidSort    = `{"publishtime":"desc"}`
+	findfields = `"title"`
+)
+
+type defaultPush struct {
+	UserId     string
+	EntId      int
+	Size       int
+	ModuleFlag string
+}
+
+func DefaultPushList(userId, moduleFlag string, entId int) (keyword []byte, list *[]map[string]interface{}, deptId int) {
+	if userId == "" {
+		return
+	}
+	dp := defaultPush{
+		UserId:     userId,
+		EntId:      entId,
+		Size:       50,
+		ModuleFlag: moduleFlag,
+	}
+	scd, deptid := dp.getUserInfo()
+	if len(scd.Keyword) > 0 {
+		deptId = deptid
+		keyword, _ = json.Marshal(scd.Keyword)
+		//获取查询语句
+		qstr := dp.getDefaultDatasSQL(scd)
+		list = elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSort, bidField, 0, dp.Size, 0, false)
+	}
+	return
+}
+
+//获取用户信息
+func (d *defaultPush) getUserInfo() (vc *ViewCondition, deptId int) {
+	t1 := time.Now()
+	var isPayBool = false
+	var tmpInfo = struct {
+		Items      []interface{}
+		BuyerClass []interface{}
+		SubType    []interface{}
+		Area       map[string]interface{}
+		SelectType string
+	}{}
+	switch d.ModuleFlag {
+	case "m":
+		//大会员
+		userMap, ok := db.Mgo.FindById("user", d.UserId, `{"o_member_jy":1,"i_member_status":1}`)
+		if !ok || userMap == nil || len(*userMap) == 0 {
+			return &ViewCondition{}, 0
+		}
+		if util.IntAll((*userMap)["i_member_status"]) > 0 {
+			isPayBool = true
+			o_member_jy, _ := (*userMap)["o_member_jy"].(map[string]interface{})
+			tmpInfo.Items, _ = o_member_jy["a_items"].([]interface{})
+			tmpInfo.BuyerClass, _ = o_member_jy["a_buyerclass"].([]interface{})
+			tmpInfo.SubType, _ = o_member_jy["a_infotype"].([]interface{})
+			tmpInfo.Area, _ = o_member_jy["o_area"].(map[string]interface{})
+		}
+	case "v":
+		//超级订阅
+		userMap, ok := db.Mgo.FindById("user", d.UserId, `{"o_vipjy":1,"i_vip_status":1}`)
+		if !ok || userMap == nil || len(*userMap) == 0 {
+			return &ViewCondition{}, 0
+		}
+		if util.IntAll((*userMap)["i_vip_status"]) > 0 {
+			isPayBool = true
+			o_vipjy, _ := (*userMap)["o_vipjy"].(map[string]interface{})
+			tmpInfo.Items, _ = o_vipjy["a_items"].([]interface{})
+			tmpInfo.BuyerClass, _ = o_vipjy["a_buyerclass"].([]interface{})
+			tmpInfo.SubType, _ = o_vipjy["a_infotype"].([]interface{})
+			tmpInfo.Area, _ = o_vipjy["o_area"].(map[string]interface{})
+		}
+	case "s":
+		//商机管理
+		entUserId, _ := strconv.Atoi(d.UserId)
+		if d.UserId == "" || d.EntId == 0 {
+			return &ViewCondition{}, 0
+		}
+		var entInfo map[string]interface{}
+		entInfo, deptId = (&es.MatchJob{}).Start(d.EntId, entUserId)
+		if entInfo != nil && len(entInfo) > 0 {
+			isPayBool = true
+			tmpInfo.Items, _ = entInfo["a_items"].([]interface{})
+			tmpInfo.BuyerClass, _ = entInfo["a_buyerclass"].([]interface{})
+			tmpInfo.SubType, _ = entInfo["a_infotype"].([]interface{})
+			tmpInfo.Area, _ = entInfo["o_area"].(map[string]interface{})
+		}
+	default:
+		//免费用户
+		userMap, ok := db.Mgo.FindById("user", d.UserId, `{"o_jy":1}`)
+		if !ok || userMap == nil || len(*userMap) == 0 {
+			return &ViewCondition{}, 0
+		}
+		o_jy, _ := (*userMap)["o_jy"].(map[string]interface{})
+		if o_jy["a_key"] != nil {
+			tmpInfo.Items, _ = o_jy["a_key"].([]interface{})
+			//信息类型
+			tmpInfo.SubType, _ = o_jy["a_infotype"].([]interface{})
+			//省份
+			tmpInfo.Area, _ = o_jy["o_area"].(map[string]interface{})
+			if util.IntAllDef(o_jy["i_ppstatus"], 0) == 1 && o_jy["o_area_p"] != nil {
+				tmpInfo.Area, _ = o_jy["o_area_p"].(map[string]interface{})
+			}
+		}
+	}
+	vc = &ViewCondition{
+		Buyerclass: util.ObjArrToStringArr(tmpInfo.BuyerClass),
+		Subtype:    util.ObjArrToStringArr(tmpInfo.SubType),
+		Area:       getStringArrFromDbResult(tmpInfo.Area, 1),
+		City:       getStringArrFromDbResult(tmpInfo.Area, 2),
+		SelectType: "1",
+	}
+	//付费用户
+	if isPayBool {
+		d.Size = 1000
+		vc.Keyword = getKeyWordArrFromDbResult(tmpInfo.Items, "", -1)
+	} else {
+		vc.Keyword = getKeyWordArrFromDbResultByFree(tmpInfo.Items, "", -1)
+	}
+	log.Println("获取用户信息耗时:", time.Since(t1).Seconds())
+	return
+}
+
+//获取查询语句
+func (d *defaultPush) getDefaultDatasSQL(scd *ViewCondition) (str string) {
+	query := `{"query":{"bool":{"must":[%s],"should":[%s],"minimum_should_match": %d}}}`
+	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}}`
+
+	bools := []string{}
+	musts := []string{}
+	//发布时间最新7天
+	musts = append(musts, fmt.Sprintf(bidTime, time.Now().AddDate(0, 0, -7).Unix()))
+	//省份
+	areaCity := []string{}
+	if len(scd.Area) > 0 {
+		areaquery := `{"terms":{"area":[`
+		for k, v := range scd.Area {
+			if k > 0 {
+				areaquery += `,`
+			}
+			areaquery += `"` + v + `"`
+		}
+		areaquery += `]}}`
+		areaCity = append(areaCity, areaquery)
+	}
+
+	//城市
+	if len(scd.City) > 0 {
+		areaquery := `{"terms":{"city":[`
+		for k, v := range scd.City {
+			if k > 0 {
+				areaquery += `,`
+			}
+			areaquery += `"` + v + `"`
+		}
+		areaquery += `]}}`
+		areaCity = append(areaCity, areaquery)
+	}
+	if len(areaCity) > 0 {
+		musts = append(musts, fmt.Sprintf(query_bool_should, strings.Join(areaCity, ",")))
+	}
+	if len(scd.Subtype) > 0 {
+		subquery := `{"terms":{"subtype":[`
+		for k, v := range scd.Subtype {
+			if k > 0 {
+				subquery += `,`
+			}
+			subquery += `"` + v + `"`
+		}
+		subquery += `]}}`
+		musts = append(musts, subquery)
+	}
+	if len(scd.Buyerclass) > 0 {
+		Buyerclass := `{"terms":{"buyerclass":[`
+		for k, v := range scd.Buyerclass {
+			if k > 0 {
+				Buyerclass += `,`
+			}
+			Buyerclass += `"` + v + `"`
+		}
+		Buyerclass += `]}}`
+		musts = append(musts, Buyerclass)
+	}
+	boolsNum := 0 //should
+	if len(scd.Keyword) > 0 {
+		boolsNum = 1
+		if scd.SelectType == "" || scd.SelectType == "2" {
+			scd.SelectType = "detail\", \"title"
+		} else {
+			scd.SelectType = "title"
+		}
+		multi_match = fmt.Sprintf(multi_match, "%s", "\""+scd.SelectType+"\"")
+
+		for _, v := range scd.Keyword {
+			shoulds := []string{}
+			must_not := []string{}
+			//附加词
+			for _, vv := range v.Keyword {
+				vv = strings.TrimSpace(vv)
+				if vv == "" {
+					continue
+				}
+				shoulds = append(shoulds, fmt.Sprintf(multi_match, "\""+vv+"\""))
+			}
+
+			for _, vv := range v.Appended {
+				vv = strings.TrimSpace(vv)
+				if vv == "" {
+					continue
+				}
+				shoulds = append(shoulds, fmt.Sprintf(multi_match, "\""+vv+"\""))
+			}
+
+			//排除词
+			for _, vv := range v.Exclude {
+				vv = strings.TrimSpace(vv)
+				if vv == "" {
+					continue
+				}
+				must_not = append(must_not, fmt.Sprintf(multi_match, "\""+vv+"\""))
+			}
+
+			//添加
+			if len(shoulds) > 0 {
+				notStr := ""
+				if len(must_not) > 0 {
+					notStr = fmt.Sprintf(`,"must_not":[%s]`, strings.Join(must_not, ","))
+				}
+				bools = append(bools, fmt.Sprintf(query_bool_must_and, strings.Join(shoulds, ","), notStr))
+			}
+		}
+	}
+
+	qstr := fmt.Sprintf(query, strings.Join(musts, ","), strings.Join(bools, ","), boolsNum)
+	log.Println("----", qstr)
+	return qstr
+}

+ 241 - 0
src/jfw/modules/publicapply/src/subscribePush/entity/service/entity.go

@@ -0,0 +1,241 @@
+package service
+
+import (
+	"log"
+	. "mongodb"
+	util "qfw/util"
+	"qfw/util/mysql"
+)
+
+func ClearEnt() {
+	Ents = map[int]*Ent{}
+	EntUsers = map[int]*EntUser{}
+	EntUserDept = map[int]*EntDeptUser{}
+	EntDeptUsers = map[int][]*EntDeptUser{}
+	EntRuleUsers = map[string][]*EntRuleUser{}
+	EntUserRules = map[int][]*EntRuleUser{}
+	EntDepts = map[int]*EntDept{}
+	EntParentDept = map[int][]*EntDeptParent{}
+	EntChildDept = map[int][]*EntDeptParent{}
+	EntDeptDis = map[int][]*EntDistribute{}
+}
+
+//
+func InitEnt(mysql *mysql.Mysql, mgo *MongodbSim, dbName string, entId, entUserId int) {
+	InitEnts(mysql, entId)
+	InitEntUsers(mysql, entUserId)
+	InitEntDeptUsers(mysql, entUserId)
+	InitEntRuleUsers(mysql, entUserId)
+	InitEntDepts(mysql, entId)
+	InitEntDeptParents(mysql, entId)
+	InitEntDistribute(mgo, dbName, entId)
+}
+
+///////////////////////
+var Ents = map[int]*Ent{}
+
+type Ent struct {
+	Id         int
+	Model      int
+	Name       string
+	DeptParent map[int][]int
+	IsNew      int
+}
+
+func InitEnts(Mysql *mysql.Mysql, entId int) {
+	list := Mysql.SelectBySql("select id,model,name from entniche_info where id=? and isNew=1 and status=1 and model in (1,2)", entId)
+	if list == nil {
+		return
+	}
+	for _, v := range *list {
+		id := util.IntAll(v["id"])
+		Ents[id] = &Ent{
+			Id:    id,
+			Model: util.IntAll(v["model"]),
+			Name:  util.ObjToString(v["name"]),
+		}
+	}
+	log.Println("entniche_info加载完成!")
+}
+
+var EntDepts = map[int]*EntDept{}
+
+type EntDept struct {
+	Id     int
+	Pid    int
+	Name   string
+	Nodiff int
+	Subdis int
+}
+
+func InitEntDepts(Mysql *mysql.Mysql, entId int) {
+	list := Mysql.SelectBySql(`select id,name,pid,subdis,nodiff from entniche_department where ent_id=?`, entId)
+	if list == nil {
+		return
+	}
+	for _, v := range *list {
+		id := util.IntAll(v["id"])
+		EntDepts[id] = &EntDept{
+			Id:     id,
+			Pid:    util.IntAll(v["pid"]),
+			Nodiff: util.IntAll(v["nodiff"]),
+			Subdis: util.IntAll(v["subdis"]),
+			Name:   util.ObjToString(v["name"]),
+		}
+	}
+	log.Println("entniche_department加载完成!")
+}
+
+var EntUsers = map[int]*EntUser{}
+
+type EntUser struct {
+	Id    int
+	Name  string
+	Mail  string
+	Phone string
+	Power int
+}
+
+func InitEntUsers(Mysql *mysql.Mysql, entUserId int) {
+	list := Mysql.SelectBySql(`select id,name,mail,phone,power from entniche_user where id=?`, entUserId)
+	if list == nil {
+		return
+	}
+	for _, v := range *list {
+		id := util.IntAll(v["id"])
+		EntUsers[id] = &EntUser{
+			Id:    id,
+			Name:  util.ObjToString(v["name"]),
+			Mail:  util.ObjToString(v["mail"]),
+			Phone: util.ObjToString(v["phone"]),
+			Power: util.IntAll(v["power"]),
+		}
+	}
+	log.Println("entniche_user加载完成!")
+}
+
+//我所有的父部门
+var EntParentDept = map[int][]*EntDeptParent{}
+
+//我所有的子部门
+var EntChildDept = map[int][]*EntDeptParent{}
+
+type EntDeptParent struct {
+	Id  int
+	Pid int
+}
+
+func InitEntDeptParents(Mysql *mysql.Mysql, entId int) {
+	list := Mysql.SelectBySql(`select a.id,a.pid from entniche_department_parent a inner join entniche_department b on (a.id=b.id and b.ent_id=?)`, entId)
+	if list == nil {
+		return
+	}
+	for _, v := range *list {
+		id := util.IntAll(v["id"])
+		pid := util.IntAll(v["pid"])
+		EntParentDept[id] = append(EntParentDept[id], &EntDeptParent{
+			Id:  id,
+			Pid: pid,
+		})
+		EntChildDept[pid] = append(EntChildDept[pid], &EntDeptParent{
+			Id:  id,
+			Pid: pid,
+		})
+	}
+	log.Println("entniche_department_parent加载完成!")
+}
+
+var EntUserDept = map[int]*EntDeptUser{}
+var EntDeptUsers = map[int][]*EntDeptUser{}
+
+type EntDeptUser struct {
+	UserId int
+	DeptId int
+}
+
+func InitEntDeptUsers(Mysql *mysql.Mysql, entUserId int) {
+	list := Mysql.SelectBySql(`select dept_id,user_id from entniche_department_user where user_id=?`, entUserId)
+	if list == nil {
+		return
+	}
+	for _, v := range *list {
+		user_id := util.IntAll(v["user_id"])
+		dept_id := util.IntAll(v["dept_id"])
+		entDeptUser := &EntDeptUser{
+			UserId: user_id,
+			DeptId: dept_id,
+		}
+		EntUserDept[user_id] = entDeptUser
+		EntDeptUsers[dept_id] = append(EntDeptUsers[dept_id], entDeptUser)
+	}
+	log.Println("entniche_department_user加载完成!")
+}
+
+var EntRuleUsers = map[string][]*EntRuleUser{}
+var EntUserRules = map[int][]*EntRuleUser{}
+
+type EntRuleUser struct {
+	UserId int
+	RuleId string
+}
+
+func InitEntRuleUsers(Mysql *mysql.Mysql, entUserId int) {
+	list := Mysql.SelectBySql(`select user_id,rule_id from entniche_user_rule where user_id=?`, entUserId)
+	if list == nil {
+		return
+	}
+	for _, v := range *list {
+		ruleId := util.ObjToString(v["rule_id"])
+		userId := util.IntAll(v["user_id"])
+		entRuleUser := &EntRuleUser{
+			UserId: userId,
+			RuleId: ruleId,
+		}
+		EntRuleUsers[ruleId] = append(EntRuleUsers[ruleId], entRuleUser)
+		EntUserRules[userId] = append(EntUserRules[userId], entRuleUser)
+	}
+	log.Println("entniche_user_rule加载完成!")
+}
+
+var EntDeptDis = map[int][]*EntDistribute{}
+
+type EntDistribute struct {
+	Id         string
+	DeptId     int
+	Area       map[string]interface{}
+	Buyerclass []interface{}
+	Items      []string
+}
+
+func InitEntDistribute(mgo *MongodbSim, dbName string, entId int) {
+	sess := mgo.GetMgoConn()
+	defer mgo.DestoryMongoConn(sess)
+	it := sess.DB(dbName).C("entniche_distribute").Find(map[string]interface{}{
+		"i_status": map[string]interface{}{"$ne": 1},
+		"i_entid":  entId,
+	}).Select(map[string]interface{}{
+		"_id":          1,
+		"i_entid":      1,
+		"i_deptid":     1,
+		"a_items":      1,
+		"o_area":       1,
+		"a_buyerclass": 1,
+	}).Iter()
+	for temp := make(map[string]interface{}); it.Next(&temp); {
+		if temp["i_deptid"] == nil {
+			continue
+		}
+		deptId := util.IntAll(temp["i_deptid"])
+		a_items, _ := temp["a_items"].([]interface{})
+		o_area, _ := temp["o_area"].(map[string]interface{})
+		a_buyerclass, _ := temp["a_buyerclass"].([]interface{})
+		EntDeptDis[deptId] = append(EntDeptDis[deptId], &EntDistribute{
+			Id:         BsonIdToSId(temp["_id"]),
+			DeptId:     deptId,
+			Area:       o_area,
+			Buyerclass: a_buyerclass,
+			Items:      util.ObjArrToStringArr(a_items),
+		})
+		temp = make(map[string]interface{})
+	}
+}

+ 260 - 0
src/jfw/modules/publicapply/src/subscribePush/entity/service/matchjob.go

@@ -0,0 +1,260 @@
+package service
+
+import (
+	"db"
+	"log"
+	util "qfw/util"
+)
+
+//用户基本信息
+type UserInfo struct {
+	Entniche *Entniche
+	SubSet   map[string]interface{}
+}
+
+//
+type Entniche struct {
+	EntId    int    //企业id
+	EntName  string //企业名称
+	DeptId   int    //部门id
+	DeptName string //部门名称
+	DisId    string //分发id
+	UserId   int
+}
+type MatchJob struct {
+}
+
+func (m *MatchJob) Start(entId, entUserId int) (map[string]interface{}, int) {
+	defer util.Catch()
+	defer ClearEnt()
+	InitEnt(db.Mysql, &db.Mgo, "qfw", entId, entUserId)
+	users := m.LoadSubSet(entId)
+	return FinalSub(entUserId, users), EntUserDept[entUserId].DeptId
+}
+
+func (m *MatchJob) LoadSubSet(entId int) map[*UserInfo]bool {
+	defer util.Catch()
+	Users := map[*UserInfo]bool{}
+	sess := db.Mgo.GetMgoConn()
+	defer db.Mgo.DestoryMongoConn(sess)
+	it := sess.DB("qfw").C("entniche_rule").Find(map[string]interface{}{
+		"i_entid": entId,
+	}).Select(map[string]interface{}{
+		"i_entid":    1,
+		"i_deptid":   1,
+		"i_userid":   1,
+		"o_entniche": 1,
+	}).Iter()
+	for _temp := make(map[string]interface{}); it.Next(&_temp); {
+		func(temp map[string]interface{}) {
+			entId := util.IntAll(temp["i_entid"])
+			deptId := util.IntAll(temp["i_deptid"])
+			userId := util.IntAll(temp["i_userid"])
+			if entId == 0 || (deptId == 0 && userId == 0) {
+				return
+			} else if Ents[entId] == nil {
+				log.Println("没有找到该企业", entId)
+				return
+			}
+			entName := Ents[entId].Name
+			if deptId > 0 && EntDepts[deptId] == nil {
+				log.Println("没有找到该部门", entName, entId, deptId)
+				return
+			}
+			deptName := ""
+			if EntDepts[deptId] != nil {
+				deptName = EntDepts[deptId].Name
+			}
+			subSet, _ := temp["o_entniche"].(map[string]interface{})
+			if subSet == nil || len(subSet) == 0 {
+				log.Println("订阅设置为空,过滤掉", entName, entId, deptName, deptId, userId)
+				return
+			}
+			//
+			if deptId > 0 { //部门订阅
+				if Ents[entId].Model != 1 {
+					log.Println("不是统一订阅模式,过滤掉", entName, entId, deptName, deptId)
+					return
+				} else if EntDepts[deptId] == nil {
+					log.Println("没有找到该部门,过滤掉", entName, entId, deptName, deptId)
+					return
+				} else if EntDepts[deptId].Subdis == 0 {
+					log.Println("该部门的订阅分发没有开启,过滤掉", entName, entId, deptName, deptId)
+					return
+				} else if EntDepts[deptId].Nodiff == 0 && EntDeptDis[deptId] == nil {
+					log.Println("该部门开启了订阅分发,没有开启全员无差别接收,但是没有分发规则,过滤掉", entName, entId, deptName, deptId)
+					return
+				}
+				//如果我的上级部门打开了订阅分发,并且开启了全员无差别接收,本部门规则无效
+				for _, dept := range EntParentDept[deptId] {
+					if EntDepts[dept.Pid].Subdis == 1 && EntDepts[dept.Pid].Nodiff == 1 {
+						log.Println("我的上级部门", dept.Pid, "开启了订阅分发和全员无差别,过滤掉", entName, entId, deptName, deptId)
+						return
+					}
+				}
+			} else if userId > 0 { //个人订阅
+				if Ents[entId].Model != 2 {
+					log.Println("不是个人订阅模式,过滤掉", entName, entId, userId)
+					return
+				} else if EntUsers[userId] == nil {
+					log.Println("没有找到该用户,过滤掉", entName, entId, userId)
+					return
+				} else if EntUsers[userId].Power == 0 {
+					log.Println("该用户没有权限,过滤掉", entName, entId, userId)
+					return
+				}
+			}
+			user := &UserInfo{
+				Entniche: &Entniche{
+					EntId:    entId,
+					EntName:  entName,
+					DeptId:   deptId,
+					DeptName: deptName,
+					UserId:   userId,
+				},
+				SubSet: subSet,
+			}
+			log.Println("加载订阅设置", "entId", entId, "entName", entName, "deptId", deptId, "deptName", deptName, "userId", userId)
+			Users[user] = true
+			if deptId <= 0 {
+				return
+			}
+			//分发规则
+			if EntDepts[deptId].Nodiff == 1 {
+				log.Println("该部门开启了全员无差别,分发规则无效", entName, entId, deptName, deptId)
+				return
+			} else if EntDeptDis[deptId] == nil {
+				log.Println("该部门没有分发规则", entName, entId, deptName, deptId)
+				return
+			}
+			itemMap := map[string]interface{}{}
+			items, _ := subSet["a_items"].([]interface{})
+			for _, v := range items {
+				item, _ := v.(map[string]interface{})
+				if item == nil {
+					continue
+				}
+				item_name, _ := item["s_item"].(string)
+				if item_name == "" {
+					continue
+				}
+				itemMap[item_name] = item
+			}
+			for _, dis := range EntDeptDis[deptId] {
+				child_items := []interface{}{}
+				for _, item_name := range dis.Items {
+					if itemMap[item_name] == nil {
+						continue
+					}
+					child_items = append(child_items, itemMap[item_name])
+				}
+				child_subSet := map[string]interface{}{}
+				if len(dis.Buyerclass) > 0 {
+					child_subSet["a_buyerclass"] = dis.Buyerclass
+				}
+				if len(dis.Area) > 0 {
+					child_subSet["o_area"] = dis.Area
+				}
+				if len(child_items) > 0 {
+					child_subSet["a_items"] = child_items
+				}
+				if len(child_subSet) == 0 {
+					continue
+				}
+				child_user := &UserInfo{
+					Entniche: &Entniche{
+						EntId:    user.Entniche.EntId,
+						EntName:  user.Entniche.EntName,
+						DeptId:   user.Entniche.DeptId,
+						DeptName: user.Entniche.DeptName,
+						DisId:    dis.Id,
+					},
+					SubSet: child_subSet,
+				}
+				Users[child_user] = true
+			}
+		}(_temp)
+		_temp = make(map[string]interface{})
+	}
+	return Users
+}
+func FinalSub(entUserId int, users map[*UserInfo]bool) map[string]interface{} {
+	for k, _ := range users {
+		if k.Entniche.DeptId > 0 {
+			k.Entniche.DeptName = EntDepts[k.Entniche.DeptId].Name
+			staffIds := GetDeptUserIds(&UserInfo{
+				Entniche: &Entniche{
+					EntId:    k.Entniche.EntId,
+					EntName:  k.Entniche.EntName,
+					DeptId:   k.Entniche.DeptId,
+					DeptName: k.Entniche.DeptName,
+					DisId:    k.Entniche.DisId,
+				},
+			})
+			if staffIds == nil {
+				continue
+			}
+			if staffIds[entUserId] {
+				return k.SubSet
+			}
+		} else if k.Entniche.UserId > 0 {
+			return k.SubSet
+		} else {
+			continue
+		}
+	}
+	return nil
+}
+func GetDeptUserIds(ui *UserInfo) map[int]bool {
+	if EntDepts[ui.Entniche.DeptId].Subdis == 0 {
+		log.Println(ui.Entniche.EntName, ui.Entniche.EntId, ui.Entniche.DeptName, ui.Entniche.DeptId, "没有开启订阅分发,过滤掉")
+		return nil
+	} else if EntDepts[ui.Entniche.DeptId].Nodiff == 0 && ui.Entniche.DisId == "" {
+		log.Println(ui.Entniche.EntName, ui.Entniche.EntId, ui.Entniche.DeptName, ui.Entniche.DeptId, "没有开启全员无差别接收,并且没有分发规则,过滤掉")
+		return nil
+	}
+	//对我的对着生效的用户
+	myIds := map[int]bool{}
+	//打开了全员无差别,下面所有员工都生效
+	if EntDepts[ui.Entniche.DeptId].Nodiff == 1 {
+		for _, v := range EntDeptUsers[ui.Entniche.DeptId] {
+			myIds[v.UserId] = true
+		}
+		for _, v := range EntChildDept[ui.Entniche.DeptId] {
+			for _, vv := range EntDeptUsers[v.Id] {
+				myIds[vv.UserId] = true
+			}
+		}
+		log.Println(ui.Entniche.EntName, ui.Entniche.EntId, ui.Entniche.DeptName, ui.Entniche.DeptId, "该部门打开了全员无差别", len(myIds), "人接收")
+	} else if ui.Entniche.DisId != "" {
+		for _, v := range EntRuleUsers[ui.Entniche.DisId] {
+			myIds[v.UserId] = true
+		}
+		log.Println(ui.Entniche.EntName, ui.Entniche.EntId, ui.Entniche.DeptName, ui.Entniche.DeptId, "该规则开启了订阅分发", ui.Entniche.DisId, "规则分发了", len(myIds), "人")
+	}
+	//我的上级部门,过滤掉本部门的人
+	for _, v := range EntParentDept[ui.Entniche.DeptId] {
+		//看我的上级部门,有没有开启订阅分发
+		if EntDepts[v.Pid].Subdis == 0 {
+			continue
+		}
+		//看我的上级部门,有没有全员无差别接收
+		if EntDepts[v.Pid].Nodiff == 1 {
+			log.Println(ui.Entniche.EntName, ui.Entniche.EntId, ui.Entniche.DeptName, ui.Entniche.DeptId, ui.Entniche.DisId, "上级部门", v.Pid, "打开了全员无差别开关,过滤掉")
+			return nil
+		}
+		//看我的上级部门,有没有对我设置规则
+		for _, vv := range EntDeptDis[v.Pid] {
+			for _, vvv := range EntRuleUsers[vv.Id] {
+				_, ok := myIds[vvv.UserId]
+				if !ok {
+					continue
+				}
+				delete(myIds, vvv.UserId)
+				log.Println(ui.Entniche.EntName, ui.Entniche.EntId, ui.Entniche.DeptName, ui.Entniche.DeptId, "上级部门", v.Pid, "对我设置的有", vvv.RuleId, "分发规则,此规则作废", vvv.UserId)
+			}
+		}
+	}
+	log.Println(ui.Entniche.EntName, ui.Entniche.EntId, ui.Entniche.DeptName, ui.Entniche.DeptId, ui.Entniche.DisId, "该规则匹配到", len(myIds), "人")
+	return myIds
+}

+ 4 - 1
src/jfw/modules/publicapply/src/subscribePush/entity/vrew.go

@@ -370,11 +370,14 @@ func getstype(stype string) string {
 
 
 // //关键词 附加词 排除词  省份订阅包
 // //关键词 附加词 排除词  省份订阅包
 func getKeyWordArrFromDbResultByFree(a_items []interface{}, item string, index int) (arr []ViewKeyWord) {
 func getKeyWordArrFromDbResultByFree(a_items []interface{}, item string, index int) (arr []ViewKeyWord) {
-	if a_items == nil {
+	if a_items == nil || len(a_items) == 0 {
 		return
 		return
 	}
 	}
 	for _, v := range a_items {
 	for _, v := range a_items {
 		vmr, _ := v.([]interface{})
 		vmr, _ := v.([]interface{})
+		if len(vmr) == 0 {
+			continue
+		}
 		vm, _ := vmr[0].(map[string]interface{})
 		vm, _ := vmr[0].(map[string]interface{})
 		if item != "" && index >= 0 && item != qutil.ObjToString(vm["s_item"]) {
 		if item != "" && index >= 0 && item != qutil.ObjToString(vm["s_item"]) {
 			continue
 			continue

+ 6 - 4
src/jfw/modules/publicapply/src/subscribePush/service/pushList.go

@@ -163,10 +163,12 @@ func (sp *SubscribePush) HasPushHistory() {
 		spqp.PushMysql = db.MysqlPush
 		spqp.PushMysql = db.MysqlPush
 	}
 	}
 	hasNextPage, _, list := jy.NewSubscribePush(vipType).Datas(spqp)
 	hasNextPage, _, list := jy.NewSubscribePush(vipType).Datas(spqp)
-	//免费用户无推送记录生成推送记录
-	if vipType == "" && hasKeyFlag && len(list) == 0 && spqp.IsEmpty() && !isVipFlag && util.Int64All((*user)["i_member_status"]) <= 0 {
-		flag, data := jy.NewSubscribePush().MakeHistoryDatas(db.Mgo, db.MysqlPush, userId, entity.PushView)
-		if flag && data != nil {
+	//免费用户无推送记录生成推送记录=>默认推送调整-付费用户默认1000条 免费不变
+	if spqp.PageNum <= 1 && len(list) == 0 && spqp.IsEmpty() {
+		//flag, data := jy.NewSubscribePush().MakeHistoryDatas(db.Mgo, db.MysqlPush, userId, entity.PushView)
+		flag, data := jy.NewSubscribePush(vipType).MakeHistoryDatasNew(spqp.PushMysql, userId, entId, entity.DefaultPushList)
+		if data != nil {
+			hasNextPage = flag
 			jsonBytes, err := json.Marshal(data)
 			jsonBytes, err := json.Marshal(data)
 			err = json.Unmarshal(jsonBytes, &list)
 			err = json.Unmarshal(jsonBytes, &list)
 			if err != nil {
 			if err != nil {

+ 2 - 1
src/jfw/modules/subscribepay/src/config.json

@@ -109,5 +109,6 @@
 	},
 	},
 	"smsServiceRpc":"127.0.0.1:932",
 	"smsServiceRpc":"127.0.0.1:932",
 	"nsq":"192.168.3.240:4260",
 	"nsq":"192.168.3.240:4260",
-  "nsq_topic": "jy_event"
+  "nsq_topic": "jy_event",
+  "userCenterApi":"https://web-zxl.jydev.jianyu360.com"
 }
 }

+ 1 - 0
src/jfw/modules/subscribepay/src/config/config.go

@@ -73,6 +73,7 @@ type config struct {
 	SmsServiceRpc      string
 	SmsServiceRpc      string
 	Nsq                string
 	Nsq                string
 	Nsq_Topic          string
 	Nsq_Topic          string
+	UserCenterApi      string
 }
 }
 type mgoConf struct {
 type mgoConf struct {
 	Address           string
 	Address           string

+ 49 - 1
src/jfw/modules/subscribepay/src/service/userAccountInfo.go

@@ -14,6 +14,7 @@ import (
 	"qfw/util/elastic"
 	"qfw/util/elastic"
 	"qfw/util/jy"
 	"qfw/util/jy"
 	"qfw/util/redis"
 	"qfw/util/redis"
+	"qfw/util/usercenter"
 	"strings"
 	"strings"
 	"time"
 	"time"
 	"util"
 	"util"
@@ -354,7 +355,7 @@ func (this *UserAccount) PhoneBind() {
 		}
 		}
 		//校验验证码成功【校验是否需要合并】
 		//校验验证码成功【校验是否需要合并】
 		if step == 2 {
 		if step == 2 {
-			uData, _ := util.MQFW.FindById("user", userId, `{"s_unionid":1,"s_name":1,"s_nickname":1,"s_headimageurl":1,"l_registedate":1,"i_ispush":1,"i_applystatus":1,"i_sex":1,"s_country":1,"s_province":1,"s_city":1,"s_m_openid":1,"a_m_openid":1}`)
+			uData, _ := util.MQFW.FindById("user", userId, `{"s_unionid":1,"s_name":1,"s_nickname":1,"s_headimageurl":1,"l_registedate":1,"i_ispush":1,"i_applystatus":1,"i_sex":1,"s_country":1,"s_province":1,"s_city":1,"s_m_openid":1,"a_m_openid":1,"base_user_id":1}`)
 			if uData == nil && len(*uData) == 0 {
 			if uData == nil && len(*uData) == 0 {
 				return nil, DBQUERY_ERROR
 				return nil, DBQUERY_ERROR
 			}
 			}
@@ -390,6 +391,10 @@ func (this *UserAccount) PhoneBind() {
 				}); bindErr != nil {
 				}); bindErr != nil {
 					return nil, bindErr
 					return nil, bindErr
 				}
 				}
+				//用户中台存储  开始
+				ck, _ := this.GetCookie("SESSIONID")
+				usercenter.UpdateBaseUser(util.MQFW, config.Config.UserCenterApi, userId, ck)
+				//用户中台存储  结束
 				jy.CreateUserMerge(util.MQFW, util.Mysql, this.Session()).FlushSession(nil, userId) //刷新session
 				jy.CreateUserMerge(util.MQFW, util.Mysql, this.Session()).FlushSession(nil, userId) //刷新session
 			} else if mode == "mergeBind" { //跳转绑定-不合并绑定无效
 			} else if mode == "mergeBind" { //跳转绑定-不合并绑定无效
 				if qutil.Int64All((*uData)["l_registedate"]) > config.AutoMergeTimeStamp { //新微信直接绑定
 				if qutil.Int64All((*uData)["l_registedate"]) > config.AutoMergeTimeStamp { //新微信直接绑定
@@ -410,9 +415,19 @@ func (this *UserAccount) PhoneBind() {
 							"o_jy.i_wxpush":  1,
 							"o_jy.i_wxpush":  1,
 						},
 						},
 					}) {
 					}) {
+						//用户中台存储  开始
+						ck, _ := this.GetCookie("SESSIONID")
+						usercenter.UpdateBaseUser(util.MQFW, config.Config.UserCenterApi, mongodb.BsonIdToSId(relationPhoneId), ck)
+						//删除user
+						base_userid_del := usercenter.GetBaseUserId(util.MQFW, userId)
+						usercenter.PostUserCenter(config.Config.UserCenterApi+usercenter.UserCenterDelete, usercenter.ContentType_Json, userId, map[string]interface{}{
+							"appid": "10000",
+							"id":    base_userid_del,
+						}, ck)
 						util.MQFW.Del("user", map[string]interface{}{"_id": mongodb.StringTOBsonId(userId)})
 						util.MQFW.Del("user", map[string]interface{}{"_id": mongodb.StringTOBsonId(userId)})
 						jy.CreateUserMerge(util.MQFW, util.Mysql, this.Session()).FlushSession(nil, relationPhoneId)
 						jy.CreateUserMerge(util.MQFW, util.Mysql, this.Session()).FlushSession(nil, relationPhoneId)
 						redis.Put("session", fmt.Sprintf("usermerge_delete_%s", userId), relationPhoneId, 7*24*60*60)
 						redis.Put("session", fmt.Sprintf("usermerge_delete_%s", userId), relationPhoneId, 7*24*60*60)
+						//用户中台存储  结束
 						return rData, nil
 						return rData, nil
 					}
 					}
 					return nil, fmt.Errorf("账号自动合并异常")
 					return nil, fmt.Errorf("账号自动合并异常")
@@ -548,6 +563,12 @@ func (this *UserAccount) PhoneChange() {
 				log.Printf("%s UserAccount ChangePhone 数据更改手机号异常 \n", userId)
 				log.Printf("%s UserAccount ChangePhone 数据更改手机号异常 \n", userId)
 				return nil, fmt.Errorf("数据更新异常")
 				return nil, fmt.Errorf("数据更新异常")
 			}
 			}
+			//用户中台存储  开始
+			func(phone, userId string) {
+				ck, _ := this.GetCookie("SESSIONID")
+				usercenter.UpdateBaseUser(util.MQFW, config.Config.UserCenterApi, userId, ck)
+			}(phoneVerify, userId)
+			//用户中台存储  结束
 			this.Session().Del(phoneAuthPassSessionKey)
 			this.Session().Del(phoneAuthPassSessionKey)
 			jy.CreateUserMerge(util.MQFW, util.Mysql, this.Session()).FlushSession(nil, userId) //刷新session
 			jy.CreateUserMerge(util.MQFW, util.Mysql, this.Session()).FlushSession(nil, userId) //刷新session
 		}
 		}
@@ -639,6 +660,11 @@ func (this *UserAccount) WxBind() {
 		if bindErr := jy.NewPhoneUtil(util.MQFW).BindWeixin(userId, relationWeixinId, thisPhone, upDateMap); bindErr != nil {
 		if bindErr := jy.NewPhoneUtil(util.MQFW).BindWeixin(userId, relationWeixinId, thisPhone, upDateMap); bindErr != nil {
 			return nil, bindErr
 			return nil, bindErr
 		}
 		}
+
+		//关联用户中台base_user_id  双向关系
+		ck, _ := this.GetCookie("SESSIONID")
+		usercenter.UpdateBaseUser(util.MQFW, config.Config.UserCenterApi, userId, ck)
+		usercenter.UpdateBaseUser(util.MQFW, config.Config.UserCenterApi, relationWeixinId, ck)
 		//刷新session
 		//刷新session
 		jy.CreateUserMerge(util.MQFW, util.Mysql, this.Session()).FlushSession(upDateMap, userId)
 		jy.CreateUserMerge(util.MQFW, util.Mysql, this.Session()).FlushSession(upDateMap, userId)
 		return map[string]interface{}{
 		return map[string]interface{}{
@@ -657,6 +683,7 @@ func (this *UserAccount) WxBind() {
 //    2.解绑的微信存在已绑定的手机号(存在关联关系),解绑后解除关联关系
 //    2.解绑的微信存在已绑定的手机号(存在关联关系),解绑后解除关联关系
 func (this *UserAccount) WxUnBind() {
 func (this *UserAccount) WxUnBind() {
 	userId, _ := this.GetSession("userId").(string)
 	userId, _ := this.GetSession("userId").(string)
+	ck, _ := this.GetCookie("SESSIONID")
 	rData, errMsg := func() (interface{}, error) {
 	rData, errMsg := func() (interface{}, error) {
 		//认证校验
 		//认证校验
 		//if pass, data := authenticationCheck(this.GetSession(phoneAuthPassSessionKey)); !pass {
 		//if pass, data := authenticationCheck(this.GetSession(phoneAuthPassSessionKey)); !pass {
@@ -690,6 +717,25 @@ func (this *UserAccount) WxUnBind() {
 			//公众号微信关注移至另一用户中  此时微信公众号用户session问题错乱
 			//公众号微信关注移至另一用户中  此时微信公众号用户session问题错乱
 			if saveId := util.MQFW.Save("user", unsetMap); saveId == "" {
 			if saveId := util.MQFW.Save("user", unsetMap); saveId == "" {
 				return nil, DBUPDATE_ERROR
 				return nil, DBUPDATE_ERROR
+			} else {
+				//用户中台存储  开始
+				func(phone, userid string) {
+					formdata := map[string]interface{}{
+						"appid":    "10000",
+						"unionid":  qutil.ObjToString((*unsetMap)["s_unionid"]),
+						"s_openid": s_m_openid,
+					}
+					if qutil.ObjToString((*unsetMap)["s_nickname"]) != "" {
+						formdata["nickname"] = qutil.ObjToString((*unsetMap)["s_nickname"])
+					}
+					if qutil.ObjToString((*unsetMap)["s_headimageurl"]) != "" {
+						formdata["headimg"] = qutil.ObjToString((*unsetMap)["s_headimageurl"])
+					}
+					if qutil.ObjToString((*unsetMap)["a_m_openid"]) != "" {
+						formdata["a_openid"] = qutil.ObjToString((*unsetMap)["a_m_openid"])
+					}
+					usercenter.AddBaseUser(util.MQFW, config.Config.UserCenterApi, userid, formdata, ck)
+				}(phone, saveId)
 			}
 			}
 			flushWxsession = true
 			flushWxsession = true
 		}
 		}
@@ -703,6 +749,8 @@ func (this *UserAccount) WxUnBind() {
 		if err := jy.NewPhoneUtil(util.MQFW).UnBindWeixin(userId, wId); err != nil {
 		if err := jy.NewPhoneUtil(util.MQFW).UnBindWeixin(userId, wId); err != nil {
 			return nil, err
 			return nil, err
 		}
 		}
+		//解除baseuser绑定
+		usercenter.UpdateBaseUser(util.MQFW, config.Config.WebDomain, userId, ck)
 
 
 		//微信解绑成功
 		//微信解绑成功
 		//1.微信账户刷新session
 		//1.微信账户刷新session

BIN
src/jfw/modules/subscribepay/src/subscribepay


+ 6 - 5
src/jfw/modules/weixin/src/config.json

@@ -16,11 +16,11 @@
     "weixinrpcport": "8083",
     "weixinrpcport": "8083",
     "webrpcport": "127.0.0.1:8084",
     "webrpcport": "127.0.0.1:8084",
     "jyop_webrpcport": "127.0.0.1:8012",
     "jyop_webrpcport": "127.0.0.1:8012",
-    "webdomain": "https://web-ws.jydev.jianyu360.com",
-    "appid":"wx5b1c6e7cc4dac0e4",
-    "appsecret":"b026103ffebd2291b3edb7a269612112",
+    "webdomain": "https://web-zxl.jydev.jianyu360.com",
+    "appid":"wxdedd73f450993685",
+    "appsecret":"d55898fde0b7887e5fe4660bd2494700",
     "apptoken": "top2022top2022",
     "apptoken": "top2022top2022",
-    "proxysess": "https://web-ws.jydev.jianyu360.com/front/sess/%s",
+    "proxysess": "https://web-zxl.jydev.jianyu360.com/front/sess/%s",
     "followCompany": 10,
     "followCompany": 10,
     "welcomemsg": "用剑鱼标讯,所有功能完全免费,\n和传统的会员制说再见!\n\n<a href='%s'>点击这里</a>设置关键词,或直接回复“订阅 关键词”,如“订阅 教学设备”,您将随时随地接收招标信息!\n\n剑鱼标讯,让投标无限可能!",
     "welcomemsg": "用剑鱼标讯,所有功能完全免费,\n和传统的会员制说再见!\n\n<a href='%s'>点击这里</a>设置关键词,或直接回复“订阅 关键词”,如“订阅 教学设备”,您将随时随地接收招标信息!\n\n剑鱼标讯,让投标无限可能!",
     "tpl_subscribe_push_id": "IY_RWWzMlwDK6hcd6RAzTec6qre8n5r8PNOOUM_hgk0",
     "tpl_subscribe_push_id": "IY_RWWzMlwDK6hcd6RAzTec6qre8n5r8PNOOUM_hgk0",
@@ -127,5 +127,6 @@
     "pcQrCode":{
     "pcQrCode":{
     		"10":true,"11":true,"12":true,"13":true,"14":true,"17":true,"18":true,"19":true
     		"10":true,"11":true,"12":true,"13":true,"14":true,"17":true,"18":true,"19":true
     },
     },
-    "namePrefix":"JY_%s"
+    "namePrefix":"JY_%s",
+    "userCenterApi":"https://web-zxl.jydev.jianyu360.com"
 }
 }

+ 13 - 0
src/jfw/modules/weixin/src/wx/wx.go

@@ -19,6 +19,7 @@ import (
 	"tools"
 	"tools"
 
 
 	"qfw/util/jy"
 	"qfw/util/jy"
+	"qfw/util/usercenter"
 
 
 	"github.com/SKatiyar/qr"
 	"github.com/SKatiyar/qr"
 	_ "github.com/influxdata/influxdb-client"
 	_ "github.com/influxdata/influxdb-client"
@@ -340,6 +341,18 @@ func saveUser(u *UserInfo, source, pre, RSource, CSource string) (bool, string,
 			}
 			}
 		}
 		}
 		_id := tools.MQFW.Save("user", newUser)
 		_id := tools.MQFW.Save("user", newUser)
+		if _id != "" {
+			//用户中台存储  开始
+			formdata := map[string]interface{}{
+				"appid":    "10000",
+				"headimg":  u.HeadImageUrl,
+				"nickname": util.If(u.Nickname != "", u.Nickname, newUser["s_jyname"]),
+				"s_openid": u.OpenId,
+				"unionid":  u.UnionId,
+			}
+			usercenter.AddBaseUser(tools.MQFW, util.ObjToString(config.Sysconfig["userCenterApi"]), _id, formdata, &http.Cookie{})
+
+		}
 		//逻辑转到用户完成绑定手机号时写入nsq队列
 		//逻辑转到用户完成绑定手机号时写入nsq队列
 		// if fromid != "" && fromid != _id {
 		// if fromid != "" && fromid != _id {
 		// 	//被邀请新用户
 		// 	//被邀请新用户

+ 1 - 1
src/jfw/public/dataexport.go

@@ -143,7 +143,7 @@ func (this *BidSearchExport) PassBidSearchExport() (returnData map[string]interf
 		_, _, keywords := jy.InterceptSearchKW(this.Keywords, isIntercept, len(this.Industry) == 0)
 		_, _, keywords := jy.InterceptSearchKW(this.Keywords, isIntercept, len(this.Industry) == 0)
 		keywords = strings.Replace(keywords, "+", " ", -1)
 		keywords = strings.Replace(keywords, "+", " ", -1)
 		excludes := []string{}
 		excludes := []string{}
-		if len(strings.Split(this.Notkey, " ")) > 0 {
+		if this.Notkey != "" && len(strings.Split(this.Notkey, " ")) > 0 {
 			excludes = strings.Split(this.Notkey, " ")
 			excludes = strings.Split(this.Notkey, " ")
 		}
 		}
 		KeyWordSave = append(KeyWordSave, dataexport.KeyWord{Keyword: keywords, Exclude: excludes})
 		KeyWordSave = append(KeyWordSave, dataexport.KeyWord{Keyword: keywords, Exclude: excludes})

+ 1 - 3
src/web/staticres/frontRouter/pc/coupon/js/coupon-item-template.js

@@ -14,8 +14,6 @@ var couponItemString = `
                 </span>
                 </span>
                 <span class="info-condition">满{{ full }}可用</span>
                 <span class="info-condition">满{{ full }}可用</span>
             </div>
             </div>
-            <div class="info-content c-i-h-p-voucher" key="content" v-else-if="attribute.indexOf('实物') != -1">实物券</div>
-            <div class="info-content c-i-h-others" key="content" v-else>优惠券</div>
         </div>
         </div>
         <div class="c-i-h-date">
         <div class="c-i-h-date">
             <span class="c-i-h-date-l">{{ useDate }}</span>
             <span class="c-i-h-date-l">{{ useDate }}</span>
@@ -27,7 +25,7 @@ var couponItemString = `
             <span class="ch-label">适用产品:</span>
             <span class="ch-label">适用产品:</span>
             <span class="ch-text ellipsis">{{ productionsListStr }}</span>
             <span class="ch-text ellipsis">{{ productionsListStr }}</span>
             <el-popover
             <el-popover
-                v-if="productionsListStr.length >= 15"
+                v-if="productionsListStr && productionsListStr.length >= 15"
                 class="ch-icon"
                 class="ch-icon"
                 :placement="popoverConf.placement"
                 :placement="popoverConf.placement"
                 :width="popoverConf.width"
                 :width="popoverConf.width"

+ 3 - 0
src/web/staticres/public-pc/js/article-content.js

@@ -1217,6 +1217,9 @@ $(function(){
   // $(".com-original").attr("dataHref",originalhref);
   // $(".com-original").attr("dataHref",originalhref);
   // 点击阅读原文 用户留资
   // 点击阅读原文 用户留资
   $(".com-original").on('click',function() {
   $(".com-original").on('click',function() {
+    if (entService) {
+      return window.open(originalhref)
+    }
     if (!loginflag) {
     if (!loginflag) {
       openLoginDig()
       openLoginDig()
       return
       return

+ 1 - 1
src/web/staticres/public-pc/js/header-nav.js

@@ -80,7 +80,7 @@ function trySelectNav (name) {
     }
     }
 
 
     // 导航栏是否固定
     // 导航栏是否固定
-    var noFixedArr = ['/article/indexcontent','/article/content', '/article/mailprivate']
+    var noFixedArr = ['/article/indexcontent','/article/content', '/article/mailprivate', '/article/entservice']
     var hasPage = noFixedArr.some(function (v) {
     var hasPage = noFixedArr.some(function (v) {
       return $href.indexOf(v) !== -1
       return $href.indexOf(v) !== -1
     })
     })

+ 11 - 1
src/web/templates/pc/biddetail_rec.html

@@ -1450,7 +1450,9 @@ var ucbs_source="pc_rec",ucbsId="{{.T.obj.ucbsId}}";
 		};
 		};
 	</script>
 	</script>
 	<script type="text/javascript">
 	<script type="text/javascript">
-		var canRead = location.href.indexOf('mailprivate') > -1 || {{.T.canRead}}
+    var pathname = location.pathname
+    var entService = pathname.indexOf('entservice') !== -1
+		var canRead = location.href.indexOf('mailprivate') > -1 || {{.T.canRead}} || entService
     // 免费用户每日查看三次
     // 免费用户每日查看三次
     if(!(goTemplateData.params.obj.subtype == '采购意向' || goTemplateData.params.obj.subtype == '拟建') && !canRead) {
     if(!(goTemplateData.params.obj.subtype == '采购意向' || goTemplateData.params.obj.subtype == '拟建') && !canRead) {
       $('#tip-title').text('免费查看更多公告')
       $('#tip-title').text('免费查看更多公告')
@@ -1464,6 +1466,14 @@ var ucbs_source="pc_rec",ucbsId="{{.T.obj.ucbsId}}";
 
 
 		//是否显示遮罩层
 		//是否显示遮罩层
 		function checkShowDialog (res) {
 		function checkShowDialog (res) {
+      // 企业级用户不显示广告
+      if (entService) {
+        $('.lead-btn-nj').show()
+        $('.tabfat').show()
+        $(".recoveryfat").show()
+        $('.free-download').hide()
+        return 
+      }
 			var bidmember = false
 			var bidmember = false
 			var entniche = false
 			var entniche = false
 			var vip = 0
 			var vip = 0

+ 3 - 3
src/web/templates/pc/supsearch.html

@@ -928,7 +928,7 @@ var IframeOnClick = {
             </span>
             </span>
           </div>
           </div>
           <!--附件-->
           <!--附件-->
-          <div class="attachment-filter clearfix" style="display: none;">
+          <div class="attachment-filter clearfix">
             <div class="leftTitle">
             <div class="leftTitle">
               附件:
               附件:
             </div>
             </div>
@@ -1222,7 +1222,7 @@ var IframeOnClick = {
           <div style="display: flex;">
           <div style="display: flex;">
             <div class="save-value-bg" v-if="curFilter.price"><span>价格区间:</span>${curFilter.price}</div>
             <div class="save-value-bg" v-if="curFilter.price"><span>价格区间:</span>${curFilter.price}</div>
             <div class="save-value-bg" v-if="curFilter.publishTime"><span>发布时间:</span>${curFilter.publishTime}</div>
             <div class="save-value-bg" v-if="curFilter.publishTime"><span>发布时间:</span>${curFilter.publishTime}</div>
-            <div class="save-value-bg" style="display: none;" v-if="curFilter.fileExists != '全部'"><span>附件:</span>${curFilter.fileExists}</div>
+            <div class="save-value-bg" v-if="curFilter.fileExists != '全部'"><span>附件:</span>${curFilter.fileExists}</div>
           </div>
           </div>
           <div class="save-value-bg" v-if="curFilter.region"><span>项目地区:</span>${curFilter.region}</div>
           <div class="save-value-bg" v-if="curFilter.region"><span>项目地区:</span>${curFilter.region}</div>
           <div class="save-value-bg" v-if="curFilter.infoType"><span>信息类型:</span>${curFilter.infoType}</div>
           <div class="save-value-bg" v-if="curFilter.infoType"><span>信息类型:</span>${curFilter.infoType}</div>
@@ -1258,7 +1258,7 @@ var IframeOnClick = {
                 <p class="f-l-c-item">
                 <p class="f-l-c-item">
                   <span v-if="item.minprice || item.maxprice">价格区间:<em class="i-value">${formatPriceScope(item.minprice, item.maxprice)}</em></span>
                   <span v-if="item.minprice || item.maxprice">价格区间:<em class="i-value">${formatPriceScope(item.minprice, item.maxprice)}</em></span>
                   <span v-if="item.publishtime">发布时间:<em class="i-value">${formatPushTime(item.publishtime)}</em></span>
                   <span v-if="item.publishtime">发布时间:<em class="i-value">${formatPushTime(item.publishtime)}</em></span>
-                  <span style="display: none;" v-if="item.fileExists != 0">附件:<em class="i-value">${formatAttach(item.fileExists)}</em></span>
+                  <span v-if="item.fileExists != 0">附件:<em class="i-value">${formatAttach(item.fileExists)}</em></span>
                 </p>
                 </p>
                 <p class="f-l-c-item" v-if="item.area || item.city">项目地区:<em class="i-value">${formatRegion(item.area,item.city)}</em></p>
                 <p class="f-l-c-item" v-if="item.area || item.city">项目地区:<em class="i-value">${formatRegion(item.area,item.city)}</em></p>
                 <p class="f-l-c-item" v-if="item.subtype">信息类型:<em class="i-value">${formatInfoType(item.subtype)}</em></p>
                 <p class="f-l-c-item" v-if="item.subtype">信息类型:<em class="i-value">${formatInfoType(item.subtype)}</em></p>

+ 1 - 1
src/web/templates/weixin/historypush.html

@@ -812,7 +812,7 @@
                                     </span>
                                     </span>
                                 </template>
                                 </template>
                             </van-cell>
                             </van-cell>
-                            <van-cell center style="display: none; height: auto;"  @click="moreFiltersItemShow('fileItem', '附件')">
+                            <van-cell center style="height: auto;"  @click="moreFiltersItemShow('fileItem', '附件')">
                               <template #title>
                               <template #title>
                                   <span v-if="screenShow" class="noticeText">附件</span>
                                   <span v-if="screenShow" class="noticeText">附件</span>
                                   <span v-else class="rootstyletitle">
                                   <span v-else class="rootstyletitle">