This commit is contained in:
aozhiwei 2023-10-01 09:49:21 +08:00
parent 354c5e7166
commit a5c700416c
3 changed files with 3 additions and 70 deletions

View File

@ -27,9 +27,10 @@ func (this *app) Run(initCb func(), unInitCb func()) {
func (this *app) Init() {
f5.LoadMetaTable(mt.Table)
this.registerDataSources()
//this.ginEngine = gin.New()
//this.ginEngine.Use(gin.Recovery())
this.ginEngine = gin.New()
this.ginEngine.Use(gin.Recovery())
this.initCb()
go this.ginEngine.Run(":3000")
}
func (this *app) UnInit() {

View File

@ -1,57 +0,0 @@
package main
import (
//"adminsever/api"
//"adminsever/db"
"f5"
"main/router"
"github.com/gin-gonic/gin"
"golang.org/x/sync/errgroup"
"net/http"
)
type GinMgr struct {
group errgroup.Group
}
func (this *GinMgr) init() {
runGinServer()
//server01 := &http.Server{
// Addr: ":8080",
// Handler: this.router(),
// ReadTimeout: 5 * time.Second,
// WriteTimeout: 10 * time.Second,
//}
//this.group.Go(func() error {
// return server01.ListenAndServe()
//})
f5.GetSysLog().Info("%s", router.RouterGroupApp)
}
func (this *GinMgr) unInit() {
}
func (this *GinMgr) router() http.Handler {
r := gin.New()
r.Use(gin.Recovery())
r.GET("/webapp/index.php", func(c *gin.Context) {
c.JSON(200, gin.H{
"errcode": 0,
"errmsg": "",
})
})
return r
}
func runGinServer() {
/*
store := db.GetDB()
server, err := api.NewServer(store)
if err != nil {
f5.GetSysLog().Info("cannot create server err:%v \n", err)
}
err = server.Start("localhost:8080")
if err != nil {
f5.GetSysLog().Info("cannot start server err:%v \n", err)
}*/
}

View File

@ -1,11 +0,0 @@
package router
import (
"main/router/system"
)
type RouterGroup struct {
System system.RouterGroup
}
var RouterGroupApp = new(RouterGroup)