|
@@ -41,19 +41,21 @@ type Short struct {
|
|
|
nologinArticle xweb.Mapper `xweb:"/nologin/(\\w+)/(.*).html"` //([pm]) 无需登录
|
|
|
}
|
|
|
|
|
|
-var mobileReg = regexp.MustCompile("(?i)(Android|Mobile|Phone)")
|
|
|
-var DateFullLayout = "2006-01-02 15:04:05"
|
|
|
-var Map_stype = map[string]bool{
|
|
|
- "content": true,
|
|
|
- "entservice": true,
|
|
|
- "bdprivate": true,
|
|
|
- "mailprivate": true,
|
|
|
- "bdcontent": true,
|
|
|
- "indexcontent": true,
|
|
|
- "advancedProject": true,
|
|
|
-}
|
|
|
-
|
|
|
-var seoAgentReg = regexp.MustCompile("Baiduspider|360Spider|bingbot|Googlebot")
|
|
|
+var (
|
|
|
+ mobileReg = regexp.MustCompile("(?i)(Android|Mobile|Phone)")
|
|
|
+ DateFullLayout = "2006-01-02 15:04:05"
|
|
|
+ Map_stype = map[string]bool{
|
|
|
+ "content": true,
|
|
|
+ "entservice": true,
|
|
|
+ "bdprivate": true,
|
|
|
+ "mailprivate": true,
|
|
|
+ "bdcontent": true,
|
|
|
+ "indexcontent": true,
|
|
|
+ "advancedProject": true,
|
|
|
+ }
|
|
|
+ seoAgentReg = regexp.MustCompile("Baiduspider|360Spider|bingbot|Googlebot")
|
|
|
+ detailNeedMosaic map[string]interface{}
|
|
|
+)
|
|
|
|
|
|
func (s *Short) Article(stype, id string) error {
|
|
|
userId, _ := s.GetSession("userId").(string)
|
|
@@ -923,13 +925,24 @@ func ReplaceStringByRegex(str, rule, replace string) (string, error) {
|
|
|
// 未登录用户进行数据过滤 name 配置文件
|
|
|
func Filter(obj map[string]interface{}) map[string]interface{} {
|
|
|
detail := fmt.Sprint(obj["detail"])
|
|
|
- mosaicText := fmt.Sprintf(`<span class="noLoginMosaic">%s</span>`, util.ObjToString(config.Sysconfig["detailMosaic"]))
|
|
|
+ mosaicText := fmt.Sprintf(`<span onclick="openLoginDig(true)" style="cursor:pointer;color: #1D1D1D;">%s</span>`, util.ObjToString(config.Sysconfig["detailMosaic"]))
|
|
|
+ detailText := fmt.Sprintf(`<span class="noLoginMosaic" style="color: #2ABED1;">%s</span>`, util.ObjToString(config.Sysconfig["detailMosaic"]))
|
|
|
for k, _ := range obj {
|
|
|
- detailNeedMosaic, _ := config.Sysconfig["detailNeedMosaic"].(map[string]interface{})
|
|
|
if ok, _ := detailNeedMosaic[k].(bool); ok {
|
|
|
- if util.InterfaceToStr(obj[k]) != "" {
|
|
|
- detail = strings.ReplaceAll(detail, util.ObjToString(obj[k]), mosaicText)
|
|
|
- obj[k] = mosaicText
|
|
|
+
|
|
|
+ //中标企业信息
|
|
|
+ if k == "winnerMap" && obj[k] != nil {
|
|
|
+ winnerNewMap := map[string]interface{}{}
|
|
|
+ winnerMap := util.ObjToMap(obj[k])
|
|
|
+ for _, wv := range *winnerMap {
|
|
|
+ winnerNewMap[mosaicText] = wv
|
|
|
+ }
|
|
|
+ obj[k] = winnerNewMap
|
|
|
+ } else {
|
|
|
+ if util.ObjToString(obj[k]) != "" {
|
|
|
+ detail = strings.ReplaceAll(detail, util.ObjToString(obj[k]), detailText)
|
|
|
+ obj[k] = mosaicText
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -978,6 +991,9 @@ func (s *Short) NologinArticle(stype, id string) error {
|
|
|
if userId != "" { //已登录用户直接跳转至正常三级页
|
|
|
return s.LoginCommon(userId, stype, id)
|
|
|
}
|
|
|
+ if detailNeedMosaic == nil {
|
|
|
+ detailNeedMosaic, _ = config.Sysconfig["detailNeedMosaic"].(map[string]interface{})
|
|
|
+ }
|
|
|
return s.NologinCommon(userId, stype, id, sids[0])
|
|
|
}
|
|
|
|
|
@@ -994,7 +1010,7 @@ func (s *Short) NologinCommon(userId, stype, id, sid string) error {
|
|
|
s.T["shareid"] = se.EncodeString(shareid)
|
|
|
s.T["keywords"] = s.GetString("kds")
|
|
|
s.DisableHttpCache()
|
|
|
- po, bo, wo, obj := pcVRT(sid, industry, stype, false || false || false)
|
|
|
+ po, bo, wo, obj := pcVRT(sid, industry, stype, false)
|
|
|
if obj != nil && len(obj) > 0 {
|
|
|
if len(po) > 0 {
|
|
|
s.T["projectOther"] = po
|
|
@@ -1017,6 +1033,7 @@ func (s *Short) NologinCommon(userId, stype, id, sid string) error {
|
|
|
obj = Filter(obj)
|
|
|
obj["description"] = fmt.Sprintf("%s,%s。", obj["title"], baseInfo(obj))
|
|
|
}
|
|
|
+ obj["agency"] = ""
|
|
|
if obj["publishtime"] != nil {
|
|
|
obj["publishtimeShorDate"] = time.Unix(util.Int64All(obj["publishtime"]), 0).Format(date.Date_Short_Layout)
|
|
|
}
|