|
@ -12,11 +12,11 @@ async function getAnxinyunToken(ctx) { |
|
|
if (!axyTokenCache.token || moment() > moment(axyTokenCache.expireTime)) { |
|
|
if (!axyTokenCache.token || moment() > moment(axyTokenCache.expireTime)) { |
|
|
if (ctx.app.fs.opts.axyProject.split('/').length === 3) { |
|
|
if (ctx.app.fs.opts.axyProject.split('/').length === 3) { |
|
|
const dataToAxy = { |
|
|
const dataToAxy = { |
|
|
p: ctx.app.fs.opts.axyProject.split('/')[0], |
|
|
domain: ctx.app.fs.opts.axyProject.split('/')[0], |
|
|
username: ctx.app.fs.opts.axyProject.split('/')[1], |
|
|
username: ctx.app.fs.opts.axyProject.split('/')[1], |
|
|
password: ctx.app.fs.opts.axyProject.split('/')[2], |
|
|
password: ctx.app.fs.opts.axyProject.split('/')[2], |
|
|
} |
|
|
} |
|
|
const axyResponse = await ctx.app.fs.anxinyun.post('project/login', { data: dataToAxy }) |
|
|
const axyResponse = await ctx.app.fs.anxinyun.post('login', { data: dataToAxy }) |
|
|
if (axyResponse.authorized) { |
|
|
if (axyResponse.authorized) { |
|
|
axyTokenCache.token = axyResponse.token //放进缓存
|
|
|
axyTokenCache.token = axyResponse.token //放进缓存
|
|
|
axyTokenCache.orgId = axyResponse.orgId //放进缓存
|
|
|
axyTokenCache.orgId = axyResponse.orgId //放进缓存
|
|
|