package Services import ( "github.com/gin-gonic/gin" "net/http" ) func LoginCheck(name string, password string, c *gin.Context) map[string]bool { status := map[string]bool{ "nameStatus": true, "passwordStatus": true, } if len(name) == 0 { c.JSON(http.StatusUnprocessableEntity, gin.H{ "code": 422, "message": "用户名不能为空", }) status["nameStatus"] = false } if len(password) == 0 { c.JSON(http.StatusUnprocessableEntity, gin.H{ "code": 422, "message": "密码不能为空", }) status["passwordStatus"] = false } return status }