防重放攻击

This commit is contained in:
cwchen 2025-09-05 14:39:31 +08:00
parent 1ea005424a
commit 460f62dff2
22 changed files with 141 additions and 137 deletions

View File

@ -9,10 +9,11 @@ export function login(username, password, code, uuid) {
uuid
}
return request({
url: '/login',
url: '/smartArchives/login',
headers: {
isToken: false,
repeatSubmit: false
repeatSubmit: false,
skipReplayProtection: true
},
method: 'post',
data: data
@ -22,9 +23,10 @@ export function login(username, password, code, uuid) {
// 注册方法
export function register(data) {
return request({
url: '/register',
url: '/smartArchives/register',
headers: {
isToken: false
isToken: false,
skipReplayProtection: true
},
method: 'post',
data: data
@ -34,7 +36,10 @@ export function register(data) {
// 获取用户详细信息
export function getInfo() {
return request({
url: '/getInfo',
url: '/smartArchives/getInfo',
headers: {
skipReplayProtection: true
},
method: 'get'
})
}
@ -42,7 +47,10 @@ export function getInfo() {
// 退出方法
export function logout() {
return request({
url: '/logout',
url: '/smartArchives/logout',
headers: {
skipReplayProtection: true
},
method: 'post'
})
}
@ -50,9 +58,10 @@ export function logout() {
// 获取验证码
export function getCodeImg() {
return request({
url: '/captchaImage',
url: '/smartArchives/captchaImage',
headers: {
isToken: false
isToken: false,
skipReplayProtection: true
},
method: 'get',
timeout: 20000

View File

@ -3,7 +3,7 @@ import request from '@/utils/request'
// 获取路由
export const getRouters = () => {
return request({
url: '/getRouters',
url: '/smartArchives/getRouters',
method: 'get'
})
}

View File

@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询缓存详细
export function getCache() {
return request({
url: '/monitor/cache',
url: '/smartArchives/monitor/cache',
method: 'get'
})
}
@ -11,7 +11,7 @@ export function getCache() {
// 查询缓存名称列表
export function listCacheName() {
return request({
url: '/monitor/cache/getNames',
url: '/smartArchives/monitor/cache/getNames',
method: 'get'
})
}
@ -19,7 +19,7 @@ export function listCacheName() {
// 查询缓存键名列表
export function listCacheKey(cacheName) {
return request({
url: '/monitor/cache/getKeys/' + cacheName,
url: '/smartArchives/monitor/cache/getKeys/' + cacheName,
method: 'get'
})
}
@ -27,7 +27,7 @@ export function listCacheKey(cacheName) {
// 查询缓存内容
export function getCacheValue(cacheName, cacheKey) {
return request({
url: '/monitor/cache/getValue/' + cacheName + '/' + cacheKey,
url: '/smartArchives/monitor/cache/getValue/' + cacheName + '/' + cacheKey,
method: 'get'
})
}
@ -35,7 +35,7 @@ export function getCacheValue(cacheName, cacheKey) {
// 清理指定名称缓存
export function clearCacheName(cacheName) {
return request({
url: '/monitor/cache/clearCacheName/' + cacheName,
url: '/smartArchives/monitor/cache/clearCacheName/' + cacheName,
method: 'delete'
})
}
@ -43,7 +43,7 @@ export function clearCacheName(cacheName) {
// 清理指定键名缓存
export function clearCacheKey(cacheKey) {
return request({
url: '/monitor/cache/clearCacheKey/' + cacheKey,
url: '/smartArchives/monitor/cache/clearCacheKey/' + cacheKey,
method: 'delete'
})
}
@ -51,7 +51,7 @@ export function clearCacheKey(cacheKey) {
// 清理全部缓存
export function clearCacheAll() {
return request({
url: '/monitor/cache/clearCacheAll',
url: '/smartArchives/monitor/cache/clearCacheAll',
method: 'delete'
})
}

View File

@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询定时任务调度列表
export function listJob(query) {
return request({
url: '/monitor/job/list',
url: '/smartArchives/monitor/job/list',
method: 'get',
params: query
})
@ -12,7 +12,7 @@ export function listJob(query) {
// 查询定时任务调度详细
export function getJob(jobId) {
return request({
url: '/monitor/job/' + jobId,
url: '/smartArchives/monitor/job/' + jobId,
method: 'get'
})
}
@ -20,7 +20,7 @@ export function getJob(jobId) {
// 新增定时任务调度
export function addJob(data) {
return request({
url: '/monitor/job',
url: '/smartArchives/monitor/job',
method: 'post',
data: data
})
@ -29,7 +29,7 @@ export function addJob(data) {
// 修改定时任务调度
export function updateJob(data) {
return request({
url: '/monitor/job',
url: '/smartArchives/monitor/job',
method: 'put',
data: data
})
@ -38,7 +38,7 @@ export function updateJob(data) {
// 删除定时任务调度
export function delJob(jobId) {
return request({
url: '/monitor/job/' + jobId,
url: '/smartArchives/monitor/job/' + jobId,
method: 'delete'
})
}
@ -50,7 +50,7 @@ export function changeJobStatus(jobId, status) {
status
}
return request({
url: '/monitor/job/changeStatus',
url: '/smartArchives/monitor/job/changeStatus',
method: 'put',
data: data
})
@ -64,7 +64,7 @@ export function runJob(jobId, jobGroup) {
jobGroup
}
return request({
url: '/monitor/job/run',
url: '/smartArchives/monitor/job/run',
method: 'put',
data: data
})

View File

@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询调度日志列表
export function listJobLog(query) {
return request({
url: '/monitor/jobLog/list',
url: '/smartArchives/monitor/jobLog/list',
method: 'get',
params: query
})
@ -12,7 +12,7 @@ export function listJobLog(query) {
// 删除调度日志
export function delJobLog(jobLogId) {
return request({
url: '/monitor/jobLog/' + jobLogId,
url: '/smartArchives/monitor/jobLog/' + jobLogId,
method: 'delete'
})
}
@ -20,7 +20,7 @@ export function delJobLog(jobLogId) {
// 清空调度日志
export function cleanJobLog() {
return request({
url: '/monitor/jobLog/clean',
url: '/smartArchives/monitor/jobLog/clean',
method: 'delete'
})
}

View File

@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询登录日志列表
export function list(query) {
return request({
url: '/monitor/logininfor/list',
url: '/smartArchives/monitor/logininfor/list',
method: 'get',
params: query
})
@ -12,7 +12,7 @@ export function list(query) {
// 删除登录日志
export function delLogininfor(infoId) {
return request({
url: '/monitor/logininfor/' + infoId,
url: '/smartArchives/monitor/logininfor/' + infoId,
method: 'delete'
})
}
@ -20,7 +20,7 @@ export function delLogininfor(infoId) {
// 解锁用户登录状态
export function unlockLogininfor(userName) {
return request({
url: '/monitor/logininfor/unlock/' + userName,
url: '/smartArchives/monitor/logininfor/unlock/' + userName,
method: 'get'
})
}
@ -28,7 +28,7 @@ export function unlockLogininfor(userName) {
// 清空登录日志
export function cleanLogininfor() {
return request({
url: '/monitor/logininfor/clean',
url: '/smartArchives/monitor/logininfor/clean',
method: 'delete'
})
}

View File

@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询在线用户列表
export function list(query) {
return request({
url: '/monitor/online/list',
url: '/smartArchives/monitor/online/list',
method: 'get',
params: query
})
@ -12,7 +12,7 @@ export function list(query) {
// 强退用户
export function forceLogout(tokenId) {
return request({
url: '/monitor/online/' + tokenId,
url: '/smartArchives/monitor/online/' + tokenId,
method: 'delete'
})
}

View File

@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询操作日志列表
export function list(query) {
return request({
url: '/monitor/operlog/list',
url: '/smartArchives/monitor/operlog/list',
method: 'get',
params: query
})
@ -12,7 +12,7 @@ export function list(query) {
// 删除操作日志
export function delOperlog(operId) {
return request({
url: '/monitor/operlog/' + operId,
url: '/smartArchives/monitor/operlog/' + operId,
method: 'delete'
})
}
@ -20,7 +20,7 @@ export function delOperlog(operId) {
// 清空操作日志
export function cleanOperlog() {
return request({
url: '/monitor/operlog/clean',
url: '/smartArchives/monitor/operlog/clean',
method: 'delete'
})
}

View File

@ -3,7 +3,7 @@ import request from '@/utils/request'
// 获取服务信息
export function getServer() {
return request({
url: '/monitor/server',
url: '/smartArchives/monitor/server',
method: 'get'
})
}

View File

@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询参数列表
export function listConfig(query) {
return request({
url: '/system/config/list',
url: '/smartArchives/system/config/list',
method: 'get',
params: query
})
@ -12,7 +12,7 @@ export function listConfig(query) {
// 查询参数详细
export function getConfig(configId) {
return request({
url: '/system/config/' + configId,
url: '/smartArchives/system/config/' + configId,
method: 'get'
})
}
@ -20,7 +20,7 @@ export function getConfig(configId) {
// 根据参数键名查询参数值
export function getConfigKey(configKey) {
return request({
url: '/system/config/configKey/' + configKey,
url: '/smartArchives/system/config/configKey/' + configKey,
method: 'get'
})
}
@ -28,7 +28,7 @@ export function getConfigKey(configKey) {
// 新增参数配置
export function addConfig(data) {
return request({
url: '/system/config',
url: '/smartArchives/system/config',
method: 'post',
data: data
})
@ -37,7 +37,7 @@ export function addConfig(data) {
// 修改参数配置
export function updateConfig(data) {
return request({
url: '/system/config',
url: '/smartArchives/system/config',
method: 'put',
data: data
})
@ -46,7 +46,7 @@ export function updateConfig(data) {
// 删除参数配置
export function delConfig(configId) {
return request({
url: '/system/config/' + configId,
url: '/smartArchives/system/config/' + configId,
method: 'delete'
})
}
@ -54,7 +54,7 @@ export function delConfig(configId) {
// 刷新参数缓存
export function refreshCache() {
return request({
url: '/system/config/refreshCache',
url: '/smartArchives/system/config/refreshCache',
method: 'delete'
})
}

View File

@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询部门列表
export function listDept(query) {
return request({
url: '/system/dept/list',
url: '/smartArchives/system/dept/list',
method: 'get',
params: query
})
@ -12,7 +12,7 @@ export function listDept(query) {
// 查询部门列表(排除节点)
export function listDeptExcludeChild(deptId) {
return request({
url: '/system/dept/list/exclude/' + deptId,
url: '/smartArchives/system/dept/list/exclude/' + deptId,
method: 'get'
})
}
@ -20,7 +20,7 @@ export function listDeptExcludeChild(deptId) {
// 查询部门详细
export function getDept(deptId) {
return request({
url: '/system/dept/' + deptId,
url: '/smartArchives/system/dept/' + deptId,
method: 'get'
})
}
@ -28,7 +28,7 @@ export function getDept(deptId) {
// 新增部门
export function addDept(data) {
return request({
url: '/system/dept',
url: '/smartArchives/system/dept',
method: 'post',
data: data
})
@ -37,7 +37,7 @@ export function addDept(data) {
// 修改部门
export function updateDept(data) {
return request({
url: '/system/dept',
url: '/smartArchives/system/dept',
method: 'put',
data: data
})
@ -46,7 +46,7 @@ export function updateDept(data) {
// 删除部门
export function delDept(deptId) {
return request({
url: '/system/dept/' + deptId,
url: '/smartArchives/system/dept/' + deptId,
method: 'delete'
})
}

View File

@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询字典数据列表
export function listData(query) {
return request({
url: '/system/dict/data/list',
url: '/smartArchives/system/dict/data/list',
method: 'get',
params: query
})
@ -12,7 +12,7 @@ export function listData(query) {
// 查询字典数据详细
export function getData(dictCode) {
return request({
url: '/system/dict/data/' + dictCode,
url: '/smartArchives/system/dict/data/' + dictCode,
method: 'get'
})
}
@ -20,7 +20,7 @@ export function getData(dictCode) {
// 根据字典类型查询字典数据信息
export function getDicts(dictType) {
return request({
url: '/system/dict/data/type/' + dictType,
url: '/smartArchives/system/dict/data/type/' + dictType,
method: 'get'
})
}
@ -28,7 +28,7 @@ export function getDicts(dictType) {
// 新增字典数据
export function addData(data) {
return request({
url: '/system/dict/data',
url: '/smartArchives/system/dict/data',
method: 'post',
data: data
})
@ -37,7 +37,7 @@ export function addData(data) {
// 修改字典数据
export function updateData(data) {
return request({
url: '/system/dict/data',
url: '/smartArchives/system/dict/data',
method: 'put',
data: data
})
@ -46,7 +46,7 @@ export function updateData(data) {
// 删除字典数据
export function delData(dictCode) {
return request({
url: '/system/dict/data/' + dictCode,
url: '/smartArchives/system/dict/data/' + dictCode,
method: 'delete'
})
}

View File

@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询字典类型列表
export function listType(query) {
return request({
url: '/system/dict/type/list',
url: '/smartArchives/system/dict/type/list',
method: 'get',
params: query
})
@ -12,7 +12,7 @@ export function listType(query) {
// 查询字典类型详细
export function getType(dictId) {
return request({
url: '/system/dict/type/' + dictId,
url: '/smartArchives/system/dict/type/' + dictId,
method: 'get'
})
}
@ -20,7 +20,7 @@ export function getType(dictId) {
// 新增字典类型
export function addType(data) {
return request({
url: '/system/dict/type',
url: '/smartArchives/system/dict/type',
method: 'post',
data: data
})
@ -29,7 +29,7 @@ export function addType(data) {
// 修改字典类型
export function updateType(data) {
return request({
url: '/system/dict/type',
url: '/smartArchives/system/dict/type',
method: 'put',
data: data
})
@ -38,7 +38,7 @@ export function updateType(data) {
// 删除字典类型
export function delType(dictId) {
return request({
url: '/system/dict/type/' + dictId,
url: '/smartArchives/system/dict/type/' + dictId,
method: 'delete'
})
}
@ -46,7 +46,7 @@ export function delType(dictId) {
// 刷新字典缓存
export function refreshCache() {
return request({
url: '/system/dict/type/refreshCache',
url: '/smartArchives/system/dict/type/refreshCache',
method: 'delete'
})
}
@ -54,7 +54,7 @@ export function refreshCache() {
// 获取字典选择框列表
export function optionselect() {
return request({
url: '/system/dict/type/optionselect',
url: '/smartArchives/system/dict/type/optionselect',
method: 'get'
})
}

View File

@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询菜单列表
export function listMenu(query) {
return request({
url: '/system/menu/list',
url: '/smartArchives/system/menu/list',
method: 'get',
params: query
})
@ -12,7 +12,7 @@ export function listMenu(query) {
// 查询菜单详细
export function getMenu(menuId) {
return request({
url: '/system/menu/' + menuId,
url: '/smartArchives/system/menu/' + menuId,
method: 'get'
})
}
@ -20,7 +20,7 @@ export function getMenu(menuId) {
// 查询菜单下拉树结构
export function treeselect() {
return request({
url: '/system/menu/treeselect',
url: '/smartArchives/system/menu/treeselect',
method: 'get'
})
}
@ -28,7 +28,7 @@ export function treeselect() {
// 根据角色ID查询菜单下拉树结构
export function roleMenuTreeselect(roleId) {
return request({
url: '/system/menu/roleMenuTreeselect/' + roleId,
url: '/smartArchives/system/menu/roleMenuTreeselect/' + roleId,
method: 'get'
})
}
@ -36,7 +36,7 @@ export function roleMenuTreeselect(roleId) {
// 新增菜单
export function addMenu(data) {
return request({
url: '/system/menu',
url: '/smartArchives/system/menu',
method: 'post',
data: data
})
@ -45,7 +45,7 @@ export function addMenu(data) {
// 修改菜单
export function updateMenu(data) {
return request({
url: '/system/menu',
url: '/smartArchives/system/menu',
method: 'put',
data: data
})
@ -54,7 +54,7 @@ export function updateMenu(data) {
// 删除菜单
export function delMenu(menuId) {
return request({
url: '/system/menu/' + menuId,
url: '/smartArchives/system/menu/' + menuId,
method: 'delete'
})
}

View File

@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询公告列表
export function listNotice(query) {
return request({
url: '/system/notice/list',
url: '/smartArchives/system/notice/list',
method: 'get',
params: query
})
@ -12,7 +12,7 @@ export function listNotice(query) {
// 查询公告详细
export function getNotice(noticeId) {
return request({
url: '/system/notice/' + noticeId,
url: '/smartArchives/system/notice/' + noticeId,
method: 'get'
})
}
@ -20,7 +20,7 @@ export function getNotice(noticeId) {
// 新增公告
export function addNotice(data) {
return request({
url: '/system/notice',
url: '/smartArchives/system/notice',
method: 'post',
data: data
})
@ -29,7 +29,7 @@ export function addNotice(data) {
// 修改公告
export function updateNotice(data) {
return request({
url: '/system/notice',
url: '/smartArchives/system/notice',
method: 'put',
data: data
})
@ -38,7 +38,7 @@ export function updateNotice(data) {
// 删除公告
export function delNotice(noticeId) {
return request({
url: '/system/notice/' + noticeId,
url: '/smartArchives/system/notice/' + noticeId,
method: 'delete'
})
}

View File

@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询岗位列表
export function listPost(query) {
return request({
url: '/system/post/list',
url: '/smartArchives/system/post/list',
method: 'get',
params: query
})
@ -12,7 +12,7 @@ export function listPost(query) {
// 查询岗位详细
export function getPost(postId) {
return request({
url: '/system/post/' + postId,
url: '/smartArchives/system/post/' + postId,
method: 'get'
})
}
@ -20,7 +20,7 @@ export function getPost(postId) {
// 新增岗位
export function addPost(data) {
return request({
url: '/system/post',
url: '/smartArchives/system/post',
method: 'post',
data: data
})
@ -29,7 +29,7 @@ export function addPost(data) {
// 修改岗位
export function updatePost(data) {
return request({
url: '/system/post',
url: '/smartArchives/system/post',
method: 'put',
data: data
})
@ -38,7 +38,7 @@ export function updatePost(data) {
// 删除岗位
export function delPost(postId) {
return request({
url: '/system/post/' + postId,
url: '/smartArchives/system/post/' + postId,
method: 'delete'
})
}

View File

@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询角色列表
export function listRole(query) {
return request({
url: '/system/role/list',
url: '/smartArchives/system/role/list',
method: 'get',
params: query
})
@ -12,7 +12,7 @@ export function listRole(query) {
// 查询角色详细
export function getRole(roleId) {
return request({
url: '/system/role/' + roleId,
url: '/smartArchives/system/role/' + roleId,
method: 'get'
})
}
@ -20,7 +20,7 @@ export function getRole(roleId) {
// 新增角色
export function addRole(data) {
return request({
url: '/system/role',
url: '/smartArchives/system/role',
method: 'post',
data: data
})
@ -29,7 +29,7 @@ export function addRole(data) {
// 修改角色
export function updateRole(data) {
return request({
url: '/system/role',
url: '/smartArchives/system/role',
method: 'put',
data: data
})
@ -38,7 +38,7 @@ export function updateRole(data) {
// 角色数据权限
export function dataScope(data) {
return request({
url: '/system/role/dataScope',
url: '/smartArchives/system/role/dataScope',
method: 'put',
data: data
})
@ -51,7 +51,7 @@ export function changeRoleStatus(roleId, status) {
status
}
return request({
url: '/system/role/changeStatus',
url: '/smartArchives/system/role/changeStatus',
method: 'put',
data: data
})
@ -60,7 +60,7 @@ export function changeRoleStatus(roleId, status) {
// 删除角色
export function delRole(roleId) {
return request({
url: '/system/role/' + roleId,
url: '/smartArchives/system/role/' + roleId,
method: 'delete'
})
}
@ -68,7 +68,7 @@ export function delRole(roleId) {
// 查询角色已授权用户列表
export function allocatedUserList(query) {
return request({
url: '/system/role/authUser/allocatedList',
url: '/smartArchives/system/role/authUser/allocatedList',
method: 'get',
params: query
})
@ -77,7 +77,7 @@ export function allocatedUserList(query) {
// 查询角色未授权用户列表
export function unallocatedUserList(query) {
return request({
url: '/system/role/authUser/unallocatedList',
url: '/smartArchives/system/role/authUser/unallocatedList',
method: 'get',
params: query
})
@ -86,7 +86,7 @@ export function unallocatedUserList(query) {
// 取消用户授权角色
export function authUserCancel(data) {
return request({
url: '/system/role/authUser/cancel',
url: '/smartArchives/system/role/authUser/cancel',
method: 'put',
data: data
})
@ -95,7 +95,7 @@ export function authUserCancel(data) {
// 批量取消用户授权角色
export function authUserCancelAll(data) {
return request({
url: '/system/role/authUser/cancelAll',
url: '/smartArchives/system/role/authUser/cancelAll',
method: 'put',
params: data
})
@ -104,7 +104,7 @@ export function authUserCancelAll(data) {
// 授权用户选择
export function authUserSelectAll(data) {
return request({
url: '/system/role/authUser/selectAll',
url: '/smartArchives/system/role/authUser/selectAll',
method: 'put',
params: data
})
@ -113,7 +113,7 @@ export function authUserSelectAll(data) {
// 根据角色ID查询部门树结构
export function deptTreeSelect(roleId) {
return request({
url: '/system/role/deptTree/' + roleId,
url: '/smartArchives/system/role/deptTree/' + roleId,
method: 'get'
})
}

View File

@ -4,7 +4,7 @@ import { parseStrEmpty } from "@/utils/bonus";
// 查询用户列表
export function listUser(query) {
return request({
url: '/system/user/list',
url: '/smartArchives/system/user/list',
method: 'get',
params: query
})
@ -13,7 +13,7 @@ export function listUser(query) {
// 查询用户详细
export function getUser(userId) {
return request({
url: '/system/user/' + parseStrEmpty(userId),
url: '/smartArchives/system/user/' + parseStrEmpty(userId),
method: 'get'
})
}
@ -21,7 +21,7 @@ export function getUser(userId) {
// 新增用户
export function addUser(data) {
return request({
url: '/system/user',
url: '/smartArchives/system/user',
method: 'post',
data: data
})
@ -30,7 +30,7 @@ export function addUser(data) {
// 修改用户
export function updateUser(data) {
return request({
url: '/system/user',
url: '/smartArchives/system/user',
method: 'put',
data: data
})
@ -39,7 +39,7 @@ export function updateUser(data) {
// 删除用户
export function delUser(userId) {
return request({
url: '/system/user/' + userId,
url: '/smartArchives/system/user/' + userId,
method: 'delete'
})
}
@ -51,7 +51,7 @@ export function resetUserPwd(userId, password) {
password
}
return request({
url: '/system/user/resetPwd',
url: '/smartArchives/system/user/resetPwd',
method: 'put',
data: data
})
@ -64,7 +64,7 @@ export function changeUserStatus(userId, status) {
status
}
return request({
url: '/system/user/changeStatus',
url: '/smartArchives/system/user/changeStatus',
method: 'put',
data: data
})
@ -73,7 +73,7 @@ export function changeUserStatus(userId, status) {
// 查询用户个人信息
export function getUserProfile() {
return request({
url: '/system/user/profile',
url: '/smartArchives/system/user/profile',
method: 'get'
})
}
@ -81,7 +81,7 @@ export function getUserProfile() {
// 修改用户个人信息
export function updateUserProfile(data) {
return request({
url: '/system/user/profile',
url: '/smartArchives/system/user/profile',
method: 'put',
data: data
})
@ -94,7 +94,7 @@ export function updateUserPwd(oldPassword, newPassword) {
newPassword
}
return request({
url: '/system/user/profile/updatePwd',
url: '/smartArchives/system/user/profile/updatePwd',
method: 'put',
data: data
})
@ -103,7 +103,7 @@ export function updateUserPwd(oldPassword, newPassword) {
// 用户头像上传
export function uploadAvatar(data) {
return request({
url: '/system/user/profile/avatar',
url: '/smartArchives/system/user/profile/avatar',
method: 'post',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
data: data
@ -113,7 +113,7 @@ export function uploadAvatar(data) {
// 查询授权角色
export function getAuthRole(userId) {
return request({
url: '/system/user/authRole/' + userId,
url: '/smartArchives/system/user/authRole/' + userId,
method: 'get'
})
}
@ -121,7 +121,7 @@ export function getAuthRole(userId) {
// 保存授权角色
export function updateAuthRole(data) {
return request({
url: '/system/user/authRole',
url: '/smartArchives/system/user/authRole',
method: 'put',
params: data
})

View File

@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询生成表数据
export function listTable(query) {
return request({
url: '/tool/gen/list',
url: '/smartArchives/tool/gen/list',
method: 'get',
params: query
})
@ -11,7 +11,7 @@ export function listTable(query) {
// 查询db数据库列表
export function listDbTable(query) {
return request({
url: '/tool/gen/db/list',
url: '/smartArchives/tool/gen/db/list',
method: 'get',
params: query
})
@ -20,7 +20,7 @@ export function listDbTable(query) {
// 查询表详细信息
export function getGenTable(tableId) {
return request({
url: '/tool/gen/' + tableId,
url: '/smartArchives/tool/gen/' + tableId,
method: 'get'
})
}
@ -28,7 +28,7 @@ export function getGenTable(tableId) {
// 修改代码生成信息
export function updateGenTable(data) {
return request({
url: '/tool/gen',
url: '/smartArchives/tool/gen',
method: 'put',
data: data
})
@ -37,7 +37,7 @@ export function updateGenTable(data) {
// 导入表
export function importTable(data) {
return request({
url: '/tool/gen/importTable',
url: '/smartArchives/tool/gen/importTable',
method: 'post',
params: data
})
@ -46,7 +46,7 @@ export function importTable(data) {
// 创建表
export function createTable(data) {
return request({
url: '/tool/gen/createTable',
url: '/smartArchives/tool/gen/createTable',
method: 'post',
params: data
})
@ -55,7 +55,7 @@ export function createTable(data) {
// 预览生成代码
export function previewTable(tableId) {
return request({
url: '/tool/gen/preview/' + tableId,
url: '/smartArchives/tool/gen/preview/' + tableId,
method: 'get'
})
}
@ -63,7 +63,7 @@ export function previewTable(tableId) {
// 删除表数据
export function delTable(tableId) {
return request({
url: '/tool/gen/' + tableId,
url: '/smartArchives/tool/gen/' + tableId,
method: 'delete'
})
}
@ -71,7 +71,7 @@ export function delTable(tableId) {
// 生成代码(自定义路径)
export function genCode(tableName) {
return request({
url: '/tool/gen/genCode/' + tableName,
url: '/smartArchives/tool/gen/genCode/' + tableName,
method: 'get'
})
}
@ -79,7 +79,7 @@ export function genCode(tableName) {
// 同步数据库
export function synchDb(tableName) {
return request({
url: '/tool/gen/synchDb/' + tableName,
url: '/smartArchives/tool/gen/synchDb/' + tableName,
method: 'get'
})
}

View File

@ -50,7 +50,7 @@ const user = {
const uuid = userInfo.uuid
return new Promise((resolve, reject) => {
login(username, password, code, uuid).then(res => {
setToken(res.token)
setToken(encryptWithSM4(res.token))
commit('SET_TOKEN', res.token)
resolve()
}).catch(error => {

View File

@ -8,6 +8,5 @@ export function hmacSHA256(message, secret) {
// 生成请求签名
export function generateRequestSignature(userId, timestamp, method, url, secret) {
const signString = userId + timestamp + method.toUpperCase() + url
console.log(signString);
return hmacSHA256(signString, secret)
}

View File

@ -1,13 +1,13 @@
import axios from 'axios'
import { Notification, MessageBox, Message, Loading } from 'element-ui'
import store from '@/store'
import { getToken,getUserId,getSecretKey } from '@/utils/auth'
import { getToken, getUserId, getSecretKey } from '@/utils/auth'
import errorCode from '@/utils/errorCode'
import { tansParams, blobValidate } from '@/utils/bonus'
import cache from '@/plugins/cache'
import { saveAs } from 'file-saver'
import { decryptWithSM4, encryptWithSM4, hashWithSM3AndSalt } from '@/utils/sm'
import {generateRequestSignature } from '@/utils/crypto-js'
import { generateRequestSignature } from '@/utils/crypto-js'
const systemConfig = {
requestConfig: {
@ -46,7 +46,7 @@ service.interceptors.request.use(
config.headers['encryptResponse'] = systemConfig.requestConfig.encryptResponse && encryptResponse ? 'true' : 'false'
const isRepeatSubmit = repeatSubmit
// 处理 Token
if (getToken() && isToken) {
config.headers['Authorization'] = 'Bearer ' + getToken()
@ -59,18 +59,18 @@ service.interceptors.request.use(
const userSecret = getSecretKey()
const method = config.method.toUpperCase()
const timestamp = Date.now().toString()
let requestUrl = config.url
if (config.params && typeof config.params === 'object') {
// 使用URLSearchParams自动处理嵌套对象
const searchParams = new URLSearchParams()
Object.entries(config.params).forEach(([key, value]) => {
if (value === undefined || value === null || value === '' || value === 'undefined') {
return
}
if (typeof value === 'object' && value !== null) {
// 对于对象参数,后端期望的是 params[beginTime] 格式
Object.entries(value).forEach(([nestedKey, nestedValue]) => {
@ -82,18 +82,15 @@ service.interceptors.request.use(
searchParams.append(key, value.toString())
}
})
const paramsString = searchParams.toString()
if (paramsString) {
requestUrl += '?' + paramsString
}
}
const signature = generateRequestSignature(userId, timestamp, method, requestUrl, userSecret)
config.headers['timestamp'] = timestamp
config.headers['X-Signature'] = signature
} catch (error) {
console.warn('生成防重放签名失败:', error)
}
@ -105,28 +102,27 @@ service.interceptors.request.use(
if (systemConfig.requestConfig.encryptRequest && encryptRequest) {
// 将参数转换为查询字符串
let paramsString = tansParams(config.params)
console.error(paramsString);
// 移除末尾的 & 字符
if (paramsString.endsWith('&')) {
paramsString = paramsString.slice(0, -1)
}
if (paramsString) {
// 添加完整性校验哈希
const hash = hashWithSM3AndSalt(paramsString)
const encryptedParams = encryptWithSM4(paramsString + '|' + hash)
// 清空原始 params
config.params = {}
// 如果 URL 已经有查询参数,需要先清理
let baseUrl = config.url
const questionMarkIndex = baseUrl.indexOf('?')
if (questionMarkIndex !== -1) {
baseUrl = baseUrl.substring(0, questionMarkIndex)
}
// 设置加密后的查询参数
config.url = baseUrl + '?params=' + encodeURIComponent(encryptedParams)
}
@ -143,14 +139,14 @@ service.interceptors.request.use(
if (!isRepeatSubmit && (config.method === 'post' || config.method === 'put')) {
let data = typeof config.data === 'object' ? JSON.stringify(config.data) : config.data
let contentType = config.headers['Content-Type']
if (contentType && contentType.includes('application/json') && typeof data !== 'undefined') {
// 加密数据
if (systemConfig.requestConfig.encryptRequest && encryptRequest) {
config.data = encryptWithSM4(data + '|' + hashWithSM3AndSalt(data))
}
}
// 检查请求数据大小
const requestSize = JSON.stringify({
url: config.url,
@ -165,7 +161,7 @@ service.interceptors.request.use(
)
return config
}
// 防止重复提交
const sessionObj = cache.session.getJSON('sessionObj') || {}
const requestObj = { url: config.url, data: data, time: Date.now() }