dev
This commit is contained in:
@@ -1,11 +1,30 @@
|
||||
package routers
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"git.apinb.com/senlinai/site/internal/logic"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// Register public 注册路由
|
||||
func Registers_Public(engine *gin.Engine) {
|
||||
//fmt.Println("Register public")
|
||||
|
||||
func RegistersPublic(engine *gin.Engine) {
|
||||
engine.GET("/", logic.Index)
|
||||
}
|
||||
|
||||
func RegistersAll(engine *gin.Engine) {
|
||||
templs, err := os.ReadDir("./res/templates/")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
for _, item := range templs {
|
||||
name := strings.TrimSuffix(item.Name(), ".html")
|
||||
engine.GET("/all/"+name, func(ctx *gin.Context) {
|
||||
ctx.Set("TplName", item.Name())
|
||||
logic.All(ctx)
|
||||
return
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user