enterprise/server/server.go

33 lines
794 B
Go
Raw Normal View History

2023-08-04 11:13:41 +08:00
package server
2023-08-13 21:24:54 +08:00
import (
"enterprise/common/config"
"enterprise/server/controller"
"github.com/gin-gonic/gin"
)
func initRoutge(engine *gin.Engine) {
qyweixin := new(controller.QyWeixin)
2023-09-04 21:58:26 +08:00
staff := new(controller.Staff)
2023-08-13 21:24:54 +08:00
base := new(controller.Base)
apiGroup := engine.Group("/api")
2023-09-05 19:45:04 +08:00
group := engine.Group("/")
2023-08-13 21:24:54 +08:00
apiGroup.Use(base.Recovery)
2023-09-05 19:45:04 +08:00
group.Use(base.Recovery)
2023-08-13 21:24:54 +08:00
apiGroup.Any("/qyweixin/approve", qyweixin.Approve)
2024-01-24 16:19:06 +08:00
apiGroup.Any("/qyweixin/pay", qyweixin.Pay)
2023-09-05 20:40:34 +08:00
2023-09-05 19:45:04 +08:00
group.GET("/staff/salary", staff.Salary)
2023-12-02 16:32:04 +08:00
group.GET("/staff/sync/salary", staff.SyncStaffSalary)
group.GET("/staff/sync/info", staff.SyncStaffInfo)
2023-09-04 21:58:26 +08:00
engine.LoadHTMLGlob("conf/template/*")
2023-08-13 21:24:54 +08:00
}
2023-08-04 11:13:41 +08:00
func Start() error {
2023-08-13 21:24:54 +08:00
cfg := config.GetConfig()
engine := gin.New()
initRoutge(engine)
return engine.Run(cfg.Server.Address)
2023-08-04 11:13:41 +08:00
}