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")
|
|
|
|
apiGroup.Use(base.Recovery)
|
|
|
|
apiGroup.Any("/qyweixin/approve", qyweixin.Approve)
|
2023-09-04 21:58:26 +08:00
|
|
|
apiGroup.GET("/staff/salary", staff.Salary)
|
|
|
|
|
|
|
|
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
|
|
|
}
|