57 lines
1.5 KiB
TypeScript
57 lines
1.5 KiB
TypeScript
|
|
import { get } from './client'
|
||
|
|
|
||
|
|
export interface CkbDevice {
|
||
|
|
id: number | string
|
||
|
|
memo: string
|
||
|
|
wechatId?: string
|
||
|
|
status?: 'online' | 'offline' | string
|
||
|
|
avatar?: string
|
||
|
|
nickname?: string
|
||
|
|
totalFriend?: number
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface CkbDevicesResponse {
|
||
|
|
success?: boolean
|
||
|
|
error?: string
|
||
|
|
devices?: CkbDevice[]
|
||
|
|
total?: number
|
||
|
|
}
|
||
|
|
|
||
|
|
// 管理端 - 存客宝设备列表(供链接人与事选择设备)
|
||
|
|
export function getCkbDevices(params?: { page?: number; limit?: number; keyword?: string }) {
|
||
|
|
const search = new URLSearchParams()
|
||
|
|
if (params?.page) search.set('page', String(params.page))
|
||
|
|
if (params?.limit) search.set('limit', String(params.limit))
|
||
|
|
if (params?.keyword?.trim()) search.set('keyword', params.keyword.trim())
|
||
|
|
const qs = search.toString()
|
||
|
|
const path = qs ? `/api/admin/ckb/devices?${qs}` : '/api/admin/ckb/devices'
|
||
|
|
return get<CkbDevicesResponse>(path)
|
||
|
|
}
|
||
|
|
|
||
|
|
// 管理端 - 人物详情(本地 + 存客宝缓存字段),用于编辑回显
|
||
|
|
export interface PersonDetailResponse {
|
||
|
|
success?: boolean
|
||
|
|
error?: string
|
||
|
|
person?: {
|
||
|
|
personId: string
|
||
|
|
token?: string
|
||
|
|
name: string
|
||
|
|
label?: string
|
||
|
|
ckbApiKey?: string
|
||
|
|
greeting?: string
|
||
|
|
tips?: string
|
||
|
|
remarkType?: string
|
||
|
|
remarkFormat?: string
|
||
|
|
addFriendInterval?: number
|
||
|
|
startTime?: string
|
||
|
|
endTime?: string
|
||
|
|
deviceGroups?: string
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
export function getPersonDetail(personId: string) {
|
||
|
|
return get<PersonDetailResponse>(`/api/db/person?personId=${encodeURIComponent(personId)}`)
|
||
|
|
}
|
||
|
|
|
||
|
|
|