2026-01-19 18:52:18 +08:00
|
|
|
|
import request from "./http";
|
|
|
|
|
|
|
|
|
|
|
|
const urlsConfig = {
|
|
|
|
|
|
corp: {
|
|
|
|
|
|
getCorpMemberHomepageInfo: 'getCorpMemberHomepageInfo',
|
|
|
|
|
|
getTeamBaseInfo: 'getTeamBaseInfo',
|
|
|
|
|
|
getTeamData: 'getTeamData',
|
2026-01-23 17:10:23 +08:00
|
|
|
|
getTeamBymember: 'getTeamBymember',
|
|
|
|
|
|
getCurrentTemplate: 'getCurrentTemplate',
|
2026-01-19 18:52:18 +08:00
|
|
|
|
wxAppLogin: 'wxAppLogin',
|
2026-01-21 13:37:54 +08:00
|
|
|
|
getDeptList: 'getRealDeptList',
|
|
|
|
|
|
getHospitalList: 'getRealHospital',
|
|
|
|
|
|
addCorpMember: 'addCorpMember',
|
2026-01-21 15:27:18 +08:00
|
|
|
|
getCorpMemberData: 'getCorpMemberData',
|
|
|
|
|
|
updateCorpMember: 'updateCorpMember'
|
2026-01-19 18:52:18 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
knowledgeBase: {
|
|
|
|
|
|
getArticleByIds: 'getArticleByIds'
|
|
|
|
|
|
},
|
|
|
|
|
|
member: {
|
|
|
|
|
|
addCustomer: 'add',
|
2026-01-23 17:10:23 +08:00
|
|
|
|
updateCustomer: 'update',
|
2026-01-23 17:59:24 +08:00
|
|
|
|
transferCustomers: 'transferCustomers',
|
|
|
|
|
|
getGroups: 'getGroups',
|
|
|
|
|
|
createGroup: 'createGroup',
|
|
|
|
|
|
updateGroup: 'updateGroup',
|
|
|
|
|
|
removeGroup: 'removeGroup',
|
|
|
|
|
|
sortGroups: 'sortGroups',
|
|
|
|
|
|
addGroupIdForMember: 'addGroupIdForMember',
|
2026-01-19 18:52:18 +08:00
|
|
|
|
bindMiniAppArchive: "bindMiniAppArchive",
|
|
|
|
|
|
getCustomerByCustomerId: 'getCustomerByCustomerId',
|
|
|
|
|
|
getMiniAppCustomers: 'getMiniAppCustomers',
|
|
|
|
|
|
getTeamCustomers: 'getTeamCustomers',
|
|
|
|
|
|
getUnbindMiniAppCustomers: 'getUnbindMiniAppCustomers',
|
2026-01-23 17:10:23 +08:00
|
|
|
|
searchCorpCustomer: 'searchCorpCustomer',
|
|
|
|
|
|
searchCorpCustomerWithFollowTime: 'searchCorpCustomerWithFollowTime',
|
2026-01-19 18:52:18 +08:00
|
|
|
|
unbindMiniAppArchive: 'unbindMiniAppArchive',
|
|
|
|
|
|
},
|
|
|
|
|
|
wecom: {
|
|
|
|
|
|
addContactWay: 'addContactWay'
|
2026-01-22 15:13:26 +08:00
|
|
|
|
},
|
|
|
|
|
|
im: {
|
|
|
|
|
|
getUserSig: 'getUserSig',
|
|
|
|
|
|
sendSystemMessage: "sendSystemMessage",
|
|
|
|
|
|
getChatRecordsByGroupId: "getChatRecordsByGroupId"
|
2026-01-26 15:39:14 +08:00
|
|
|
|
},
|
|
|
|
|
|
todo: {
|
|
|
|
|
|
getCustomerTodos: 'getCustomerTodos',
|
|
|
|
|
|
getTodoById: 'getTodoById',
|
|
|
|
|
|
setTodoStatus: 'setTodoStatus',
|
|
|
|
|
|
updateTaskTodoResult: 'updateTaskTodoResult',
|
|
|
|
|
|
updateEvent: 'updateEvent',
|
|
|
|
|
|
removeTodo: 'removeTodo',
|
|
|
|
|
|
createEvents: 'createEvents',
|
|
|
|
|
|
executeManagementPlanTodo: 'executeManagementPlanTodo',
|
|
|
|
|
|
getManagementPlan: 'getManagementPlan',
|
|
|
|
|
|
getManagementPlanById: 'getManagementPlanById',
|
|
|
|
|
|
getNextFollowUpTime: 'getNextFollowUpTime',
|
2026-01-26 16:47:35 +08:00
|
|
|
|
// 服务记录(对齐 ykt-management-mobile/src/api/todo.js)
|
|
|
|
|
|
getServiceRecord: 'getServiceRecord',
|
|
|
|
|
|
addServiceRecord: 'addServiceRecord',
|
|
|
|
|
|
updateServiceRecord: 'updateServiceRecord',
|
|
|
|
|
|
removeServiceRecord: 'removeServiceRecord',
|
2026-01-19 18:52:18 +08:00
|
|
|
|
}
|
2026-01-21 13:37:54 +08:00
|
|
|
|
|
2026-01-19 18:52:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
const urls = Object.keys(urlsConfig).reduce((acc, path) => {
|
|
|
|
|
|
const config = urlsConfig[path] || {};
|
|
|
|
|
|
const keys = Object.keys(config);
|
|
|
|
|
|
keys.forEach((key) => {
|
|
|
|
|
|
const data = acc[key];
|
|
|
|
|
|
if (data) {
|
|
|
|
|
|
throw new Error(`${data[0]}.${data[1]}和${path}.${url}重复了`)
|
|
|
|
|
|
}
|
|
|
|
|
|
acc[key] = [path, config[key]]
|
|
|
|
|
|
return acc
|
|
|
|
|
|
})
|
|
|
|
|
|
return acc
|
|
|
|
|
|
}, {})
|
|
|
|
|
|
console.log('urls: ', urls)
|
|
|
|
|
|
|
|
|
|
|
|
export default async function api(urlId, data) {
|
|
|
|
|
|
const config = urls[urlId];
|
|
|
|
|
|
if (!config) {
|
|
|
|
|
|
throw new Error(`Unknown URL ID: ${urlId}`);
|
|
|
|
|
|
}
|
|
|
|
|
|
const [path, type] = config;
|
|
|
|
|
|
return request({
|
|
|
|
|
|
url: `/getYoucanData/${path}`,
|
|
|
|
|
|
data: {
|
|
|
|
|
|
...data,
|
|
|
|
|
|
type,
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2026-01-21 13:37:54 +08:00
|
|
|
|
}
|