bidDetail.go 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. package controller
  2. import (
  3. util "app.yhyue.com/moapp/jybase/common"
  4. "app.yhyue.com/moapp/jybase/encrypt"
  5. "fmt"
  6. "github.com/gogf/gf/v2/frame/g"
  7. "github.com/gogf/gf/v2/net/ghttp"
  8. "jyseo/internal/service"
  9. "jyseo/utility"
  10. "strings"
  11. )
  12. func DetailHandler(r *ghttp.Request) {
  13. bidId := r.Get("bidId").String()
  14. isLogin := utility.JySessionLoginEd(r)
  15. if isLogin {
  16. service.HtmlRender.NotFound(r)
  17. return
  18. }
  19. sids := encrypt.CommonDecodeArticle("content", bidId)
  20. if len(sids) == 0 || (len(sids) > 0 && sids[0] == "") {
  21. r.Response.RedirectTo(fmt.Sprintf("/front/notFind?t=%d", service.DecodeErr), 302)
  22. return
  23. }
  24. //白名单
  25. var isWhiteIp bool
  26. ips := strings.Split(util.GetIp(r.Request), ",")
  27. if len(ips) > 0 {
  28. isWhiteIp = service.IpList.Match(ips[0])
  29. }
  30. canRead := true
  31. bidData := service.GetBidInfo(sids[0], "content", isWhiteIp)
  32. if bidData == nil || len(bidData) <= 0 {
  33. r.Response.RedirectTo(fmt.Sprintf("/front/notFind?t=%d", service.DecodeErr), 302)
  34. return
  35. //return s.Redirect(getErrPageUrl(isMobile, QueryErr), 302)
  36. }
  37. // p397 未登录不能查看拟建项目
  38. if !isWhiteIp && (bidData["subtype"] == "采购意向" || bidData["subtype"] == "拟建") { //未登录拟建 采购意向 遮罩
  39. canRead = false
  40. }
  41. //最新招投标
  42. //newBidInfoList := service.GetNewBidInfo(bidId, strings.Join(gconv.Strings(bidData["s_subscopeclass"]), ","), gconv.String(bidData["area"]), gconv.String(bidData["city"]))
  43. //招投标攻略
  44. industryInfoList := service.GetBiddingStrategy(10)
  45. service.HtmlRender.Render(r, "detail.html",
  46. g.Map{
  47. "bidData": bidData,
  48. //"newBidInfoList": newBidInfoList,
  49. "industryInfoList": industryInfoList,
  50. "canRead": canRead,
  51. })
  52. }