实名姓名与收款账户不一致会导致收款码登记失败,新增后台撤销实名能力: - 新增 user:revoke_realname 权限,授予超级管理员与运营角色 - 撤销时重置用户实名状态为未认证并删除实名记录,使其可重新认证,写入审计日志 - 用户管理页新增实名状态列与"撤销实名"操作(含原因弹窗) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
70 lines
2.0 KiB
TypeScript
70 lines
2.0 KiB
TypeScript
import { apiClient } from '@/shared/api/client'
|
|
|
|
import type { ApiResponse, PaginatedResult } from '@/shared/types/types'
|
|
import type { RealnameStatusValue, RiskStatus, UserStatus } from '@/shared/types/status'
|
|
|
|
export interface AdminUserItem {
|
|
id: number
|
|
phone: string
|
|
nickname: string
|
|
realname_status: RealnameStatusValue
|
|
risk_status: RiskStatus
|
|
credit_score: number
|
|
deposit_free_quota_cent: number
|
|
deposit_free_used_cent: number
|
|
deposit_free_remaining_cent: number
|
|
status: UserStatus
|
|
order_count: number
|
|
listing_count: number
|
|
dispute_count: number
|
|
last_login_at?: string
|
|
created_at: string
|
|
updated_at: string
|
|
}
|
|
|
|
export interface AdminUserQuery {
|
|
keyword?: string
|
|
status?: '' | UserStatus
|
|
}
|
|
|
|
export async function fetchAdminUsers(page = 1, pageSize = 20, query: AdminUserQuery = {}) {
|
|
const params: Record<string, unknown> = { page, page_size: pageSize }
|
|
if (query.keyword) params.keyword = query.keyword
|
|
if (query.status) params.status = query.status
|
|
const { data } = await apiClient.get<ApiResponse<PaginatedResult<AdminUserItem>>>(
|
|
'/admin/users',
|
|
{
|
|
params,
|
|
}
|
|
)
|
|
return data.data
|
|
}
|
|
|
|
export async function freezeAdminUser(id: number, reason: string) {
|
|
const { data } = await apiClient.post<ApiResponse<AdminUserItem>>(`/admin/users/${id}/freeze`, {
|
|
reason,
|
|
})
|
|
return data.data
|
|
}
|
|
|
|
export async function unfreezeAdminUser(id: number) {
|
|
const { data } = await apiClient.post<ApiResponse<AdminUserItem>>(`/admin/users/${id}/unfreeze`)
|
|
return data.data
|
|
}
|
|
|
|
export async function setAdminUserDepositFreeQuota(id: number, amountCent: number) {
|
|
const { data } = await apiClient.post<ApiResponse<AdminUserItem>>(
|
|
`/admin/users/${id}/deposit-free-quota`,
|
|
{ amount_cent: amountCent }
|
|
)
|
|
return data.data
|
|
}
|
|
|
|
export async function revokeAdminUserRealname(id: number, reason: string) {
|
|
const { data } = await apiClient.post<ApiResponse<AdminUserItem>>(
|
|
`/admin/users/${id}/revoke-realname`,
|
|
{ reason }
|
|
)
|
|
return data.data
|
|
}
|