ref: 重构定时任务的请求前缀

This commit is contained in:
lbw 2023-04-06 16:21:54 +08:00
parent 88cf044c4f
commit 812b56c62a
6 changed files with 19 additions and 20 deletions

View File

@ -2,7 +2,7 @@ import request from '/@/utils/request';
export function fetchList(query: any) { export function fetchList(query: any) {
return request({ return request({
url: '/daemon/sys-job-log/page', url: '/job/sys-job-log/page',
method: 'get', method: 'get',
params: query, params: query,
}); });
@ -10,7 +10,7 @@ export function fetchList(query: any) {
export function delObjs(ids: object) { export function delObjs(ids: object) {
return request({ return request({
url: '/daemon/sys-job-log', url: '/job/sys-job-log',
method: 'delete', method: 'delete',
data: ids, data: ids,
}); });

View File

@ -2,7 +2,7 @@ import request from '/@/utils/request';
export function fetchList(query?: Object) { export function fetchList(query?: Object) {
return request({ return request({
url: '/daemon/sys-job/page', url: '/job/sys-job/page',
method: 'get', method: 'get',
params: query, params: query,
}); });
@ -10,7 +10,7 @@ export function fetchList(query?: Object) {
export function addObj(obj?: Object) { export function addObj(obj?: Object) {
return request({ return request({
url: '/daemon/sys-job', url: '/job/sys-job',
method: 'post', method: 'post',
data: obj, data: obj,
}); });
@ -18,21 +18,21 @@ export function addObj(obj?: Object) {
export function getObj(id?: string) { export function getObj(id?: string) {
return request({ return request({
url: '/daemon/sys-job/' + id, url: '/job/sys-job/' + id,
method: 'get', method: 'get',
}); });
} }
export function delObj(id?: string) { export function delObj(id?: string) {
return request({ return request({
url: '/daemon/sys-job/' + id, url: '/job/sys-job/' + id,
method: 'delete', method: 'delete',
}); });
} }
export function putObj(obj?: Object) { export function putObj(obj?: Object) {
return request({ return request({
url: '/daemon/sys-job', url: '/job/sys-job',
method: 'put', method: 'put',
data: obj, data: obj,
}); });
@ -40,21 +40,21 @@ export function putObj(obj?: Object) {
export function startJobRa(jobId: string) { export function startJobRa(jobId: string) {
return request({ return request({
url: '/daemon/sys-job/start-job/' + jobId, url: '/job/sys-job/start-job/' + jobId,
method: 'post', method: 'post',
}); });
} }
export function runJobRa(jobId: string) { export function runJobRa(jobId: string) {
return request({ return request({
url: '/daemon/sys-job/run-job/' + jobId, url: '/job/sys-job/run-job/' + jobId,
method: 'post', method: 'post',
}); });
} }
export function shutDownJobRa(jobId: string) { export function shutDownJobRa(jobId: string) {
return request({ return request({
url: '/daemon/sys-job/shutdown-job/' + jobId, url: '/job/sys-job/shutdown-job/' + jobId,
method: 'post', method: 'post',
}); });
} }

View File

@ -464,7 +464,7 @@ const adaptationUrl = (originUrl?: string) => {
// 验证码服务 // 验证码服务
if (originUrl?.startsWith('/code/')) { if (originUrl?.startsWith('/code/')) {
return `/admin/${originUrl}`; return `/admin${originUrl}`;
} }
// 如果是代码生成服务,不做路径转换 // 如果是代码生成服务,不做路径转换

View File

@ -180,7 +180,7 @@ const handleSelectionChange = (rows) => {
/** 导出Excel */ /** 导出Excel */
const exportExcel = () => { const exportExcel = () => {
downBlobFile('/daemon/sys-job/export', state.queryForm, 'job.xlsx'); downBlobFile('/job/sys-job/export', state.queryForm, 'job.xlsx');
}; };
/** 查看作业日志 */ /** 查看作业日志 */

View File

@ -126,7 +126,7 @@ const resetQuery = () => {
// excel // excel
const exportExcel = () => { const exportExcel = () => {
downBlobFile('/daemon/schedule/export', state.queryForm, 'schedule.xlsx'); downBlobFile('/job/schedule/export', state.queryForm, 'schedule.xlsx');
}; };
// //

View File

@ -52,19 +52,18 @@ const viteConfig = defineConfig((mode: ConfigEnv) => {
open: env.VITE_OPEN === 'true', // 是否自动打开浏览器 open: env.VITE_OPEN === 'true', // 是否自动打开浏览器
hmr: true, // 启用热更新 hmr: true, // 启用热更新
proxy: { proxy: {
// 代理设置,用于解决跨域问题
'/api': {
target: env.VITE_ADMIN_PROXY_PATH, // 目标服务器地址
ws: true, // 是否启用 WebSocket
changeOrigin: true, // 是否修改请求头中的 Origin 字段
rewrite: (path) => path.replace(/^\/api/, ''),
},
'/api/gen': { '/api/gen': {
//单体架构下特殊处理代码生成模块代理 //单体架构下特殊处理代码生成模块代理
target: env.VITE_IS_MICRO === 'true' ? env.VITE_ADMIN_PROXY_PATH : env.VITE_GEN_PROXY_PATH, target: env.VITE_IS_MICRO === 'true' ? env.VITE_ADMIN_PROXY_PATH : env.VITE_GEN_PROXY_PATH,
changeOrigin: true, changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''), rewrite: (path) => path.replace(/^\/api/, ''),
}, },
'/api': {
target: env.VITE_ADMIN_PROXY_PATH, // 目标服务器地址
ws: true, // 是否启用 WebSocket
changeOrigin: true, // 是否修改请求头中的 Origin 字段
rewrite: (path) => path.replace(/^\/api/, ''),
},
}, },
}, },
build: { build: {