2026-01-19 18:52:18 +08:00
|
|
|
import request from "./http";
|
|
|
|
|
|
|
|
|
|
const urlsConfig = {
|
|
|
|
|
corp: {
|
|
|
|
|
getCorpMemberHomepageInfo: 'getCorpMemberHomepageInfo',
|
|
|
|
|
getTeamBaseInfo: 'getTeamBaseInfo',
|
|
|
|
|
getTeamData: 'getTeamData',
|
|
|
|
|
queryWxJoinedTeams: 'queryWxJoinedTeams',
|
|
|
|
|
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',
|
|
|
|
|
bindMiniAppArchive: "bindMiniAppArchive",
|
|
|
|
|
getCustomerByCustomerId: 'getCustomerByCustomerId',
|
|
|
|
|
getMiniAppCustomers: 'getMiniAppCustomers',
|
|
|
|
|
getTeamCustomers: 'getTeamCustomers',
|
|
|
|
|
getUnbindMiniAppCustomers: 'getUnbindMiniAppCustomers',
|
|
|
|
|
unbindMiniAppArchive: 'unbindMiniAppArchive',
|
|
|
|
|
},
|
|
|
|
|
wecom: {
|
|
|
|
|
addContactWay: 'addContactWay'
|
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
|