WH01243 пре 2 година
родитељ
комит
d535ec6e48

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

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

+ 79 - 0
src/jfw/modules/app/src/app/front/shorturl.go

@@ -4,6 +4,7 @@ import (
 	"database/sql"
 	"errors"
 	"fmt"
+	"github.com/gogf/gf/v2/util/gconv"
 	utils "jy/src/jfw/modules/app/src/app/jyutil"
 	"jy/src/jfw/modules/app/src/jfw/config"
 	"regexp"
@@ -39,6 +40,29 @@ func init() {
 
 var DateFullLayout = "2006-01-02 15:04:05"
 var suffix_msgt = "_SX"
+var TypeCodeMap = map[string]string{
+	"拟建":   "拟建项目",
+	"采购意向": "采购意向",
+	"预告":   "招标预告",
+	"预审":   "资格预审",
+	"预审结果": "资格预审结果",
+	"论证意见": "论证意见",
+	"需求公示": "需求公示",
+	"招标":   "公开招标",
+	"邀标":   "邀请招标",
+	"询价":   "询价采购",
+	"竞谈":   "竞争性谈判",
+	"单一":   "单一来源采购",
+	"竞价":   "竞价公告",
+	"变更":   "变更公告",
+	"中标":   "中标公示",
+	"成交":   "成交公告",
+	"废标":   "废标公告",
+	"流标":   "流标公告",
+	"合同":   "合同公告信息",
+	"验收":   "验收公告信息",
+	"违规":   "违规信息",
+}
 
 func (s *Short) Article(stype, id string) error {
 	//先判断是否有session
@@ -267,6 +291,8 @@ func (s *Short) Article(stype, id string) error {
 		s.T["advertName"] = config.Sysconfig["advertName"]
 		s.T["advertUrl"] = config.Sysconfig["advertUrl"]
 		obj["industry"] = industry
+		obj["keywords"] = KeyWordHandle(obj)
+		obj["description"] = DescriptionHandle(stype, obj)
 		s.T["obj"] = obj
 		s.T["isIosExam"], s.T["isIosExamPhone"], _, _ = IosExamInfo(s.Action, false, false)
 		content, err := s.Render4Cache("/weixin/wxinfocontent.html", &s.T)
@@ -333,6 +359,8 @@ func NoLoginArticle(stype, sid string) map[string]interface{} {
 		obj["buyerTitle"] = obj["buyer"]
 		obj["projectnameTitle"] = obj["projectname"]
 		obj["projectcodeTitle"] = obj["projectcode"]
+		obj["keywords"] = KeyWordHandle(obj)
+		obj["description"] = DescriptionHandle("nologin", obj)
 		obj = Filter(obj)
 		redis.Put("other", catchKey, obj, 60*60*2)
 	}
@@ -612,3 +640,54 @@ func baseInfo(obj map[string]interface{}) string {
 	}
 	return info
 }
+func KeyWordHandle(obj map[string]interface{}) string {
+	keywordArr := []string{}
+	if util.InterfaceToStr(obj["buyer"]) != "" && util.InterfaceToStr(obj["buyer"]) != config.Sysconfig["detailMosaicTxt"] {
+		keywordArr = append(keywordArr, util.InterfaceToStr(obj["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"]) != "" {
+		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 {
+	descriptionStr := ""
+	description := ""
+	pushTime := time.Unix(util.Int64All(obj["publishtime"]), 0)
+	if stype == "nologin" {
+		//nologin
+		//{项目标题},项目所属地区是{省份}{城市},项目采购单位是{采购单位名称},项目发布时间是{发布时间}。
+		descriptionStr = "%s,项目所属地区是%s%s,项目采购单位是%s,项目发布时间是%s"
+		description = fmt.Sprintf(descriptionStr, util.InterfaceToStr(obj["title"]), util.InterfaceToStr(obj["area"]), util.InterfaceToStr(obj["city"]), util.InterfaceToStr(obj["buyer"]), pushTime.Format("2006年01月02日"))
+	} else if stype == "bdprivate" {
+		//bdprivate
+		//{项目标题},采购单位:{采购单位名称},成交供应商:{中标企业名称},公告日期:{公告日期}。
+		descriptionStr = "%s,采购单位1:%s,成交供应商:%s,公告日期:%s。"
+		description = fmt.Sprintf(descriptionStr, util.InterfaceToStr(obj["title"]), util.InterfaceToStr(obj["buyer"]), util.InterfaceToStr(obj["s_winner"]), pushTime.Format("2006年01月02日"))
+
+	}
+	return description
+}

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

@@ -2,7 +2,7 @@
 <head>
     {{include "/common/meta.html"}}
     <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
-    <meta name="keywords" content="">
+    <meta name="keywords" content="{{.T.obj.keywords}}">
     <meta name="description" content="{{.T.obj.description}}">
     <title>公告信息</title>
     <link href="{{Cdns .Host "seo" "cdn"|SafeUrl}}/jyapp/css/alertPopShow.css?v={{Msg "seo" "version"}}" rel="stylesheet">

+ 1 - 1
src/web/templates/pc/tags/detail.html

@@ -1,7 +1,7 @@
 <html style="height: 100%">
 <head>
   <title>{{.T.obj.title}} - 剑鱼标讯</title>
-  <meta name="keywords" content="">
+  <meta name="keywords" content="{{.T.obj.keywords}}">
   <meta name="description" content="{{.T.obj.description}}">
   <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,initial-scale=1.0" user-scalable="no" />
 	<meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1" />