cmd.go 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. package cmd
  2. import (
  3. "context"
  4. "github.com/gogf/gf/v2/frame/g"
  5. "github.com/gogf/gf/v2/net/ghttp"
  6. "github.com/gogf/gf/v2/os/gcmd"
  7. "jyseo/internal/controller"
  8. "jyseo/internal/logic/middleware"
  9. "jyseo/internal/service"
  10. _ "jyseo/internal/service"
  11. _ "jyseo/internal/tags"
  12. _ "jyseo/utility"
  13. )
  14. var (
  15. Main = gcmd.Command{
  16. Name: "main",
  17. Usage: "main",
  18. Brief: "start http jyseo server",
  19. Func: func(ctx context.Context, parser *gcmd.Parser) (err error) {
  20. s := g.Server()
  21. middleware.SaveLogTask()
  22. s.BindMiddlewareDefault(
  23. service.Middleware().Log, //访问日志
  24. service.Middleware().SetSeoRefer, // SetSeoRefer seo来源标记
  25. )
  26. s.Group("/", func(group *ghttp.RouterGroup) {
  27. group.GET("/jyseo/index.html", controller.IndexHandler) //首页
  28. s.Group("/list", func(group *ghttp.RouterGroup) {
  29. group.GET("/area/{areaCode}.html", controller.AreaIndexHandler) //地区首页
  30. group.GET("/city/{areaCode}.html", controller.AreaIndexHandler) //地区首页
  31. group.GET("/{type}/{areaCode}_{sId}/", controller.AreaPageHandler) //地区列表页面
  32. group.GET("/{type}/{areaCode}_{sId}/p{pageNum}", controller.AreaPageHandler) //地区列表页面
  33. group.GET("/stype/{code}.html", controller.STypePageHandler) //信息类型
  34. group.GET("/stype/{code}/p{pageNum}", controller.STypePageHandler) //信息类型
  35. group.GET("/industry/{industryCode}.html", controller.ListIndustryHandler) //行业列表
  36. group.GET("/{code}/", controller.SignPageHandler) //项目标签列表
  37. group.GET("/{code}/p{pageNum}", controller.SignPageHandler) //项目标签列表
  38. group.GET("/area/", controller.SiteAreaIndexHandler) //site省份汇总页
  39. group.GET("/city/", controller.SiteCityIndexHandler) //site城市汇总页
  40. group.GET("/area/{areaCode}_S{siteCode}/", controller.SiteHandler) //site关键词列表页面-省
  41. group.GET("/city/{areaCode}_{cityCode}_S{siteCode}/", controller.SiteHandler) //site关键词列表页面-市
  42. group.GET("/city/{areaCode}_{cityCode}_{districtCode}_S{siteCode}/", controller.SiteHandler) //site关键词列表页面-区县
  43. group.GET("/", controller.PinyinIndexHandler) //行业拼音关键词聚合页
  44. group.GET("/keywords/{pinyinCode}.html", controller.PinyinHandler) //行业拼音关键词列表页面
  45. group.GET("/{hyCode}_{kwId}.html", controller.KeywordLandingListHandler) //landing关键词列表页
  46. })
  47. s.Group("/tags", func(group *ghttp.RouterGroup) {
  48. group.GET("/industry/all.html", controller.IndustryIndexHandler) //行业首页
  49. group.GET("/industry/{industryClassId}_all_all_{keyWordId}.html", controller.IndustryListHandler) //行业列表
  50. group.GET("/industry/{industryClassId}_all_all_{keyWordId}_{pageNum}.html", controller.IndustryListHandler) //行业列表
  51. group.GET("/letter/{letterCode}_{pageNum}.html", controller.LetterIndexHandler) //字母标签页
  52. group.GET("/letter/{industryClassId}_{areaCode}_{sTypeId}_{letterCode}_{keywordCode}.html", controller.LetterListHandler) //字母列表页
  53. group.GET("/pt_{code}.html", controller.TagsPtHandler) //平台
  54. group.GET("/gs_{code}.html", controller.TagsGsHandler) //公司
  55. })
  56. // 行业报告
  57. s.Group("/hybg", func(group *ghttp.RouterGroup) {
  58. group.GET("/", controller.HybgIndexHandler) //行业报告首页
  59. group.GET("/{matchCode}/", controller.HybgListHandler) //行业报告列表页
  60. group.GET("/{matchCode}_{pageNum}/", controller.HybgListHandler) //行业报告列表页
  61. group.GET("/{keyword}/{dataCode}.html", controller.HybgListHandler) //行业报告关键词
  62. group.GET("/{detailId}.html", controller.HybgDetailHandler) //行业报告三级页
  63. group.POST("/marketAnalysis/analysisAudit", controller.AnalysisAudit) //中标企业详情
  64. })
  65. // 服务专栏
  66. s.Group("/fuwu", func(group *ghttp.RouterGroup) {
  67. group.GET("/", controller.FwIndexHandler) //服务专栏首页
  68. group.GET("/{fuWuCode}.html", controller.FwKeywordIndexHandler) //服务专栏关键词首页
  69. group.GET("/{fuWuCode}_{areaCode}.html", controller.FwKeywordAreaListHandler) //关键词地区列表页面
  70. })
  71. group.GET("/dw/", controller.EnterpriseList) //采购单位列表
  72. group.GET("/dw/p{pageNum}", controller.EnterpriseList) //采购单位列表
  73. group.GET("/dw/{seoId}.html", controller.EnterpriseDetail) //采购单位详情
  74. group.GET("/qy/", controller.EnterpriseList) //中标企业列表
  75. group.GET("/qy/p{pageNum}", controller.EnterpriseList) //中标企业列表
  76. group.GET("/qy/{seoId}.html", controller.EnterpriseDetail) //中标企业详情
  77. group.GET("/nologin/{stype}/*any", controller.DetailHandler) //标讯详情
  78. group.GET("/promotional/{code}.html", controller.DebrisProductHandler) //碎片化小程序
  79. })
  80. s.AddStaticPath("/jyseo", "/resource/staticres") //静态资源
  81. s.Run()
  82. return nil
  83. },
  84. }
  85. )