- 新增 GET /api/admin/ckb/plans 获取存客宝获客计划列表 - 新增 GET /api/admin/ckb/plan-detail 获取计划详情 - PersonAddEditModal: 密钥字段改为可搜索的计划选择器 选择计划后自动覆盖 greeting/tips/设备/时间等参数 - 删除"修复 CKB 密钥"按钮 Made-with: Cursor
88 lines
2.4 KiB
TypeScript
88 lines
2.4 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)}`)
|
|
}
|
|
|
|
export interface CkbPlan {
|
|
id: number | string
|
|
name: string
|
|
apiKey?: string
|
|
sceneId?: number
|
|
scenario?: number
|
|
enabled?: boolean
|
|
greeting?: string
|
|
tips?: string
|
|
remarkType?: string
|
|
remarkFormat?: string
|
|
addInterval?: number
|
|
startTime?: string
|
|
endTime?: string
|
|
deviceGroups?: (number | string)[]
|
|
}
|
|
|
|
export interface CkbPlansResponse {
|
|
success?: boolean
|
|
error?: string
|
|
plans?: CkbPlan[]
|
|
total?: number
|
|
}
|
|
|
|
export function getCkbPlans(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()
|
|
return get<CkbPlansResponse>(qs ? `/api/admin/ckb/plans?${qs}` : '/api/admin/ckb/plans')
|
|
}
|