cmd.go 707 B

12345678910111213141516171819202122232425262728
  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/service"
  9. )
  10. var (
  11. Main = gcmd.Command{
  12. Name: "main",
  13. Usage: "main",
  14. Brief: "start http jyseo server",
  15. Func: func(ctx context.Context, parser *gcmd.Parser) (err error) {
  16. s := g.Server()
  17. s.Group("/", func(group *ghttp.RouterGroup) {
  18. group.GET("/list/{{module}}/{{param}}.html", controller.ListPage)
  19. })
  20. s.AddStaticPath("", "/resource/staticres") //静态资源
  21. // searchResult xweb.Mapper `xweb:"/list/(\\w+)/(\\w+).html"` //剑鱼标讯分类 地区结果列表
  22. s.Run()
  23. return nil
  24. },
  25. }
  26. )