feat(用户管理): 添加设备ID筛选用户列表功能
All checks were successful
Build docker and publish / build (20.15.1) (push) Successful in 6m38s
All checks were successful
Build docker and publish / build (20.15.1) (push) Successful in 6m38s
在用户列表查询中新增设备ID筛选条件,支持通过设备ID或设备标识符查询关联用户
This commit is contained in:
parent
d7b56f3edc
commit
1f5eb2784d
@ -21,6 +21,7 @@ type (
|
||||
UserId *int64 `form:"user_id,omitempty"`
|
||||
SubscribeId *int64 `form:"subscribe_id,omitempty"`
|
||||
UserSubscribeId *int64 `form:"user_subscribe_id,omitempty"`
|
||||
DeviceId string `form:"device_id,omitempty"`
|
||||
}
|
||||
// GetUserListResponse
|
||||
GetUserListResponse {
|
||||
@ -292,4 +293,3 @@ service ppanel {
|
||||
@handler GetUserLoginLogs
|
||||
get /login/logs (GetUserLoginLogsRequest) returns (GetUserLoginLogsResponse)
|
||||
}
|
||||
|
||||
|
||||
@ -32,6 +32,7 @@ func (l *GetUserListLogic) GetUserList(req *types.GetUserListRequest) (*types.Ge
|
||||
Search: req.Search,
|
||||
SubscribeId: req.SubscribeId,
|
||||
UserSubscribeId: req.UserSubscribeId,
|
||||
DeviceId: req.DeviceId,
|
||||
Order: "DESC",
|
||||
})
|
||||
if err != nil {
|
||||
|
||||
@ -3,6 +3,7 @@ package user
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/perfect-panel/server/internal/model/order"
|
||||
@ -60,6 +61,7 @@ type UserFilterParams struct {
|
||||
UserId *int64
|
||||
SubscribeId *int64
|
||||
UserSubscribeId *int64
|
||||
DeviceId string
|
||||
Order string // Order by id, e.g., "desc"
|
||||
}
|
||||
|
||||
@ -132,19 +134,27 @@ func (m *customUserModel) QueryPageList(ctx context.Context, page, size int, fil
|
||||
var list []*User
|
||||
var total int64
|
||||
err := m.QueryNoCacheCtx(ctx, &list, func(conn *gorm.DB, v interface{}) error {
|
||||
if filter != nil {
|
||||
if filter.UserId != nil {
|
||||
conn = conn.Where("user.id =?", *filter.UserId)
|
||||
if filter != nil {
|
||||
if filter.UserId != nil {
|
||||
conn = conn.Where("user.id =?", *filter.UserId)
|
||||
}
|
||||
if filter.Search != "" {
|
||||
conn = conn.Joins("LEFT JOIN user_auth_methods ON user.id = user_auth_methods.user_id").
|
||||
Where("user_auth_methods.auth_identifier LIKE ?", "%"+filter.Search+"%").Or("user.refer_code like ?", "%"+filter.Search+"%")
|
||||
}
|
||||
if filter.DeviceId != "" {
|
||||
conn = conn.Joins("LEFT JOIN user_device ON user.id = user_device.user_id")
|
||||
if id, err := strconv.ParseInt(filter.DeviceId, 10, 64); err == nil {
|
||||
conn = conn.Where("user_device.id = ? OR user_device.identifier = ?", id, filter.DeviceId)
|
||||
} else {
|
||||
conn = conn.Where("user_device.identifier = ?", filter.DeviceId)
|
||||
}
|
||||
if filter.Search != "" {
|
||||
conn = conn.Joins("LEFT JOIN user_auth_methods ON user.id = user_auth_methods.user_id").
|
||||
Where("user_auth_methods.auth_identifier LIKE ?", "%"+filter.Search+"%").Or("user.refer_code like ?", "%"+filter.Search+"%")
|
||||
}
|
||||
if filter.UserSubscribeId != nil {
|
||||
conn = conn.Joins("LEFT JOIN user_subscribe ON user.id = user_subscribe.user_id").
|
||||
Where("user_subscribe.id =? and `status` IN (0,1)", *filter.UserSubscribeId)
|
||||
}
|
||||
if filter.SubscribeId != nil {
|
||||
}
|
||||
if filter.UserSubscribeId != nil {
|
||||
conn = conn.Joins("LEFT JOIN user_subscribe ON user.id = user_subscribe.user_id").
|
||||
Where("user_subscribe.id =? and `status` IN (0,1)", *filter.UserSubscribeId)
|
||||
}
|
||||
if filter.SubscribeId != nil {
|
||||
conn = conn.Joins("LEFT JOIN user_subscribe ON user.id = user_subscribe.user_id").
|
||||
Where("user_subscribe.subscribe_id =? and `status` IN (0,1)", *filter.SubscribeId)
|
||||
}
|
||||
|
||||
@ -1064,6 +1064,7 @@ type GetUserListRequest struct {
|
||||
UserId *int64 `form:"user_id,omitempty"`
|
||||
SubscribeId *int64 `form:"subscribe_id,omitempty"`
|
||||
UserSubscribeId *int64 `form:"user_subscribe_id,omitempty"`
|
||||
DeviceId string `form:"device_id,omitempty"`
|
||||
}
|
||||
|
||||
type GetUserListResponse struct {
|
||||
@ -1236,77 +1237,77 @@ type MessageLog struct {
|
||||
}
|
||||
|
||||
type ReportLogMessageRequest struct {
|
||||
Platform string `json:"platform" validate:"required"`
|
||||
AppVersion string `json:"appVersion"`
|
||||
OsName string `json:"osName"`
|
||||
OsVersion string `json:"osVersion"`
|
||||
DeviceId string `json:"deviceId"`
|
||||
UserId int64 `json:"userId"`
|
||||
SessionId string `json:"sessionId"`
|
||||
Level uint8 `json:"level"`
|
||||
ErrorCode string `json:"errorCode"`
|
||||
Message string `json:"message" validate:"required"`
|
||||
Stack string `json:"stack"`
|
||||
Context map[string]interface{} `json:"context"`
|
||||
OccurredAt int64 `json:"occurredAt"`
|
||||
Platform string `json:"platform" validate:"required"`
|
||||
AppVersion string `json:"appVersion"`
|
||||
OsName string `json:"osName"`
|
||||
OsVersion string `json:"osVersion"`
|
||||
DeviceId string `json:"deviceId"`
|
||||
UserId int64 `json:"userId"`
|
||||
SessionId string `json:"sessionId"`
|
||||
Level uint8 `json:"level"`
|
||||
ErrorCode string `json:"errorCode"`
|
||||
Message string `json:"message" validate:"required"`
|
||||
Stack string `json:"stack"`
|
||||
Context map[string]interface{} `json:"context"`
|
||||
OccurredAt int64 `json:"occurredAt"`
|
||||
}
|
||||
|
||||
type ReportLogMessageResponse struct {
|
||||
Id int64 `json:"id"`
|
||||
Id int64 `json:"id"`
|
||||
}
|
||||
|
||||
type GetErrorLogMessageListRequest struct {
|
||||
Page int `form:"page"`
|
||||
Size int `form:"size"`
|
||||
Platform string `form:"platform"`
|
||||
Level uint8 `form:"level"`
|
||||
UserId int64 `form:"user_id"`
|
||||
DeviceId string `form:"device_id"`
|
||||
ErrorCode string `form:"error_code"`
|
||||
Keyword string `form:"keyword"`
|
||||
Start int64 `form:"start"`
|
||||
End int64 `form:"end"`
|
||||
Page int `form:"page"`
|
||||
Size int `form:"size"`
|
||||
Platform string `form:"platform"`
|
||||
Level uint8 `form:"level"`
|
||||
UserId int64 `form:"user_id"`
|
||||
DeviceId string `form:"device_id"`
|
||||
ErrorCode string `form:"error_code"`
|
||||
Keyword string `form:"keyword"`
|
||||
Start int64 `form:"start"`
|
||||
End int64 `form:"end"`
|
||||
}
|
||||
|
||||
type ErrorLogMessage struct {
|
||||
Id int64 `json:"id"`
|
||||
Platform string `json:"platform"`
|
||||
AppVersion string `json:"app_version"`
|
||||
OsName string `json:"os_name"`
|
||||
OsVersion string `json:"os_version"`
|
||||
DeviceId string `json:"device_id"`
|
||||
UserId int64 `json:"user_id"`
|
||||
SessionId string `json:"session_id"`
|
||||
Level uint8 `json:"level"`
|
||||
ErrorCode string `json:"error_code"`
|
||||
Message string `json:"message"`
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
Id int64 `json:"id"`
|
||||
Platform string `json:"platform"`
|
||||
AppVersion string `json:"app_version"`
|
||||
OsName string `json:"os_name"`
|
||||
OsVersion string `json:"os_version"`
|
||||
DeviceId string `json:"device_id"`
|
||||
UserId int64 `json:"user_id"`
|
||||
SessionId string `json:"session_id"`
|
||||
Level uint8 `json:"level"`
|
||||
ErrorCode string `json:"error_code"`
|
||||
Message string `json:"message"`
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
}
|
||||
|
||||
type GetErrorLogMessageListResponse struct {
|
||||
Total int64 `json:"total"`
|
||||
List []ErrorLogMessage `json:"list"`
|
||||
Total int64 `json:"total"`
|
||||
List []ErrorLogMessage `json:"list"`
|
||||
}
|
||||
|
||||
type GetErrorLogMessageDetailResponse struct {
|
||||
Id int64 `json:"id"`
|
||||
Platform string `json:"platform"`
|
||||
AppVersion string `json:"app_version"`
|
||||
OsName string `json:"os_name"`
|
||||
OsVersion string `json:"os_version"`
|
||||
DeviceId string `json:"device_id"`
|
||||
UserId int64 `json:"user_id"`
|
||||
SessionId string `json:"session_id"`
|
||||
Level uint8 `json:"level"`
|
||||
ErrorCode string `json:"error_code"`
|
||||
Message string `json:"message"`
|
||||
Stack string `json:"stack"`
|
||||
Context map[string]interface{} `json:"context"`
|
||||
ClientIP string `json:"client_ip"`
|
||||
UserAgent string `json:"user_agent"`
|
||||
Locale string `json:"locale"`
|
||||
OccurredAt int64 `json:"occurred_at"`
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
Id int64 `json:"id"`
|
||||
Platform string `json:"platform"`
|
||||
AppVersion string `json:"app_version"`
|
||||
OsName string `json:"os_name"`
|
||||
OsVersion string `json:"os_version"`
|
||||
DeviceId string `json:"device_id"`
|
||||
UserId int64 `json:"user_id"`
|
||||
SessionId string `json:"session_id"`
|
||||
Level uint8 `json:"level"`
|
||||
ErrorCode string `json:"error_code"`
|
||||
Message string `json:"message"`
|
||||
Stack string `json:"stack"`
|
||||
Context map[string]interface{} `json:"context"`
|
||||
ClientIP string `json:"client_ip"`
|
||||
UserAgent string `json:"user_agent"`
|
||||
Locale string `json:"locale"`
|
||||
OccurredAt int64 `json:"occurred_at"`
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
}
|
||||
|
||||
type MigrateServerNodeResponse struct {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user