caipin 3 years ago
parent
commit
a93a2e0eb8
2 changed files with 9 additions and 2 deletions
  1. 1 2
      web/external/jl_bb.go
  2. 8 0
      web/viewmodels/jl.go

+ 1 - 2
web/external/jl_bb.go

@@ -33,8 +33,7 @@ func (c *JlBb) GetFolder() {
 	}
 	}
 
 
 	// 1-1.校验是否存在code
 	// 1-1.校验是否存在code
-	if err := data.ValidateCode(); err != nil {
-
+	if err := data.ValidateCodeAToken(); err != nil {
 		c.Ctx.JSON(iris.Map{"code": -1, "msg": fmt.Sprintf("%s", err)})
 		c.Ctx.JSON(iris.Map{"code": -1, "msg": fmt.Sprintf("%s", err)})
 		return
 		return
 	}
 	}

+ 8 - 0
web/viewmodels/jl.go

@@ -28,6 +28,14 @@ func (l Jl) ValidateToken() error {
 }
 }
 
 
 // 校验项目接口
 // 校验项目接口
+func (l Jl) ValidateCodeAToken() error {
+	return validation.ValidateStruct(&l,
+		validation.Field(&l.Code, validation.Required.Error("项目编号不能为空")),
+		validation.Field(&l.Token, validation.Required.Error("token不能为空")),
+	)
+}
+
+// 校验项目接口
 func (l Jl) ValidateCode() error {
 func (l Jl) ValidateCode() error {
 	return validation.ValidateStruct(&l,
 	return validation.ValidateStruct(&l,
 		validation.Field(&l.Code, validation.Required.Error("项目编号不能为空")),
 		validation.Field(&l.Code, validation.Required.Error("项目编号不能为空")),