|
@@ -67,14 +67,34 @@ func init() {
|
|
|
}
|
|
|
//随机数
|
|
|
jyutil.RandNum = jyutil.RandomNumberGenerator()
|
|
|
- //地区
|
|
|
+ //地区-读取配置
|
|
|
if areaInfoByte, err := json.Marshal(config.Seoconfig["areaInfo"]); err == nil {
|
|
|
if err = json.Unmarshal(areaInfoByte, &jyutil.AreaInfo); err != nil {
|
|
|
+ log.Println("areaInfo unmarshal err:", err)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ log.Println("获取地区信息异常:", err)
|
|
|
+ }
|
|
|
+ //省份-读取配置
|
|
|
+ if areaByte, err := json.Marshal(config.Seoconfig["area"]); err == nil {
|
|
|
+ if err = json.Unmarshal(areaByte, &jyutil.AreaMap); err != nil {
|
|
|
log.Println("area unmarshal err:", err)
|
|
|
}
|
|
|
} else {
|
|
|
log.Println("获取地区信息异常:", err)
|
|
|
}
|
|
|
+ //城市-读取配置
|
|
|
+ if cityByte, err := json.Marshal(config.Seoconfig["city"]); err == nil {
|
|
|
+ if err = json.Unmarshal(cityByte, &jyutil.CityMap); err != nil {
|
|
|
+ log.Println("city unmarshal err:", err)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ log.Println("获取地区信息异常:", err)
|
|
|
+ }
|
|
|
+ //初始化地区信息
|
|
|
+ jyutil.GetAllArea()
|
|
|
+ //热门地区
|
|
|
+ jyutil.GetHotArea()
|
|
|
}
|
|
|
|
|
|
func (tg *Tags) TagsIndex(first, types, name string) error {
|
|
@@ -89,20 +109,13 @@ onceAgain:
|
|
|
tagsMobileKey := fmt.Sprintf("tags_mobile_key_%s_%s", types, name)
|
|
|
if res := redis.Get("seoCache", tagsMobileKey); res == nil || res == "" {
|
|
|
var (
|
|
|
- areaList []map[string][]*jyutil.SeoInfo //地区
|
|
|
- infoTypeList []map[string]interface{} //信息类型
|
|
|
- currentLocation []*jyutil.SeoInfo
|
|
|
- hasIndustryNav bool // 有没有招标导航
|
|
|
- prevPage, nextPage string
|
|
|
- areaTopTip string
|
|
|
- areaToCode = map[string]*jyutil.SeoInfo{}
|
|
|
- cityToCode = map[string]*jyutil.SeoInfo{}
|
|
|
- areaToCity = map[string][]*jyutil.SeoInfo{}
|
|
|
- topMap = map[string]*jyutil.SeoInfo{}
|
|
|
- codes = strings.Split(name, "_")
|
|
|
- title = "剑鱼标讯官网_招标信息查询_全国招标采购信息订阅推送_专业招标大数据平台"
|
|
|
- suffix = "_剑鱼标讯官网"
|
|
|
- biddingInfo = jyutil.BiddingInfo{
|
|
|
+ infoTypeList []map[string]interface{} //信息类型
|
|
|
+ currentLocation []*jyutil.SeoInfo
|
|
|
+ hasIndustryNav bool // 有没有招标导航
|
|
|
+ prevPage, nextPage, tdk, areaTopTip string
|
|
|
+ topInfoMap = map[string]*jyutil.SeoInfo{}
|
|
|
+ codes = strings.Split(name, "_")
|
|
|
+ biddingInfo = jyutil.BiddingInfo{
|
|
|
Total: qu.IntAll(config.Seoconfig["seoTotal"]), //查询数据总量
|
|
|
PageSize: qu.IntAll(config.Seoconfig["seoSize"]), //每页数据量
|
|
|
PageNum: 1, //当前页码
|
|
@@ -110,29 +123,31 @@ onceAgain:
|
|
|
}
|
|
|
isInfoList bool // 是否是在列表页面
|
|
|
)
|
|
|
- areaList, areaToCode, cityToCode, areaToCity = jyutil.GetAllArea()
|
|
|
- infoTypeList, topMap = jyutil.GetInfoType()
|
|
|
+ if len(jyutil.AreaInfo) == 0 || jyutil.AreaMap == nil {
|
|
|
+ jyutil.GetAllArea()
|
|
|
+ }
|
|
|
+ //areaList, areaToCode, cityToCode, areaToCity = jyutil.GetAllArea()
|
|
|
+ infoTypeList, topInfoMap = jyutil.GetInfoType()
|
|
|
switch types {
|
|
|
- case jyutil.Label["area"]: //地区
|
|
|
- if len(codes) == 3 {
|
|
|
- areaCode, cityCode := codes[0], codes[1]
|
|
|
- if areaToCode[areaCode] != nil {
|
|
|
+ case jyutil.Label["area"], jyutil.Label["city"]: //地区
|
|
|
+ if len(codes) == 2 || len(codes) == 1 {
|
|
|
+ if jyutil.AreaCityToCode[codes[0]] != nil {
|
|
|
biddingInfo.IsEffective = true
|
|
|
- currentLocation = append(currentLocation, areaToCode[areaCode])
|
|
|
- biddingInfo.Area = areaToCode[areaCode].Name
|
|
|
+ currentLocation = append(currentLocation, jyutil.AreaCityToCode[codes[0]])
|
|
|
+ biddingInfo.Area = jyutil.AreaCityToCode[codes[0]].Name
|
|
|
+ tdk = biddingInfo.Area
|
|
|
areaTopTip = fmt.Sprintf("%s%s", biddingInfo.Area, "招标网")
|
|
|
- title = fmt.Sprintf("%s%s", areaTopTip, suffix)
|
|
|
- if cityCode != "0" && cityToCode[cityCode] != nil {
|
|
|
- currentLocation = append(currentLocation, cityToCode[cityCode])
|
|
|
- biddingInfo.City = cityToCode[cityCode].Name
|
|
|
- areaTopTip = fmt.Sprintf("%s%s", biddingInfo.City, "招标网")
|
|
|
- title = fmt.Sprintf("%s%s", areaTopTip, suffix)
|
|
|
- } else if cityCode == "0" && !directRuleCity[biddingInfo.Area] {
|
|
|
- tg.T["cityList"] = areaToCity[areaCode]
|
|
|
- } else if cityCode == "0" && directRuleCity[biddingInfo.Area] {
|
|
|
- // 直辖市不显示下面的管理城市
|
|
|
- } else {
|
|
|
- biddingInfo.IsEffective = false //没有对应城市 异常
|
|
|
+ if len(codes) == 2 {
|
|
|
+ if jyutil.AreaCityToCode[name] != nil {
|
|
|
+ currentLocation = append(currentLocation, jyutil.AreaCityToCode[name])
|
|
|
+ biddingInfo.City = jyutil.AreaCityToCode[name].Name
|
|
|
+ areaTopTip = fmt.Sprintf("%s%s", biddingInfo.City, "招标网")
|
|
|
+ tdk = biddingInfo.City
|
|
|
+ } else {
|
|
|
+ biddingInfo.IsEffective = false //没有对应城市 异常
|
|
|
+ }
|
|
|
+ } else if !directRuleCity[biddingInfo.Area] { //非直辖市
|
|
|
+ tg.T["cityList"] = jyutil.AreaToCity[codes[0]]
|
|
|
}
|
|
|
if len(currentLocation) > 0 {
|
|
|
for _, cv := range currentLocation {
|
|
@@ -142,6 +157,8 @@ onceAgain:
|
|
|
biddingInfo.Total = 8
|
|
|
biddingInfo.PageSize = 8
|
|
|
hasIndustryNav = true
|
|
|
+ } else {
|
|
|
+ biddingInfo.IsEffective = false //没有对应城市 异常
|
|
|
}
|
|
|
}
|
|
|
case jyutil.Label["infoType"]: //信息类型
|
|
@@ -149,19 +166,19 @@ onceAgain:
|
|
|
codes = strings.Split(infoTypeToCode[name], "_")
|
|
|
}
|
|
|
if len(codes) == 2 {
|
|
|
- if topMap != nil && topMap[codes[0]] != nil {
|
|
|
+ if topInfoMap != nil && topInfoMap[codes[0]] != nil {
|
|
|
biddingInfo.IsEffective = true
|
|
|
- biddingInfo.TopType = bidsearch.TopType[topMap[codes[0]].Name]
|
|
|
+ biddingInfo.TopType = bidsearch.TopType[topInfoMap[codes[0]].Name]
|
|
|
if biddingInfo.TopType == "" {
|
|
|
biddingInfo.TopType = "拟建" //正常不会走到此处
|
|
|
}
|
|
|
- currentLocation = append(currentLocation, topMap[codes[0]])
|
|
|
- title = fmt.Sprintf("%s%s", topMap[codes[0]].Name, suffix)
|
|
|
+ code, _ := strconv.ParseInt(codes[0], 10, 64)
|
|
|
+ tdk = jyutil.CodeToInfoType[code]
|
|
|
+ currentLocation = append(currentLocation, topInfoMap[codes[0]])
|
|
|
biddingInfo.PageFormat(codes[1])
|
|
|
prevPage = fmt.Sprintf("%s_%d", codes[0], biddingInfo.PageNum-1)
|
|
|
nextPage = fmt.Sprintf("%s_%d", codes[0], biddingInfo.PageNum+1)
|
|
|
if biddingInfo.PageNum == 2 {
|
|
|
- code, _ := strconv.ParseInt(codes[0], 10, 64)
|
|
|
prevPage = jyutil.CodeToInfoType[code]
|
|
|
}
|
|
|
isInfoList = true
|
|
@@ -183,7 +200,7 @@ onceAgain:
|
|
|
biddingInfo.Industry = fmt.Sprintf("%s_%s", class1, class2) //行业
|
|
|
biddingInfo.Keys = indu2 //关键词
|
|
|
biddingInfo.Total = qu.IntAll(config.Seoconfig["seoUnderlyingAssetsTotal"]) //标的物查询数据量100
|
|
|
- title = fmt.Sprintf("%s招标采购%s", indu2, suffix)
|
|
|
+ tdk = indu2
|
|
|
biddingInfo.PageFormat(codes[4])
|
|
|
prevPage = fmt.Sprintf("%s_all_all_%s_%d", codes[0], codes[3], biddingInfo.PageNum-1)
|
|
|
nextPage = fmt.Sprintf("%s_all_all_%s_%d", codes[0], codes[3], biddingInfo.PageNum+1)
|
|
@@ -196,14 +213,12 @@ onceAgain:
|
|
|
biddingInfo.IsEffective = true
|
|
|
biddingInfo.IsSearch = false
|
|
|
tg.T["industryData"] = jyutil.GetIndustry("/jyapp/s/tags/industry/%d_all_all_%d.html") // 行业标的物全部
|
|
|
- title = fmt.Sprintf("%s%s", "招标导航", suffix)
|
|
|
}
|
|
|
case jyutil.Label["buyer"]: //采购单位
|
|
|
biddingInfo.IsEffective = true
|
|
|
biddingInfo.PageFormat(name)
|
|
|
prevPage = fmt.Sprintf("%d", biddingInfo.PageNum-1)
|
|
|
nextPage = fmt.Sprintf("%d", biddingInfo.PageNum+1)
|
|
|
- title = fmt.Sprintf("%s%s", "采购单位", suffix)
|
|
|
biddingInfo.IsBuyer = true
|
|
|
currentLocation = append(currentLocation, &jyutil.SeoInfo{
|
|
|
Name: "采购单位",
|
|
@@ -222,7 +237,6 @@ onceAgain:
|
|
|
})
|
|
|
biddingInfo.IsSearch = false
|
|
|
hasIndustryNav = true
|
|
|
- title = fmt.Sprintf("%s%s", "中标企业", suffix)
|
|
|
isInfoList = true
|
|
|
case jyutil.Label["home"]: //首页
|
|
|
if name == types {
|
|
@@ -246,7 +260,7 @@ onceAgain:
|
|
|
currentLocation[len(currentLocation)-1].Url = ""
|
|
|
}
|
|
|
tg.T["infoTypeList"] = infoTypeList //tg.GetInfoType()
|
|
|
- tg.T["areaList"] = areaList
|
|
|
+ tg.T["areaList"] = jyutil.AreaInfo
|
|
|
tg.T["currentLocation"] = currentLocation
|
|
|
//行业首页 不用广告位
|
|
|
if !(types == "industry" && name == "home") {
|
|
@@ -265,7 +279,7 @@ onceAgain:
|
|
|
tg.T["nextPage"] = qu.If(nextPage != "", fmt.Sprintf("/jyapp/s/tags/%s/%s.html", types, nextPage), "").(string)
|
|
|
tg.T["totalPage"] = (biddingInfo.Total-1)/biddingInfo.PageSize + 1
|
|
|
tg.T["pageNum"] = biddingInfo.PageNum
|
|
|
- tg.T["hotArea"] = jyutil.GetHotArea()
|
|
|
+ tg.T["hotArea"] = jyutil.HotAreas
|
|
|
if biddingInfo.IsBuyer && !biddingInfo.IsWinner {
|
|
|
//tg.T["buyerList"] = &jyutil.InfoRes{
|
|
|
// Name: "采购单位",
|
|
@@ -284,9 +298,8 @@ onceAgain:
|
|
|
tg.T["industryNav"] = jyutil.GetIndustryNav(jyutil.GetIndustry("/jyapp/s/tags/industry/%d_all_all_%d.html")) // 标的物小于等于5个字的
|
|
|
}
|
|
|
tg.T["areaTopTip"] = areaTopTip
|
|
|
- tg.T["title"] = title
|
|
|
//todo 获取tdk
|
|
|
- tg.T["tdk"] = jyutil.GetTdk(types, "")
|
|
|
+ tg.T["tdk"] = jyutil.GetTdk(types, tdk)
|
|
|
tg.T["HomeOrigin"] = "/jyapp/s/tags/home/home.html"
|
|
|
tg.T["Home"] = "/jyapp/jylab/mainSearch"
|
|
|
tg.T["isInfoList"] = isInfoList
|