fix(admin): getVisitors 参数类型收紧(哨兵字符串防假筛选)
online/is_new/show_bot 后端按字符串哨兵 =="1" 解析(visitors.py _page_visitors), boolean true 会被 axios 序列化成 "true" 而被静默忽略——看起来生效实则未生效。 新增 VisitorListParams 接口把三个开关锁死为字面量 "1",其余筛选字段一并收型。 Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -90,8 +90,31 @@ export interface VisitorListResp {
|
|||||||
page: number
|
page: number
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 访客列表(筛选参数:search/country/device_type/online/is_new/show_bot/date_from/date_to/page) */
|
/**
|
||||||
export const getVisitors = (params: Record<string, unknown>) =>
|
* 访客列表筛选参数。
|
||||||
|
* online/is_new/show_bot 是后端字符串哨兵(仅 "1" 生效,见 visitors.py `_page_visitors`)——
|
||||||
|
* 传 boolean true 会被序列化成 "true" 而被静默忽略(假筛选),类型层面直接锁死。
|
||||||
|
*/
|
||||||
|
export interface VisitorListParams {
|
||||||
|
page?: number
|
||||||
|
country?: string
|
||||||
|
device_type?: string
|
||||||
|
/** 仅 "1" 生效:5 分钟内有行为的在线访客 */
|
||||||
|
online?: '1'
|
||||||
|
/** 仅 "1" 生效:今天首次到访的新访客 */
|
||||||
|
is_new?: '1'
|
||||||
|
/** 仅 "1" 生效:包含爬虫(默认排除) */
|
||||||
|
show_bot?: '1'
|
||||||
|
/** visitor_id / last_ip 前缀模糊匹配 */
|
||||||
|
search?: string
|
||||||
|
/** YYYY-MM-DD(非法值后端宽松忽略) */
|
||||||
|
date_from?: string
|
||||||
|
/** YYYY-MM-DD */
|
||||||
|
date_to?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 访客列表(筛选参数见 VisitorListParams) */
|
||||||
|
export const getVisitors = (params: VisitorListParams) =>
|
||||||
request.get<VisitorListResp>({ url: '/admin/visitors', params })
|
request.get<VisitorListResp>({ url: '/admin/visitors', params })
|
||||||
|
|
||||||
/** 访客详情(404 时后端返回 visitor_not_found) */
|
/** 访客详情(404 时后端返回 visitor_not_found) */
|
||||||
|
|||||||
Reference in New Issue
Block a user