提交 e5b95921 编写于 作者: U Ulric Qin

add some validator for hostFieldNew

上级 8c672680
......@@ -12,6 +12,22 @@ func hostFieldNew(c *gin.Context) {
var obj models.HostField
bind(c, &obj)
if obj.FieldIdent == "" {
bomb("field_ident is blank")
}
if obj.FieldName == "" {
bomb("field_name is blank")
}
if obj.FieldType == "" {
bomb("field_type is blank")
}
if obj.FieldCate == "" {
obj.FieldCate = "Default"
}
renderMessage(c, models.HostFieldNew(&obj))
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册