first commit
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"xiawan/wx/api/vo"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func validateData(ctx *gin.Context, model interface{}) bool {
|
||||
// ShouldBindJSON
|
||||
err := ctx.ShouldBindJSON(&model)
|
||||
if err != nil {
|
||||
ctx.JSON(http.StatusOK, vo.DTO{
|
||||
Code: vo.FAIL_DATA,
|
||||
Data: nil,
|
||||
Text: "\"提交数据错误!\"",
|
||||
})
|
||||
ctx.Abort()
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
Reference in New Issue
Block a user