You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
868 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package CheckHandler
import (
"github.com/gin-gonic/gin"
"strings"
)
/**
功能:检查字符串是否为空
作者:黄海
时间2020-03-17
*/
func emptyLimitIsLegal(c *gin.Context, interName string, n int) (bool, ResultStruct) {
//1、调用通用检查器
success, resultStruct, httpType, arr := commonIsLegal(c, interName, n)
if !success {
return success, resultStruct
}
//2、如果通过了常规检查那么进行业务专用检查
for i := 0; i < len(arr); i++ {
paraStruct := arr[i]
if len(strings.Trim(paraStruct.inputParameterValue, "")) == 0 {
resultStruct.InterfaceName = interName
resultStruct.HttpType = httpType
resultStruct.Parameter = paraStruct.parameterName
resultStruct.Message = "参数" + paraStruct.parameterName + "输入值不能为空!"
return false, resultStruct
}
}
return true, resultStruct
}