renjiaojiao 1 year ago
parent
commit
799bf9b3cb
3 changed files with 168 additions and 1 deletions
  1. 17 1
      src/jfw/front/classificationTag.go
  2. 105 0
      src/jfw/front/newPcIndex.go
  3. 46 0
      src/web/templates/pc/newPcIndex.html

+ 17 - 1
src/jfw/front/classificationTag.go

@@ -55,6 +55,22 @@ func RegionAndInformationAndTender() map[string]interface{} {
 	return data
 }
 
+func GetHotIndustry() []map[string][]map[string]interface{} {
+	if bytes, err := redis.GetBytes(RedisNameNew, "regionAndInformationAndTender"); err == nil && bytes != nil {
+		rData := []map[string][]map[string]interface{}{}
+		if err := json.Unmarshal(*bytes, &rData); err != nil {
+			log.Printf("[MANAGER-ERR]RegionAndInformationAndTender  GetData Error %v \n", err)
+			return nil
+		}
+		return rData
+	}
+	keysMap := getkeysMap() //热门行业
+	if bytes, err := json.Marshal(keysMap); err == nil && bytes != nil {
+		_ = redis.PutBytes(RedisNameNew, "regionAndInformationAndTender", &bytes, 2*60*60)
+	}
+	return keysMap
+}
+
 // 最新更新的200中标企业
 func GetWinnerInfo() (data []*BuyerList) {
 	// 取缓存
@@ -461,7 +477,7 @@ func NewIndexbids(session *httpsession.Session, r *http.Request) []map[string]in
 		data.Count = total
 	*/
 	// p397 收回查看拟建权限
-	_, _, lists := bidsearch.GetPcBidSearchData("", "", "", "", "招标预告,招标公告,招标结果,招标信用信息", "", "", "", "", "", "", "", "", 1, false, nil, bidSearch_field_1, "", false, false, "", 10, "")
+	_, _, lists := bidsearch.GetPcBidSearchData("", "", "", "", "招标预告,招标公告,招标结果,招标信用信息", "", "", "", "", "", "", "", "", 1, false, nil, bidSearch_field_1, "", false, false, "", 8, "")
 	if lists != nil {
 		for _, v1 := range *lists {
 			v1["_id"] = encrypt.CommonEncodeArticle("content", v1["_id"].(string))

+ 105 - 0
src/jfw/front/newPcIndex.go

@@ -0,0 +1,105 @@
+package front
+
+import (
+	util "app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/redis"
+	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
+	"fmt"
+	"jy/src/jfw/config"
+	"jy/src/jfw/site/jySchool"
+	"jy/src/jfw/wx"
+	"regexp"
+)
+
+// NewSordfishIndex 剑鱼标讯pc首页
+func (m *PcIndex) NewSordFishIndex(flag string) error {
+	ispc, _ := m.GetInteger("ispc")
+	pageSize, _ := m.GetInteger("pageSize")
+	if pageSize == 0 {
+		pageSize = 50
+	}
+	var shareid = m.GetString("id")
+	//userId, _ := m.GetSession("userId").(string)
+	sessVal := m.Session().GetMultiple()
+	userId := util.ObjToString(sessVal["userId"])
+	pcindexKey := "jypcindex"
+	if cacheKey, _ := config.Sysconfig["pcindexCacheKey"].(string); cacheKey != "" {
+		pcindexKey = cacheKey
+	}
+	if len(shareid) == 0 {
+		shareid = "10" //fmt.Sprintf("%s%d", config.Seoconfig["jysy"].(string)+fmt.Sprintf("%d", time.Now().UnixNano())[8:14], rand.Intn(9))
+	} else {
+		redis.Del("other", pcindexKey)
+	}
+	m.T["logid"] = config.Seoconfig["jysy"].(string)
+	m.T["shareid"] = se.EncodeString(shareid)
+	m.T["activestart"] = config.ActiveConfig.DoubleEleven.Active_Start
+	m.T["activeend"] = config.ActiveConfig.DoubleEleven.Active_End
+	m.T["userCard"] = "f"
+	regex, _ := regexp.Compile("(Android|Mobile)")
+	var isLogin bool
+	if userId != "" {
+		isLogin = true
+		userPower := jy.GetBigVipUserBaseMsg(m.Session(), *config.Middleground)
+		switch {
+		case userPower.Status > 0:
+			m.T["userCard"] = "m"
+		case userPower.VipStatus > 0:
+			m.T["userCard"] = "v"
+		case userPower.EntnicheStatus > 0:
+			m.T["userCard"] = "e"
+		}
+	}
+	if ispc == 0 && len(regex.FindAllString(m.Header("User-Agent"), -1)) > 0 {
+		m.T["s_m_openid"] = util.ObjToString(sessVal["s_m_openid"])
+		m.T["nickname"] = util.ObjToString(sessVal["s_nickname"])
+		m.T["avatar"] = util.ObjToString(sessVal["s_avatar"])
+		m.T["signature"] = wx.SignJSSDK(m.Site() + m.Url())
+		return m.Render("/pc/mobileindex.html", &m.T)
+	} else {
+		//招标公告
+		m.T["newbids"] = map[string]interface{}{
+			"biddingList": NewIndexbids(m.Session(), m.Request),
+			"more":        "/list/stype/ZBGG.html",
+		}
+		//最新公告信息
+		rangeInfoType := []int{1, 2, 3, 4}
+		for _, v := range rangeInfoType { //1拟建 2招标预告 3招标公告 4招标结果
+			m.T[fmt.Sprintf("newArticle_%d", v)] = GetNewArticle(v, pageSize)
+		}
+		//热门行业
+		m.T["hotIndustry"] = GetHotIndustry()
+		//实用内容推荐
+		m.T["recommend"] = ContentRecommendation()
+		m.T["jycmsLink"] = GetJycmsAreaLink()
+		//推荐标讯专区
+		m.T["recommendBeacon"] = RecommendationBeacon()
+		//招投标攻略
+		m.T["strategyList"] = GetStrategyList()
+		m.T["hasLogin"] = isLogin
+		//热门采购单位
+		m.T["hotBuyers"] = HotBuyerList()
+		//热门中标单位
+		m.T["hotWinner"] = GetWinnerInfo()
+		//m.T["newbids"] = NewIndexbids(m.Session(), m.Request)
+		m.T["hotkey"] = hotKeyArrLoginEd
+		m.T["hotKeyArrUnLogin"] = hotKeyArrUnLogin
+		m.T["simpleTemplateData"] = map[string]interface{}{"XwebVer": m.T["XwebVer"]} //清除前端js获取模版标签变量
+		return m.Render("/pc/newPcIndex.html", &m.T)
+	}
+}
+
+// GetStrategyList 招投标攻略
+func GetStrategyList() []map[string]interface{} {
+	var strategyList []map[string]interface{}
+	for _, item := range jySchool.GuidelineColumn().SeedData {
+		if res := jySchool.Guideline(item.Code, 5); res != nil && len(*res) > 0 {
+			strategyList = append(strategyList, map[string]interface{}{
+				"name": item.Name,
+				"code": item.Code,
+				"list": res,
+			})
+		}
+	}
+	return strategyList
+}

+ 46 - 0
src/web/templates/pc/newPcIndex.html

@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8">
+  <title>Title</title>
+</head>
+<body>
+<!--  12号广告位-->
+{{range $k,$v:=Ad "new-pc-index-top-ad" 1}}
+<a href="{{$v.S_link}}" target="_blank">
+  <img src='{{$v.S_pic}}' alt="{{$v.S_remark}}">
+</a>
+{{end}}
+
+<!-- 消息展示 -->
+<div id="vue-message-index-pc" v-cloak>
+  <div class="list-msg" v-if="lists.length > 0">
+    <div class="no-read-count" v-if="totalNum > 0">${totalNum > 99 ? '99+' : totalNum }条未读</div>
+    <el-carousel :interval="rollingTiming" arrow="never" :autoplay="lists.length > 1" indicator-position="none">
+      <el-carousel-item class="l-msg" v-for="(tempList, index) in lists" :key="'msg_' + index">
+        <div class="words" v-for="item in tempList" :key="item.id">
+          <img class="icon_voice" src="/images/pc/icon_voice.png"/>
+          <h3>${typeObj[item.msg_type]}</h3>
+          <span class="title" @click="titleGoto(item)">${item.title}</span>
+          <p>${item.createtime}</p>
+        </div>
+      </el-carousel-item>
+    </el-carousel>
+  </div>
+</div>
+
+<!--轮播图-->
+<div class="swiper-wrapper">
+  {{range $k,$v:=Ad "new-pc-index-carousel" -1}}
+  <a class="swiper-slide"
+     {{if $v.S_link }}href="{{$v.S_link}}"{{end}}
+     {{if eq $v.O_extend.Linktype "abroad" }} target="_blank" {{else}} target="_self" {{end}}
+  >
+  <img class="img-banner" data-theme="{{$v.O_extend.Theme}}" src='{{$v.S_pic}}' alt="{{$v.S_remark}}">
+  </a>
+  {{end}}
+</div>
+
+</body>
+<script src='{{Msg "seo" "cdn"}}/js/pc-message-new.js?v={{Msg "seo" "version"}}'></script>
+</html>