shaoyongjun 47d60ce740 to:sync
2024-05-20 10:19:46 +08:00

61 lines
1.9 KiB
Go

package static
import (
"github.com/labstack/echo/v4"
"net/http"
)
func Login(c echo.Context) error {
c.Response().Header().Set("Content-Type", "text/html; charset=utf-8")
c.Response().Header().Set("Cache-Control", "max-age=3600")
return c.Blob(http.StatusOK, "text/html; charset=utf-8", pageMap["login.html"])
}
func Chat(c echo.Context) error {
c.Response().Header().Set("Content-Type", "text/html; charset=utf-8")
c.Response().Header().Set("Cache-Control", "max-age=3600")
return c.Blob(http.StatusOK, "text/html; charset=utf-8", pageMap["ai-chat.html"])
}
func Chat1(c echo.Context) error {
c.Response().Header().Set("Content-Type", "text/html; charset=utf-8")
c.Response().Header().Set("Cache-Control", "max-age=3600")
return c.Blob(http.StatusOK, "text/html; charset=utf-8", pageMap["ai-chat1.html"])
}
func Chat2(c echo.Context) error {
c.Response().Header().Set("Content-Type", "text/html; charset=utf-8")
c.Response().Header().Set("Cache-Control", "max-age=3600")
return c.Blob(http.StatusOK, "text/html; charset=utf-8", pageMap["ai-chat2.html"])
}
func InitStaticGroup(g *echo.Group) {
g.GET("login.html", func(c echo.Context) error {
c.Response().Header().Set("Content-Type", "text/html; charset=utf-8")
c.Response().Header().Set("Cache-Control", "max-age=3600")
return c.Blob(http.StatusOK, "text/html; charset=utf-8", pageMap["login.html"])
})
g.GET("css/login.css", func(c echo.Context) error {
c.Response().Header().Set("Cache-Control", "max-age=3600")
data, _ := cssMap["login.css"]
return c.Blob(http.StatusOK, "text/css; charset=utf-8", data)
})
g.GET("img/003.jpeg", func(c echo.Context) error {
c.Response().Header().Set("Cache-Control", "max-age=3600")
return c.Blob(http.StatusOK, "image/jpeg", imgMap()["003.jpeg"])
})
g.GET("/aa", func(c echo.Context) error {
c.Response().Header().Set("Content-Type", "text/html; charset=utf-8")
return c.String(http.StatusOK, `<p>html代码</p>`)
})
}