|
@@ -16,6 +16,9 @@ var PageManage service.Page = &model.PageManage{}
|
|
|
func GetPageManage(c *gin.Context) {
|
|
|
var page unity.QueryPageParams
|
|
|
uid := unity.GetUId(c)
|
|
|
+ // 查询条件:查询name
|
|
|
+ queryCond := "name like ?"
|
|
|
+ page.Query = "%" + page.Query + "%"
|
|
|
err := c.ShouldBindJSON(&page)
|
|
|
if err != nil {
|
|
|
e.ResponseWithMsg(c, e.JSONParsingFailed, e.JSONParsingFailed.GetMsg())
|
|
@@ -25,7 +28,7 @@ func GetPageManage(c *gin.Context) {
|
|
|
e.ResponseWithMsg(c, e.ERROR, "用户不存在")
|
|
|
return
|
|
|
} else if uid == 1 {
|
|
|
- result, total, err := unity.PaginateWithCondition(page, model.PageManage{}, nil)
|
|
|
+ result, total, err := unity.PaginateWithCondition(page, model.PageManage{}, queryCond)
|
|
|
if err != nil {
|
|
|
e.ResponseWithMsg(c, e.PaginationFailed, e.PaginationFailed.GetMsg())
|
|
|
return
|
|
@@ -35,7 +38,7 @@ func GetPageManage(c *gin.Context) {
|
|
|
}
|
|
|
var manage model.PageManage
|
|
|
manage.UserId = uid
|
|
|
- result, total, err := PageManage.GetPageManage(page, manage, nil)
|
|
|
+ result, total, err := PageManage.GetPageManage(page, manage, queryCond)
|
|
|
if err != nil {
|
|
|
e.ResponseWithMsg(c, e.PaginationFailed, e.PaginationFailed.GetMsg())
|
|
|
return
|
|
@@ -64,6 +67,7 @@ func GetPageManageById(c *gin.Context) {
|
|
|
return
|
|
|
}
|
|
|
e.ResponseSuccess(c, result)
|
|
|
+ return
|
|
|
}
|
|
|
byId, err := PageManage.GetPageManageById(uid, id)
|
|
|
if err != nil {
|
|
@@ -127,6 +131,7 @@ func UpdatePageManage(c *gin.Context) {
|
|
|
e.ResponseWithMsg(c, e.TheUserIsEmpty, e.TheUserIsEmpty.GetMsg())
|
|
|
return
|
|
|
} else if uid == 1 {
|
|
|
+ page.UserId = 0
|
|
|
_, err = unity.UpdateById(id, &page)
|
|
|
if err != nil {
|
|
|
e.ResponseWithMsg(c, e.UPDATEFAIL, e.UPDATEFAIL.GetMsg())
|