mirror of
https://github.com/xinliangnote/go-gin-api.git
synced 2024-04-21 12:31:46 +00:00
feature(1.2.8): 使用 embed 打包静态资源
- go version 升级为 1.16 - 使用 embed 特性,将静态资源打包进二进制文件 - 优化代码
This commit is contained in:
@@ -3,10 +3,10 @@ package cron_handler
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/xinliangnote/go-gin-api/internal/api/service/cron_service"
|
||||
"github.com/xinliangnote/go-gin-api/internal/pkg/code"
|
||||
"github.com/xinliangnote/go-gin-api/internal/code"
|
||||
"github.com/xinliangnote/go-gin-api/internal/pkg/core"
|
||||
"github.com/xinliangnote/go-gin-api/internal/pkg/validation"
|
||||
cron2 "github.com/xinliangnote/go-gin-api/internal/services/cron"
|
||||
"github.com/xinliangnote/go-gin-api/pkg/errno"
|
||||
)
|
||||
|
||||
@@ -67,7 +67,7 @@ func (h *handler) Create() core.HandlerFunc {
|
||||
return
|
||||
}
|
||||
|
||||
createData := new(cron_service.CreateCronTaskData)
|
||||
createData := new(cron2.CreateCronTaskData)
|
||||
createData.Name = req.Name
|
||||
createData.Spec = req.Spec
|
||||
createData.Command = req.Command
|
||||
|
||||
@@ -3,10 +3,10 @@ package cron_handler
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/xinliangnote/go-gin-api/internal/api/service/cron_service"
|
||||
"github.com/xinliangnote/go-gin-api/internal/pkg/code"
|
||||
"github.com/xinliangnote/go-gin-api/internal/code"
|
||||
"github.com/xinliangnote/go-gin-api/internal/pkg/core"
|
||||
"github.com/xinliangnote/go-gin-api/internal/pkg/validation"
|
||||
cron2 "github.com/xinliangnote/go-gin-api/internal/services/cron"
|
||||
"github.com/xinliangnote/go-gin-api/pkg/errno"
|
||||
|
||||
"github.com/spf13/cast"
|
||||
@@ -66,7 +66,7 @@ func (h *handler) Detail() core.HandlerFunc {
|
||||
return
|
||||
}
|
||||
|
||||
searchOneData := new(cron_service.SearchOneData)
|
||||
searchOneData := new(cron2.SearchOneData)
|
||||
searchOneData.Id = cast.ToInt32(ids[0])
|
||||
|
||||
info, err := h.cronService.Detail(ctx, searchOneData)
|
||||
|
||||
@@ -3,7 +3,7 @@ package cron_handler
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/xinliangnote/go-gin-api/internal/pkg/code"
|
||||
"github.com/xinliangnote/go-gin-api/internal/code"
|
||||
"github.com/xinliangnote/go-gin-api/internal/pkg/core"
|
||||
"github.com/xinliangnote/go-gin-api/internal/pkg/validation"
|
||||
"github.com/xinliangnote/go-gin-api/pkg/errno"
|
||||
|
||||
@@ -4,12 +4,12 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/xinliangnote/go-gin-api/internal/api/repository/db_repo/cron_task_repo"
|
||||
"github.com/xinliangnote/go-gin-api/internal/api/service/cron_service"
|
||||
"github.com/xinliangnote/go-gin-api/internal/pkg/code"
|
||||
"github.com/xinliangnote/go-gin-api/internal/code"
|
||||
"github.com/xinliangnote/go-gin-api/internal/pkg/core"
|
||||
"github.com/xinliangnote/go-gin-api/internal/pkg/validation"
|
||||
cron2 "github.com/xinliangnote/go-gin-api/internal/services/cron"
|
||||
"github.com/xinliangnote/go-gin-api/pkg/errno"
|
||||
"github.com/xinliangnote/go-gin-api/pkg/time_parse"
|
||||
"github.com/xinliangnote/go-gin-api/pkg/timeutil"
|
||||
|
||||
"github.com/spf13/cast"
|
||||
)
|
||||
@@ -91,7 +91,7 @@ func (h *handler) List() core.HandlerFunc {
|
||||
pageSize = 10
|
||||
}
|
||||
|
||||
searchData := new(cron_service.SearchData)
|
||||
searchData := new(cron2.SearchData)
|
||||
searchData.Page = req.Page
|
||||
searchData.PageSize = req.PageSize
|
||||
searchData.Name = req.Name
|
||||
@@ -151,9 +151,9 @@ func (h *handler) List() core.HandlerFunc {
|
||||
NotifyStatusText: cron_task_repo.NotifyStatusText[v.NotifyStatus],
|
||||
IsUsed: cast.ToInt(v.IsUsed),
|
||||
IsUsedText: cron_task_repo.IsUsedText[v.IsUsed],
|
||||
CreatedAt: v.CreatedAt.Format(time_parse.CSTLayout),
|
||||
CreatedAt: v.CreatedAt.Format(timeutil.CSTLayout),
|
||||
CreatedUser: v.CreatedUser,
|
||||
UpdatedAt: v.UpdatedAt.Format(time_parse.CSTLayout),
|
||||
UpdatedAt: v.UpdatedAt.Format(timeutil.CSTLayout),
|
||||
UpdatedUser: v.UpdatedUser,
|
||||
}
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@ package cron_handler
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/xinliangnote/go-gin-api/internal/api/service/cron_service"
|
||||
"github.com/xinliangnote/go-gin-api/internal/pkg/code"
|
||||
"github.com/xinliangnote/go-gin-api/internal/code"
|
||||
"github.com/xinliangnote/go-gin-api/internal/pkg/core"
|
||||
"github.com/xinliangnote/go-gin-api/internal/pkg/validation"
|
||||
cron2 "github.com/xinliangnote/go-gin-api/internal/services/cron"
|
||||
"github.com/xinliangnote/go-gin-api/pkg/errno"
|
||||
)
|
||||
|
||||
@@ -81,7 +81,7 @@ func (h *handler) Modify() core.HandlerFunc {
|
||||
|
||||
id := int32(ids[0])
|
||||
|
||||
modifyData := new(cron_service.ModifyCronTaskData)
|
||||
modifyData := new(cron2.ModifyCronTaskData)
|
||||
modifyData.Name = req.Name
|
||||
modifyData.Spec = req.Spec
|
||||
modifyData.Command = req.Command
|
||||
|
||||
@@ -3,7 +3,7 @@ package cron_handler
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/xinliangnote/go-gin-api/internal/pkg/code"
|
||||
"github.com/xinliangnote/go-gin-api/internal/code"
|
||||
"github.com/xinliangnote/go-gin-api/internal/pkg/core"
|
||||
"github.com/xinliangnote/go-gin-api/internal/pkg/validation"
|
||||
"github.com/xinliangnote/go-gin-api/pkg/errno"
|
||||
|
||||
@@ -2,11 +2,11 @@ package cron_handler
|
||||
|
||||
import (
|
||||
"github.com/xinliangnote/go-gin-api/configs"
|
||||
"github.com/xinliangnote/go-gin-api/internal/api/service/cron_service"
|
||||
"github.com/xinliangnote/go-gin-api/internal/api/repository/redis"
|
||||
"github.com/xinliangnote/go-gin-api/internal/cron/cron_server"
|
||||
"github.com/xinliangnote/go-gin-api/internal/pkg/cache"
|
||||
"github.com/xinliangnote/go-gin-api/internal/pkg/core"
|
||||
"github.com/xinliangnote/go-gin-api/internal/pkg/db"
|
||||
"github.com/xinliangnote/go-gin-api/internal/services/cron"
|
||||
"github.com/xinliangnote/go-gin-api/pkg/hash"
|
||||
|
||||
"go.uber.org/zap"
|
||||
@@ -50,17 +50,17 @@ type Handler interface {
|
||||
|
||||
type handler struct {
|
||||
logger *zap.Logger
|
||||
cache cache.Repo
|
||||
cache redis.Repo
|
||||
hashids hash.Hash
|
||||
cronService cron_service.Service
|
||||
cronService cron.Service
|
||||
}
|
||||
|
||||
func New(logger *zap.Logger, db db.Repo, cache cache.Repo, cron cron_server.Server) Handler {
|
||||
func New(logger *zap.Logger, db db.Repo, cache redis.Repo, cronServer cron_server.Server) Handler {
|
||||
return &handler{
|
||||
logger: logger,
|
||||
cache: cache,
|
||||
hashids: hash.New(configs.Get().HashIds.Secret, configs.Get().HashIds.Length),
|
||||
cronService: cron_service.New(db, cache, cron),
|
||||
cronService: cron.New(db, cache, cronServer),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user