Răsfoiți Sursa

feat:修改缓存事件

wangchuanjin 2 ani în urmă
părinte
comite
347dc62e87
3 a modificat fișierele cu 16 adăugiri și 135 ștergeri
  1. 9 129
      src/jfw/front/shorturl.go
  2. 4 4
      src/jfw/front/tags.go
  3. 3 2
      src/jfw/modules/app/src/app/front/shorturl.go

+ 9 - 129
src/jfw/front/shorturl.go

@@ -4,15 +4,15 @@ import (
 	"database/sql"
 	"database/sql"
 	"errors"
 	"errors"
 	"fmt"
 	"fmt"
-	"github.com/gogf/gf/v2/util/gconv"
 	"jy/src/jfw/config"
 	"jy/src/jfw/config"
-	"jy/src/jfw/jyutil"
 	"jy/src/jfw/wx"
 	"jy/src/jfw/wx"
 	"log"
 	"log"
 	"math/rand"
 	"math/rand"
 	"net/url"
 	"net/url"
 	"strconv"
 	"strconv"
 
 
+	"jy/src/jfw/jyutil"
+
 	"app.yhyue.com/moapp/jypkg/public"
 	"app.yhyue.com/moapp/jypkg/public"
 
 
 	util "app.yhyue.com/moapp/jybase/common"
 	util "app.yhyue.com/moapp/jybase/common"
@@ -55,30 +55,6 @@ var Map_stype = map[string]bool{
 	"advancedProject": true,
 	"advancedProject": true,
 }
 }
 
 
-var TypeCodeMap = map[string]string{
-	"拟建":   "拟建项目",
-	"采购意向": "采购意向",
-	"预告":   "招标预告",
-	"预审":   "资格预审",
-	"预审结果": "资格预审结果",
-	"论证意见": "论证意见",
-	"需求公示": "需求公示",
-	"招标":   "公开招标",
-	"邀标":   "邀请招标",
-	"询价":   "询价采购",
-	"竞谈":   "竞争性谈判",
-	"单一":   "单一来源采购",
-	"竞价":   "竞价公告",
-	"变更":   "变更公告",
-	"中标":   "中标公示",
-	"成交":   "成交公告",
-	"废标":   "废标公告",
-	"流标":   "流标公告",
-	"合同":   "合同公告信息",
-	"验收":   "验收公告信息",
-	"违规":   "违规信息",
-}
-
 var seoAgentReg = regexp.MustCompile("Baiduspider|360Spider|bingbot|Googlebot")
 var seoAgentReg = regexp.MustCompile("Baiduspider|360Spider|bingbot|Googlebot")
 
 
 func (s *Short) Article(stype, id string) error {
 func (s *Short) Article(stype, id string) error {
@@ -174,7 +150,6 @@ func (s *Short) LoginCommon(userId, stype, id string) error {
 						retMap["subtype"], _ = obj["subtype"].(string)
 						retMap["subtype"], _ = obj["subtype"].(string)
 						retMap["subscopeclass"], _ = obj["s_subscopeclass"].(string)
 						retMap["subscopeclass"], _ = obj["s_subscopeclass"].(string)
 						retMap["publishtime"] = util.IntAll(obj["publishtime"])
 						retMap["publishtime"] = util.IntAll(obj["publishtime"])
-
 					}
 					}
 					s.T["shareid"] = config.Seoconfig["baiduSEM-p"].(string)
 					s.T["shareid"] = config.Seoconfig["baiduSEM-p"].(string)
 					s.T["logid"] = config.Seoconfig["baiduSEM-p"].(string)
 					s.T["logid"] = config.Seoconfig["baiduSEM-p"].(string)
@@ -209,6 +184,7 @@ func (s *Short) LoginCommon(userId, stype, id string) error {
 			ssOpenid := s.Session().Get("s_m_openid")
 			ssOpenid := s.Session().Get("s_m_openid")
 			po, bo, wo, obj := pcVRT(sid, industry, stype, true)
 			po, bo, wo, obj := pcVRT(sid, industry, stype, true)
 			if obj != nil && len(obj) > 0 {
 			if obj != nil && len(obj) > 0 {
+
 				if len(po) > 0 {
 				if len(po) > 0 {
 					s.T["projectOther"] = po
 					s.T["projectOther"] = po
 				}
 				}
@@ -256,9 +232,9 @@ func (s *Short) LoginCommon(userId, stype, id string) error {
 				}
 				}
 				s.T["url"] = s.Uri()
 				s.T["url"] = s.Uri()
 				s.T["obj"] = obj
 				s.T["obj"] = obj
+
 				content, _ := s.Render4Cache("/pc/biddetail_rec.html", &s.T)
 				content, _ := s.Render4Cache("/pc/biddetail_rec.html", &s.T)
-				timeout := 60 * 20
-				redis.Put("newother", catchKey, string(content), timeout)
+				redis.Put("newother", catchKey, string(content), 60*20)
 				return s.SetBody(content)
 				return s.SetBody(content)
 			}
 			}
 		} else {
 		} else {
@@ -441,8 +417,6 @@ func (s *Short) LoginCommon(userId, stype, id string) error {
 			s.T["advertUrl"] = config.Sysconfig["advertUrl"]
 			s.T["advertUrl"] = config.Sysconfig["advertUrl"]
 			s.T["canRead"] = canRead
 			s.T["canRead"] = canRead
 			obj["industry"] = industry
 			obj["industry"] = industry
-			obj["keywords"] = KeyWordHandle(obj)
-			obj["description"] = DescriptionHandle(stype, obj)
 			s.T["obj"] = obj
 			s.T["obj"] = obj
 			//获取打赏文案
 			//获取打赏文案
 			s.T["rewardText"], s.T["advertText"] = getRewardText()
 			s.T["rewardText"], s.T["advertText"] = getRewardText()
@@ -585,8 +559,7 @@ func (s *Short) LoginCommon(userId, stype, id string) error {
 			if ssOpenid != nil {
 			if ssOpenid != nil {
 				obj["ucbsId"] = encrypt.EncodeArticleId2ByCheck("ucbs#" + ssOpenid.(string) + "#" + id)
 				obj["ucbsId"] = encrypt.EncodeArticleId2ByCheck("ucbs#" + ssOpenid.(string) + "#" + id)
 			}
 			}
-			obj["keywords"] = KeyWordHandle(obj)
-			obj["description"] = DescriptionHandle(stype, obj)
+
 			s.T["obj"] = obj
 			s.T["obj"] = obj
 			s.T["url"] = s.Uri()
 			s.T["url"] = s.Uri()
 			return s.Render("/pc/biddetail_rec.html", &s.T)
 			return s.Render("/pc/biddetail_rec.html", &s.T)
@@ -1034,8 +1007,7 @@ func (s *Short) NologinCommon(userId, stype, id, sid string) error {
 		}
 		}
 		s.T["logid"] = config.Seoconfig["jysskzy"].(string)
 		s.T["logid"] = config.Seoconfig["jysskzy"].(string)
 		s.T["shareid"] = se.EncodeString(shareid)
 		s.T["shareid"] = se.EncodeString(shareid)
-		//s.T["keywords"] = s.GetString("kds")
-
+		s.T["keywords"] = s.GetString("kds")
 		s.DisableHttpCache()
 		s.DisableHttpCache()
 		po, bo, wo, obj := pcVRT(sid, industry, stype, false || false || false)
 		po, bo, wo, obj := pcVRT(sid, industry, stype, false || false || false)
 		if obj != nil && len(obj) > 0 {
 		if obj != nil && len(obj) > 0 {
@@ -1051,7 +1023,6 @@ func (s *Short) NologinCommon(userId, stype, id, sid string) error {
 			FieldProcessing(obj, "", industry, id, "", userId, stype, false)
 			FieldProcessing(obj, "", industry, id, "", userId, stype, false)
 			obj["urlpath"] = s.Uri()
 			obj["urlpath"] = s.Uri()
 			obj["industry"] = industry
 			obj["industry"] = industry
-
 			if userId == "" {
 			if userId == "" {
 				obj["winnerTitle"] = obj["winner"]
 				obj["winnerTitle"] = obj["winner"]
 				obj["buyerTitle"] = obj["buyer"]
 				obj["buyerTitle"] = obj["buyer"]
@@ -1059,21 +1030,18 @@ func (s *Short) NologinCommon(userId, stype, id, sid string) error {
 				obj["projectcodeTitle"] = obj["projectcode"]
 				obj["projectcodeTitle"] = obj["projectcode"]
 				log.Println(time.Now().UnixNano())
 				log.Println(time.Now().UnixNano())
 				obj = Filter(obj)
 				obj = Filter(obj)
-				//obj["description"] = fmt.Sprintf("%s,%s。", obj["title"], baseInfo(obj))
+				obj["description"] = fmt.Sprintf("%s,%s。", obj["title"], baseInfo(obj))
 			}
 			}
 			if obj["publishtime"] != nil {
 			if obj["publishtime"] != nil {
 				obj["publishtimeShorDate"] = time.Unix(util.Int64All(obj["publishtime"]), 0).Format(date.Date_Short_Layout)
 				obj["publishtimeShorDate"] = time.Unix(util.Int64All(obj["publishtime"]), 0).Format(date.Date_Short_Layout)
 			}
 			}
-			obj["keywords"] = KeyWordHandle(obj)
-			obj["description"] = DescriptionHandle("nologin", obj)
 			s.T["obj"] = obj
 			s.T["obj"] = obj
 			s.T["url"] = s.Uri()
 			s.T["url"] = s.Uri()
 			s.T["newBidInfoList"] = tg.GetNewBidInfo()
 			s.T["newBidInfoList"] = tg.GetNewBidInfo()
 			s.T["industryInfoList"] = tg.GetConsult()
 			s.T["industryInfoList"] = tg.GetConsult()
 			s.T["hotLabelList"] = tg.GetHotLabel(30)
 			s.T["hotLabelList"] = tg.GetHotLabel(30)
 			content, _ := s.Render4Cache("/pc/tags/detail.html", &s.T)
 			content, _ := s.Render4Cache("/pc/tags/detail.html", &s.T)
-			timeout := 60 * 60 * 24
-			redis.Put("newother", catchKey, string(content), timeout)
+			redis.Put("newother", catchKey, string(content), 60*2)
 			return s.SetBody(content)
 			return s.SetBody(content)
 		}
 		}
 	} else {
 	} else {
@@ -1151,91 +1119,3 @@ func RegDetail(html string) string {
 	}
 	}
 	return ""
 	return ""
 }
 }
-
-func KeyWordHandle(obj map[string]interface{}) string {
-	keywordArr := []string{}
-	owner := util.InterfaceToStr(obj["owner"])
-	buyer := util.InterfaceToStr(obj["buyer"])
-	if buyer == "" {
-		buyer = owner
-	}
-	if buyer != "" && buyer != config.Sysconfig["detailMosaicTxt"] {
-		keywordArr = append(keywordArr, buyer)
-	}
-	if util.InterfaceToStr(obj["s_winner"]) != "" && util.InterfaceToStr(obj["s_winner"]) != config.Sysconfig["detailMosaicTxt"] {
-		keywordArr = append(keywordArr, util.InterfaceToStr(obj["s_winner"]))
-	}
-	if obj["purchasinglist"] != nil && obj["purchasinglist"] != "" {
-		i := 0
-		for _, v := range gconv.SliceMap(obj["purchasinglist"]) {
-			if i == 5 {
-				break
-				if util.InterfaceToStr(v["itemname"]) != "" && util.InterfaceToStr(obj["s_winner"]) != config.Sysconfig["detailMosaicTxt"] {
-					keywordArr = append(keywordArr, util.InterfaceToStr(v["itemname"]))
-					i++
-				}
-			}
-		}
-	}
-	if util.InterfaceToStr(obj["subtype"]) != "" && util.InterfaceToStr(obj["subtype"]) != "其它" {
-		keywordArr = append(keywordArr, TypeCodeMap[util.InterfaceToStr(obj["subtype"])])
-	}
-	if util.InterfaceToStr(obj["area"]) != "" {
-		keywordArr = append(keywordArr, util.InterfaceToStr(obj["area"])+"招标")
-	}
-	if util.InterfaceToStr(obj["city"]) != "" {
-		keywordArr = append(keywordArr, util.InterfaceToStr(obj["city"])+"招标")
-	}
-	keywordArr = append(keywordArr, "剑鱼标讯")
-	keyword := strings.Join(keywordArr, ",")
-	return keyword
-}
-func DescriptionHandle(stype string, obj map[string]interface{}) string {
-	description := ""
-	pushTime := time.Unix(util.Int64All(obj["publishtime"]), 0)
-	title := util.InterfaceToStr(obj["title"])
-	owner := util.InterfaceToStr(obj["owner"])
-	buyer := util.InterfaceToStr(obj["buyer"])
-	if buyer == "" {
-		buyer = owner
-	}
-	s_winner := util.InterfaceToStr(obj["s_winner"])
-	publishtime := util.Int64All(obj["publishtime"])
-	area := util.InterfaceToStr(obj["area"])
-	city := util.InterfaceToStr(obj["city"])
-	if stype == "bdprivate" {
-		//bdprivate
-		//{项目标题},采购单位:{采购单位名称},成交供应商:{中标企业名称},公告日期:{公告日期}。
-		descriptionArr := []string{}
-		if title != "" {
-			descriptionArr = append(descriptionArr, title)
-		}
-		if buyer != "" {
-			descriptionArr = append(descriptionArr, fmt.Sprintf("采购单位:%s", buyer))
-		}
-		if s_winner != "" {
-			descriptionArr = append(descriptionArr, fmt.Sprintf("成交供应商:%s", s_winner))
-		}
-		if publishtime != 0 {
-			descriptionArr = append(descriptionArr, fmt.Sprintf("公告日期:%s", pushTime.Format("2006年01月02日")))
-		}
-		description = strings.Join(descriptionArr, ",")
-	} else {
-		//descriptionStr = "%s,项目所属地区是%s%s,项目采购单位是%s,项目发布时间是%s"
-		descriptionArr := []string{}
-		if title != "" {
-			descriptionArr = append(descriptionArr, title)
-		}
-		if area != "" || city != "" {
-			descriptionArr = append(descriptionArr, fmt.Sprintf("项目所属地区是%s%s", area, city))
-		}
-		if buyer != "" {
-			descriptionArr = append(descriptionArr, fmt.Sprintf("项目采购单位是%s", buyer))
-		}
-		if publishtime != 0 {
-			descriptionArr = append(descriptionArr, fmt.Sprintf("项目发布时间是%s", pushTime.Format("2006年01月02日")))
-		}
-		description = strings.Join(descriptionArr, ",")
-	}
-	return description
-}

+ 4 - 4
src/jfw/front/tags.go

@@ -408,7 +408,7 @@ func (this *Tags) GetIndustry(industryHref string) interface{} {
 				v: industryMap[v],
 				v: industryMap[v],
 			})
 			})
 		}
 		}
-		redis.Put("other", rediskey, m, 2*60*60)
+		redis.Put("other", rediskey, m, 2*60)
 		return m
 		return m
 	}
 	}
 	return nil
 	return nil
@@ -493,7 +493,7 @@ func (this *Tags) GetStype(href string) (list []map[string]interface{}) {
 			}
 			}
 		}
 		}
 		list = m
 		list = m
-		redis.Put("other", rediskey, list, 2*60*60)
+		redis.Put("other", rediskey, list, 2*60)
 	}
 	}
 	return list
 	return list
 }
 }
@@ -677,8 +677,8 @@ func (this *Tags) GetBidding(industry, area, city, stype, keyword string, reques
 					industry = strings.Split(industry, "_")[0]
 					industry = strings.Split(industry, "_")[0]
 				}
 				}
 				public.BidListConvert(industry, datas)
 				public.BidListConvert(industry, datas)
-				redis.Put("other", rediskey, datas, 2*60*60)
-				redis.Put("other", rediskeyCount, count, 2*60*60)
+				redis.Put("other", rediskey, datas, 2*60)
+				redis.Put("other", rediskeyCount, count, 2*60)
 				return *datas, count, false
 				return *datas, count, false
 			}
 			}
 		}
 		}

+ 3 - 2
src/jfw/modules/app/src/app/front/shorturl.go

@@ -4,7 +4,6 @@ import (
 	"database/sql"
 	"database/sql"
 	"errors"
 	"errors"
 	"fmt"
 	"fmt"
-	"github.com/gogf/gf/v2/util/gconv"
 	utils "jy/src/jfw/modules/app/src/app/jyutil"
 	utils "jy/src/jfw/modules/app/src/app/jyutil"
 	"jy/src/jfw/modules/app/src/jfw/config"
 	"jy/src/jfw/modules/app/src/jfw/config"
 	"regexp"
 	"regexp"
@@ -12,6 +11,8 @@ import (
 	"strings"
 	"strings"
 	"time"
 	"time"
 
 
+	"github.com/gogf/gf/v2/util/gconv"
+
 	"app.yhyue.com/moapp/jybase/date"
 	"app.yhyue.com/moapp/jybase/date"
 	"app.yhyue.com/moapp/jybase/encrypt"
 	"app.yhyue.com/moapp/jybase/encrypt"
 	"app.yhyue.com/moapp/jybase/fsw"
 	"app.yhyue.com/moapp/jybase/fsw"
@@ -362,7 +363,7 @@ func NoLoginArticle(stype, sid string) map[string]interface{} {
 		obj["keywords"] = KeyWordHandle(obj)
 		obj["keywords"] = KeyWordHandle(obj)
 		obj["description"] = DescriptionHandle("nologin", obj)
 		obj["description"] = DescriptionHandle("nologin", obj)
 		obj = Filter(obj)
 		obj = Filter(obj)
-		redis.Put("other", catchKey, obj, 60*60*2)
+		redis.Put("other", catchKey, obj, 60*2)
 	}
 	}
 	return obj
 	return obj
 }
 }