liveCode.ts
2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/**
* 一客一码 / 一客一群 —— 源 src/api/usedCarManagement.js 的同名接口,路径 / method 逐字保留。
*
* 请求统一经 ../core/client 的 @uj/api-core 装配后由主壳 props.request 代发;
* 源系统没有 DTO 定义,这里不臆造结构:参数是一层平铺对象,返回类型由调用方泛型指定。
*/
import { usedcarClient } from '../core/client';
import type { UsedcarParams } from '../core/types';
/**
* 一客一码分页列表
*/
export function getLiveCodePage<T = unknown>(data: UsedcarParams = {}) {
return usedcarClient.post<T>('/liveCode/page', data);
}
/**
* 一客一群 - 获取企微群列表
*/
export function getGroupChatList<T = unknown>(data: UsedcarParams = {}) {
return usedcarClient.post<T>('/liveCode/group/list', data);
}
/**
* 一客一群 - 获取开通二手车场景的4S店列表
*/
export function getCarDealerList<T = unknown>(data: UsedcarParams = {}) {
return usedcarClient.post<T>('/merchant/carDealer/list', data);
}
/**
* 一客一群 - 活码配置新增
*/
export function addLiveCode<T = unknown>(data: UsedcarParams = {}) {
return usedcarClient.post<T>('/liveCode/add', data, { returnAll: true });
}
/**
* 一客一群 - 活码配置编辑
*/
export function updateLiveCode<T = unknown>(data: UsedcarParams = {}) {
return usedcarClient.post<T>('/liveCode/update', data, { returnAll: true });
}
/**
* 一客一群 - 活码配置删除
*/
export function deleteLiveCode<T = unknown>(data: UsedcarParams = {}) {
return usedcarClient.post<T>('/liveCode/delete', data, { returnAll: true });
}
/**
* 一客一群 - 活码配置详情
*/
export const getLiveCodeDetail = Object.assign(
<T = unknown>(data: UsedcarParams = {}) => usedcarClient.post<T>('/liveCode/details', data),
{
// 编辑群池时需读取最新详情,不使用子应用默认的30秒查询缓存。
queryOptions: { staleTime: 0, refetchOnMount: 'always' as const },
},
);
/** 模块单例出口,与 dashboardApi 同一调用面;实现与上方具名函数完全同源。 */
export const liveCodeApi = {
getLiveCodePage,
getGroupChatList,
getCarDealerList,
addLiveCode,
updateLiveCode,
deleteLiveCode,
getLiveCodeDetail,
};