package server import ( "enterprise/common/config" "enterprise/server/controller" "github.com/gin-gonic/gin" ) func initRoutge(engine *gin.Engine) { qyweixin := new(controller.QyWeixin) staff := new(controller.Staff) base := new(controller.Base) apiGroup := engine.Group("/api") group := engine.Group("/") apiGroup.Use(base.Recovery) group.Use(base.Recovery) apiGroup.Any("/qyweixin/approve", qyweixin.Approve) group.Any("/qyweixin/approve", qyweixin.Approve) group.GET("/staff/salary", staff.Salary) engine.LoadHTMLGlob("conf/template/*") } func Start() error { cfg := config.GetConfig() engine := gin.New() initRoutge(engine) return engine.Run(cfg.Server.Address) }