新增访客黑名单:支持拉黑 IP/设备并管理列表
工作台可按 IP 或设备拉黑并填写释放时间与原因;侧栏黑名单页查看与解除;进线自动拦截。
This commit is contained in:
@@ -20,6 +20,8 @@ export interface Session {
|
||||
visitor_ip?: string
|
||||
visitor_region?: string
|
||||
user_agent?: string
|
||||
/** 访客设备指纹(用于设备拉黑) */
|
||||
device_key?: string
|
||||
landing_url?: string
|
||||
landing_title?: string
|
||||
referrer?: string
|
||||
@@ -349,6 +351,41 @@ export const createCustomer = (data: Partial<Customer>) => post<Customer>('/cust
|
||||
export const updateCustomer = (id: number, data: Partial<Customer>) => put<Customer>(`/customers/${id}`, data)
|
||||
export const deleteCustomer = (id: number) => del(`/customers/${id}`)
|
||||
|
||||
// 黑名单
|
||||
export interface BlacklistEntry {
|
||||
id: number
|
||||
tenant_id: number
|
||||
kind: 'ip' | 'device' | string
|
||||
value: string
|
||||
reason: string
|
||||
expires_at?: string | null
|
||||
operator_id?: number
|
||||
session_id?: number | null
|
||||
customer_id?: number | null
|
||||
created_at?: string
|
||||
}
|
||||
|
||||
export type BlacklistDuration = '1h' | '6h' | '1d' | '7d' | '30d' | 'permanent'
|
||||
|
||||
export const createBlacklist = (data: {
|
||||
session_id?: number
|
||||
kind: 'ip' | 'device'
|
||||
value?: string
|
||||
duration: BlacklistDuration | string
|
||||
reason: string
|
||||
end_session?: boolean
|
||||
}) => post<BlacklistEntry>('/blacklist', data)
|
||||
|
||||
export const getBlacklist = (params?: { kind?: string; active?: boolean }) => {
|
||||
const search = new URLSearchParams()
|
||||
if (params?.kind) search.set('kind', params.kind)
|
||||
if (params?.active === false) search.set('active', '0')
|
||||
const qs = search.toString()
|
||||
return get<BlacklistEntry[]>(`/blacklist${qs ? `?${qs}` : ''}`)
|
||||
}
|
||||
|
||||
export const releaseBlacklist = (id: number) => del(`/blacklist/${id}`)
|
||||
|
||||
// 客户标签库(管理员维护,全员可选)
|
||||
export interface CustomerTag {
|
||||
id: number
|
||||
|
||||
Reference in New Issue
Block a user