|
@@ -2,13 +2,19 @@ package front
|
|
|
|
|
|
import (
|
|
|
qu "app.yhyue.com/moapp/jybase/common"
|
|
|
+ "app.yhyue.com/moapp/jybase/encrypt"
|
|
|
+ "app.yhyue.com/moapp/jybase/redis"
|
|
|
+ "app.yhyue.com/moapp/jypkg/common/src/qfw/util/bidsearch"
|
|
|
"app.yhyue.com/moapp/jypkg/public"
|
|
|
+ "encoding/json"
|
|
|
"fmt"
|
|
|
"jy/src/jfw/config"
|
|
|
"jy/src/jfw/jyutil"
|
|
|
"jy/src/jfw/paging"
|
|
|
+ "log"
|
|
|
"math"
|
|
|
"math/rand"
|
|
|
+ "sync"
|
|
|
"time"
|
|
|
)
|
|
|
|
|
@@ -19,10 +25,22 @@ type KeyType struct {
|
|
|
|
|
|
// RegionAndInformationAndTender 1地域 2信息类型 3热门招标
|
|
|
func RegionAndInformationAndTender() map[string]interface{} {
|
|
|
+ if bytes, err := redis.GetBytes(RedisNameNew, "regionAndInformationAndTender"); err == nil && bytes != nil {
|
|
|
+ rData := map[string]interface{}{}
|
|
|
+ log.Println()
|
|
|
+ if err := json.Unmarshal(*bytes, &rData); err != nil {
|
|
|
+ log.Printf("[MANAGER-ERR]RegionAndInformationAndTender GetData Error %v \n", err)
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ return rData
|
|
|
+ }
|
|
|
data := make(map[string]interface{})
|
|
|
for _, v := range []int{1, 2, 3} {
|
|
|
data[fmt.Sprintf("labUrl_%d", v)] = GetLabUrl(v) //1地域 2信息类型 3热门招标
|
|
|
}
|
|
|
+ if bytes, err := json.Marshal(data); err == nil && bytes != nil {
|
|
|
+ _ = redis.PutBytes(RedisNameNew, "regionAndInformationAndTender", &bytes, 2*60*60)
|
|
|
+ }
|
|
|
return data
|
|
|
}
|
|
|
|
|
@@ -44,6 +62,15 @@ func HotSubjectMatter() []map[string]interface{} {
|
|
|
|
|
|
// ContentRecommendation 实用内容推荐
|
|
|
func ContentRecommendation() map[KeyType][]KeyType {
|
|
|
+ if bytes, err := redis.GetBytes(RedisNameNew, "contentRecommendation"); err == nil && bytes != nil {
|
|
|
+ rData := make(map[KeyType][]KeyType)
|
|
|
+ log.Println()
|
|
|
+ if err := json.Unmarshal(*bytes, &rData); err != nil {
|
|
|
+ log.Printf("[MANAGER-ERR]contentRecommendation GetData Error %v \n", err)
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ return rData
|
|
|
+ }
|
|
|
columnCode, _ := config.Sysconfig["columnCode"].(map[string]interface{})
|
|
|
jySchoolCode := qu.InterfaceToStr(columnCode["招投标攻略"])
|
|
|
industryInfoCode := qu.InterfaceToStr(columnCode["行业资讯"])
|
|
@@ -75,6 +102,56 @@ func ContentRecommendation() map[KeyType][]KeyType {
|
|
|
data[v2] = append(data[v2], v1)
|
|
|
}
|
|
|
}
|
|
|
+ if bytes, err := json.Marshal(data); err == nil && bytes != nil {
|
|
|
+ _ = redis.PutBytes(RedisNameNew, "contentRecommendation", &bytes, 2*60*60)
|
|
|
+ }
|
|
|
+ return data
|
|
|
+}
|
|
|
+
|
|
|
+// 推荐标讯
|
|
|
+func RecommendationBeacon() map[string]interface{} {
|
|
|
+ if bytes, err := redis.GetBytes(RedisNameNew, "recommendationBeacon"); err == nil && bytes != nil {
|
|
|
+ rData := make(map[string]interface{})
|
|
|
+ log.Println()
|
|
|
+ if err := json.Unmarshal(*bytes, &rData); err != nil {
|
|
|
+ log.Printf("[MANAGER-ERR]recommendationBeacon GetData Error %v \n", err)
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ return rData
|
|
|
+ }
|
|
|
+ data := make(map[string]interface{})
|
|
|
+ sy := sync.RWMutex{}
|
|
|
+ wg := sync.WaitGroup{}
|
|
|
+ for _, v := range []string{"招标预告,招标公告,招标结果,招标信用信息"} {
|
|
|
+ wg.Add(1)
|
|
|
+ go func(vst string) {
|
|
|
+ defer wg.Done()
|
|
|
+ var list []map[string]interface{}
|
|
|
+ _, _, lists := bidsearch.GetPcBidSearchData("", "", "", "", vst, "", "", "", "", "", "", "", "", 1, false, nil, bidSearch_field_1, "", false, false, "", 8, "")
|
|
|
+ if lists != nil {
|
|
|
+ for _, v1 := range *lists {
|
|
|
+ v1["_id"] = encrypt.CommonEncodeArticle("content", v1["_id"].(string))
|
|
|
+ delete(v1, "toptype")
|
|
|
+ delete(v1, "s_subscopeclass")
|
|
|
+ tmpdate := v1["publishtime"]
|
|
|
+ v1["publishtime"] = qu.Int64All(tmpdate.(float64))
|
|
|
+ if v1["budget"] != nil {
|
|
|
+ v1["budget"] = ConversionMoeny(v1["budget"])
|
|
|
+ } else if v1["bidamount"] != nil {
|
|
|
+ v1["budget"] = ConversionMoeny(v1["bidamount"])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ list = *lists
|
|
|
+ }
|
|
|
+ sy.Lock()
|
|
|
+ data[v] = list
|
|
|
+ sy.Unlock()
|
|
|
+ }(v)
|
|
|
+ }
|
|
|
+ wg.Wait()
|
|
|
+ if bytes, err := json.Marshal(data); err == nil && bytes != nil {
|
|
|
+ _ = redis.PutBytes(RedisNameNew, "recommendationBeacon", &bytes, 5*60)
|
|
|
+ }
|
|
|
return data
|
|
|
}
|
|
|
|