封装基础数据操作,错误返回

This commit is contained in:
qiyunfanbo126.com 2024-05-07 18:32:07 +08:00
parent 34a7a78894
commit f1a968c3a2
3 changed files with 5 additions and 4 deletions

View File

@ -12,7 +12,6 @@ func Login(c *gin.Context) {
}
func UserList(c *gin.Context) {
request := controllers.GetRequest(c).(backend.UserListRequest)
where := map[string]interface{}{
"Mobile": request.Mobile,

View File

@ -59,7 +59,7 @@ func ValidateRequest() gin.HandlerFunc {
return func(c *gin.Context) {
var path = c.Request.RequestURI
var handler func() interface{}
if strings.Index(path, "api") >= 0 {
if strings.Index(path, "admin") >= 0 {
handler = requestmapping.BackendRequestMap[path]
} else {
handler = requestmapping.FrontRequestMap[path]

View File

@ -18,9 +18,11 @@ func GetListByWhere(where map[string]interface{}, page int, limit int) (count in
conn := builder.NewCond()
UserListInfo := []userinfomodel.UserInfo{}
for k, v := range where {
if v != "" {
conn = conn.And(builder.Like{k, fmt.Sprint(v)})
if v.(string) == "" || v.(float64) == 0 {
continue
}
builder.NewCond()
conn = conn.And(builder.Like{k, fmt.Sprint(v)})
}
session := userinfomodel.GetInstance().GetDb().Where(conn)