refactor: validator调整

This commit is contained in:
meilin.huang
2023-08-04 12:22:21 +08:00
parent c2ee4f9955
commit 3ae7e0de75
9 changed files with 156 additions and 54 deletions

View File

@@ -0,0 +1,8 @@
package router
import "github.com/gin-gonic/gin"
func Init(router *gin.RouterGroup) {
InitCommonRouter(router)
InitIndexRouter(router)
}

View File

@@ -104,6 +104,7 @@ func (m *MachineFile) GetDirEntry(rc *req.Ctx) {
g := rc.GinCtx
fid := GetMachineFileId(g)
readPath := g.Query("path")
rc.ReqParam = fmt.Sprintf("path: %s", readPath)
if !strings.HasSuffix(readPath, "/") {
readPath = readPath + "/"
@@ -120,7 +121,6 @@ func (m *MachineFile) GetDirEntry(rc *req.Ctx) {
}
sort.Sort(vo.MachineFileInfos(fisVO))
rc.ResData = fisVO
rc.ReqParam = fmt.Sprintf("path: %s", readPath)
}
func (m *MachineFile) GetDirSize(rc *req.Ctx) {

View File

@@ -2,7 +2,7 @@ package form
type AccountCreateForm struct {
Id uint64 `json:"id"`
Name string `json:"name" binding:"required,max=16"`
Name string `json:"name" binding:"required,max=16" msg:"required=姓名不能为空,max=姓名最大长度不能超过16位"`
Username string `json:"username" binding:"pattern=account_username"`
Password string `json:"password"`
}