12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- package controller
- import (
- util "app.yhyue.com/moapp/jybase/common"
- "app.yhyue.com/moapp/jybase/encrypt"
- "fmt"
- "github.com/gogf/gf/v2/frame/g"
- "github.com/gogf/gf/v2/net/ghttp"
- "jyseo/internal/service"
- "jyseo/utility"
- "strings"
- )
- func DetailHandler(r *ghttp.Request) {
- bidId := r.Get("bidId").String()
- isLogin := utility.JySessionLoginEd(r)
- if isLogin {
- service.HtmlRender.NotFound(r)
- return
- }
- sids := encrypt.CommonDecodeArticle("content", bidId)
- if len(sids) == 0 || (len(sids) > 0 && sids[0] == "") {
- r.Response.RedirectTo(fmt.Sprintf("/front/notFind?t=%d", service.DecodeErr), 302)
- return
- }
- //白名单
- var isWhiteIp bool
- ips := strings.Split(util.GetIp(r.Request), ",")
- if len(ips) > 0 {
- isWhiteIp = service.IpList.Match(ips[0])
- }
- canRead := true
- bidData := service.GetBidInfo(sids[0], "content", isWhiteIp)
- if bidData == nil || len(bidData) <= 0 {
- r.Response.RedirectTo(fmt.Sprintf("/front/notFind?t=%d", service.DecodeErr), 302)
- return
- //return s.Redirect(getErrPageUrl(isMobile, QueryErr), 302)
- }
- // p397 未登录不能查看拟建项目
- if !isWhiteIp && (bidData["subtype"] == "采购意向" || bidData["subtype"] == "拟建") { //未登录拟建 采购意向 遮罩
- canRead = false
- }
- //最新招投标
- //newBidInfoList := service.GetNewBidInfo(bidId, strings.Join(gconv.Strings(bidData["s_subscopeclass"]), ","), gconv.String(bidData["area"]), gconv.String(bidData["city"]))
- //招投标攻略
- industryInfoList := service.GetBiddingStrategy(10)
- service.HtmlRender.Render(r, "detail.html",
- g.Map{
- "bidData": bidData,
- //"newBidInfoList": newBidInfoList,
- "industryInfoList": industryInfoList,
- "canRead": canRead,
- })
- }
|