初始化拉取,原文件名:admin-plus-webpack5
Some checks failed
Call HTTPS API / build (push) Has been cancelled

This commit is contained in:
2025-12-26 20:43:10 +08:00
parent 7c68ec3a42
commit 3e2da1115e
420 changed files with 75413 additions and 2 deletions

View File

@@ -0,0 +1,46 @@
const { Random } = require('mockjs')
module.exports = [
{
url: '/expireToken',
type: 'get',
response: (config) => {
const authorization =
config.headers.authorization || config.headers.Authorization
const arr = authorization.split('-')
const tokenTime = parseInt(arr[arr.length - 1])
if (Date.now() - tokenTime > 5000)
return {
code: 402,
msg: '令牌已过期',
}
else
return {
code: 200,
msg: '令牌未过期',
}
},
},
{
url: '/refreshToken',
type: 'get',
response: (config) => {
const authorization =
config.headers.authorization || config.headers.Authorization
let token = ''
if (authorization.includes('admin-token'))
token = `admin-token-${Random.guid()}-${Date.now()}`
if (authorization.includes('editor-token'))
token = `editor-token-${Random.guid()}-${Date.now()}`
if (authorization.includes('test-token'))
token = `test-token-${Random.guid()}-${Date.now()}`
return {
code: 200,
msg: '刷新Token成功',
data: { token },
}
},
},
]