Эх сурвалжийг харах

Merge branch 'dev/v4.8.40_dx' of qmx/jy into feature/v4.8.40

duxin 2 жил өмнө
parent
commit
be627fc694

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

@@ -467,7 +467,7 @@ func (s *Short) LoginCommon(userId, stype, id string) error {
 		}
 		sid := sids[0]
 		//免费用户浏览三级页判断留资与浏览次数
-		indust := s.GetString("industry")
+		//indust := s.GetString("industry")
 		if userId != "" && stype == "indexcontent" { //已登录用户直接跳转至正常三级页
 			return s.Redirect(fmt.Sprintf("/article/content/%s.html", encrypt.CommonEncodeArticle("content", sid)))
 		}
@@ -488,8 +488,8 @@ func (s *Short) LoginCommon(userId, stype, id string) error {
 				stype == "mailprivate" || stype == "indexcontent" || stype == "bdprivate" { //邮箱推送
 				node = true
 			} else {
-				_, _, _, objc := pcVRT(sid, indust, stype, isVip || isMember || isEntniche)
-				node = SeeDetailLimit(objc, userId, sid)
+				//_, _, _, objc := pcVRT(sid, indust, stype, isVip || isMember || isEntniche)
+				node = SeeDetailLimit(obj, userId, sid)
 			}
 
 			if obj["publishtime"] != nil {
@@ -509,7 +509,7 @@ func (s *Short) LoginCommon(userId, stype, id string) error {
 					canRead = true
 				}
 				if canRead || node {
-					_, _, _, obj = pcVRT(sid, indust, stype, true)
+					_, _, _, obj = pcVRT(sid, industry, stype, true)
 					canRead = true
 					node = canRead
 				}

+ 46 - 15
src/jfw/front/swordfish.go

@@ -802,36 +802,67 @@ func pcVRT(sid, industry, content string, isPayUser bool) (po, bo, wo []map[stri
 			projectName, _ := obj["projectname"].(string)
 			projectCode, _ := obj["projectcode"].(string)
 			if projectName != "" || projectCode != "" {
-				if projectName != "" && projectCode != "" {
-					projectName = strings.ReplaceAll(projectName, "\"", "###剑鱼###")
-					projectCode = strings.ReplaceAll(projectCode, "\"", "###剑鱼###")
-					queryStr = `{"$or":[{"TERM_projectname":"` + projectName + `"},{"TERM_projectcode":"` + projectCode + `"}]}`
-				} else if projectName != "" && projectCode == "" {
-					projectName = strings.ReplaceAll(projectName, "\"", "###剑鱼###")
-					queryStr = `{"TERM_projectname":"` + projectName + `"}`
-				} else if projectName == "" && projectCode != "" {
-					projectCode = strings.ReplaceAll(projectCode, "\"", "###剑鱼###")
-					queryStr = `{"TERM_projectcode":"` + projectCode + `"}`
+				projectNameCode := fmt.Sprintf("projectNameCode_%s_%s", projectName, projectCode)
+				projectOther = EntAssociated(projectNameCode)
+				if projectOther == nil {
+					if projectName != "" && projectCode != "" {
+						projectName = strings.ReplaceAll(projectName, "\"", "###剑鱼###")
+						projectCode = strings.ReplaceAll(projectCode, "\"", "###剑鱼###")
+						queryStr = `{"$or":[{"TERM_projectname":"` + projectName + `"},{"TERM_projectcode":"` + projectCode + `"}]}`
+					} else if projectName != "" && projectCode == "" {
+						projectName = strings.ReplaceAll(projectName, "\"", "###剑鱼###")
+						queryStr = `{"TERM_projectname":"` + projectName + `"}`
+					} else if projectName == "" && projectCode != "" {
+						projectCode = strings.ReplaceAll(projectCode, "\"", "###剑鱼###")
+						queryStr = `{"TERM_projectcode":"` + projectCode + `"}`
+					}
+					projectOther = bidDataConvert(sid, commonQuery(queryStr))
+					if bytes, err := json.Marshal(projectOther); err == nil && bytes != nil {
+						_ = redis.PutBytes(RedisNameNew, projectNameCode, &bytes, 24*60*60)
+					}
 				}
-				projectOther = bidDataConvert(sid, commonQuery(queryStr))
 			}
 			//同一个业主最近的其他招标信息
 			buyer, _ := obj["buyer"].(string) //采购单位
 			if buyer != "" {
-				queryStr = `{"TERM_buyer":"` + buyer + `"}`
-				buyerOther = bidDataConvert(sid, commonQuery(queryStr))
+				buyerNameOther := fmt.Sprintf("buyerNameOther_%s", buyer)
+				buyerOther = EntAssociated(buyerNameOther)
+				if buyerOther == nil {
+					queryStr = `{"TERM_buyer":"` + buyer + `"}`
+					buyerOther = bidDataConvert(sid, commonQuery(queryStr))
+					if bytes, err := json.Marshal(buyerOther); err == nil && bytes != nil {
+						_ = redis.PutBytes(RedisNameNew, buyerNameOther, &bytes, 24*60*60)
+					}
+				}
 			}
 			//同一中标人最近中标的其他信息
 			winner, _ := obj["winner"].(string) //中标人
 			if winner != "" {
-				queryStr = `{"TERM_s_winner":"` + winner + `"}`
-				winnerOther = bidDataConvert(sid, commonQuery(queryStr))
+				winnerNameOther := fmt.Sprintf("winnerNameOther_%s", winner)
+				winnerOther = EntAssociated(winnerNameOther)
+				if winnerOther == nil {
+					queryStr = `{"TERM_s_winner":"` + winner + `"}`
+					winnerOther = bidDataConvert(sid, commonQuery(queryStr))
+					if bytes, err := json.Marshal(winnerOther); err == nil && bytes != nil {
+						_ = redis.PutBytes(RedisNameNew, winnerNameOther, &bytes, 24*60*60)
+					}
+				}
 			}
 		}
 	}
 	return projectOther, buyerOther, winnerOther, objdata
 }
 
+func EntAssociated(key string) []map[string]interface{} {
+	if bytes, err := redis.GetBytes(RedisNameNew, key); err == nil && bytes != nil {
+		var rData []map[string]interface{}
+		if err1 := json.Unmarshal(*bytes, &rData); err1 == nil {
+			return rData
+		}
+	}
+	return nil
+}
+
 // 获取权重最低的字段
 func getLowestField(subtype string) string {
 	fields := util.ObjToMap(config.Sysconfig["recoveryField"])