This commit is contained in:
yuhawu 2025-08-07 14:14:16 +08:00
parent d10532006d
commit ed742ddd4a
4 changed files with 822 additions and 662 deletions

View File

@ -21,7 +21,14 @@ export function setupResponseInterceptors(instance) {
instance.interceptors.response.use(
response => {
const { data } = response;
const { data, config } = response;
// 如果是文件下载请求responseType为blob直接返回response
if (config.responseType === 'blob') {
return response;
}
// 对于普通的JSON响应进行业务逻辑检查
if (data.code != 200) {
const error = new Error(data.message || '业务逻辑错误');
error.name = 'BusinessError';

View File

@ -45,7 +45,10 @@ export const deleteShop = (id) => {
export const batchDeleteShop = (ids) => {
return instance.delete(`/shop/batch/${ids}`);
};
// 获取店铺数据
export const getListShop = () => {
return instance.get(`/shop/getList`);
};
// 更新同步订单状态
export const updateSyncOrderStatus = (id, isSynOrder) => {
return instance.put('/shop/syncOrder', {
@ -57,6 +60,7 @@ export const updateSyncOrderStatus = (id, isSynOrder) => {
// 为了向后兼容,也导出整个对象
export const shopApi = {
getShopList,
getListShop,
getShopDetail,
addShop,
updateShop,

View File

@ -2,25 +2,98 @@ import instance from '../../utils/axios.js'
// 任务相关API
const taskApi = {
// 获取运行中的任务列表
getRunningTasks: (pageSize = 0, pageNum = 10) =>
instance.get(`/task/getRunningTasks?pageSize=${pageSize}&pageNum=${pageNum}`),
// 停止指定任务
stopTask: (taskId) => instance.get(`/task/stopTask?taskId=${taskId}`),
// 获取任务列表
getTaskList: (params) => instance.get('/task/list', { params }),
// 获取任务日志列表
getLogsList: (id) => instance.get(`/task/logsList?id=${id}`),
logsTask: (id) => instance.get(`/task/logsList?id=${id}`),
// 获取任务日志消息
getLogsMsg: (id) => instance.get(`/task/logsMsg?id=${id}`),
logsMsg: (id) => instance.get(`/task/logsMsg?id=${id}`),
// 获取任务详细日志列表
getLogsDetailList: (taskId, shopId) => instance.get(`/task/logsDetailList/${taskId}/${shopId}`),
logsDetailTask: (taskId, shopId) => instance.get(`/task/logsDetailList/${taskId}/${shopId}`),
// 下载日志文件
downloadLogs: (fileName) => instance.get(`/task/downloadLogs/${fileName}`, { responseType: 'blob' }),
};
downloadLog: (fileName) => instance.get(`/task/downloadLogs/${fileName}`, { responseType: 'blob' }),
// 校验文件是否上传
checkFile: () => instance.get('/task/checkFile'),
// 删除缓存文件
delFile: () => instance.get('/task/delFile'),
// 暂停/恢复/中止接口
editRunningTaskStatus: (taskId, status) => instance.post('/task/editRunningTask', `taskId=${taskId}&status=${status}`, {
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}),
// 暂停线程
pauseThread: (threadId, taskId) => instance.get(`/task/pauseThread/${threadId}/${taskId}`),
// 恢复线程
continueThread: (threadId, taskId) => instance.get(`/task/continueThread/${threadId}/${taskId}`),
// 获取任务详细信息
getTask: (id) => instance.get(`/task/${id}`),
// 新增任务
addTask: (data) => instance.post('/task', data),
// 同步到仓库
tbStock: (data) => instance.post('/task/tbStock', data),
// 修改任务
updateTask: (data) => instance.put('/task', data),
// 删除任务
delTask: (ids) => instance.delete(`/task/${ids}`),
// 停止任务
stopTask: (taskId) => instance.post('/task/stopTask', `taskId=${taskId}`, {
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}),
// 查询任务列表详细
getShopGoodsTask: (shopId) => instance.get(`/task/selectShopTaskByGetShopGoods?shopId=${shopId}`),
// 导出任务列表
exportTasks: (data) => instance.post('/task/export', data, { responseType: 'blob' }),
// 上传文件
uploadFile: (file) => {
const formData = new FormData()
formData.append('file', file)
return instance.post('/task/upload', formData, {
headers: { 'Content-Type': 'multipart/form-data' }
})
},
// 获取导入模板
getImportTemplate: () => instance.get('/task/importTemplate', { responseType: 'blob' }),
// 完成任务
finishTask: (taskId) => instance.get(`/task/finishTash/${taskId}`),
// 获取运行中的任务列表
getRunningTasks: (pageSize = 0, pageNum = 10) =>
instance.get(`/task/getRunningTask?pageSize=${pageSize}&pageNum=${pageNum}`),
// 任务运行文件操作
taskRunningFile: (data) => instance.post('/task/taskRunningFile', data),
// 中心图书接口
centerBooks: (jsonStr) => instance.post('/task/centerBooks', `jsonStr=${jsonStr}`, {
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
})
};
// 导出模块
export { taskApi };

File diff suppressed because it is too large Load Diff