Files
新亮 8ed27cdce1 feature(1.2.8): 使用 embed 打包静态资源
- go version 升级为 1.16
- 使用 embed 特性,将静态资源打包进二进制文件
- 优化代码
2021-11-20 15:01:50 +08:00

43 lines
822 B
Go

package install
import (
"net/http"
"runtime"
"github.com/xinliangnote/go-gin-api/configs"
"github.com/xinliangnote/go-gin-api/internal/pkg/core"
"github.com/xinliangnote/go-gin-api/pkg/file"
"go.uber.org/zap"
)
type handler struct {
logger *zap.Logger
}
func New(logger *zap.Logger) *handler {
return &handler{
logger: logger,
}
}
func (h *handler) View() core.HandlerFunc {
type viewResponse struct {
Config configs.Config
MinGoVersion float64
GoVersion string
}
return func(ctx core.Context) {
if _, ok := file.IsExists(configs.ProjectInstallMark); ok {
ctx.Redirect(http.StatusTemporaryRedirect, "/")
}
obj := new(viewResponse)
obj.Config = configs.Get()
obj.MinGoVersion = configs.MinGoVersion
obj.GoVersion = runtime.Version()
ctx.HTML("install_view", obj)
}
}