mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-11-13 20:53:47 +08:00
管理后台用户算力日志页面增加过滤查询功能
This commit is contained in:
@@ -17,9 +17,10 @@ import (
|
||||
"geekai/store/vo"
|
||||
"geekai/utils"
|
||||
"geekai/utils/resp"
|
||||
"github.com/go-redis/redis/v8"
|
||||
"time"
|
||||
|
||||
"github.com/go-redis/redis/v8"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
@@ -39,6 +40,8 @@ func (h *UserHandler) List(c *gin.Context) {
|
||||
page := h.GetInt(c, "page", 1)
|
||||
pageSize := h.GetInt(c, "page_size", 20)
|
||||
username := h.GetTrim(c, "username")
|
||||
mobile := h.GetTrim(c, "mobile")
|
||||
email := h.GetTrim(c, "email")
|
||||
|
||||
offset := (page - 1) * pageSize
|
||||
var items []model.User
|
||||
@@ -49,6 +52,12 @@ func (h *UserHandler) List(c *gin.Context) {
|
||||
if username != "" {
|
||||
session = session.Where("username LIKE ?", "%"+username+"%")
|
||||
}
|
||||
if mobile != "" {
|
||||
session = session.Where("mobile LIKE ?", "%"+mobile+"%")
|
||||
}
|
||||
if email != "" {
|
||||
session = session.Where("email LIKE ?", "%"+email+"%")
|
||||
}
|
||||
|
||||
session.Model(&model.User{}).Count(&total)
|
||||
res := session.Offset(offset).Limit(pageSize).Order("id DESC").Find(&items)
|
||||
|
||||
Reference in New Issue
Block a user