Browse Source

feat:修改安心云鉴权方法

master
zhaobing’ 11 months ago
parent
commit
47a2465911
  1. 4
      api/.vscode/launch.json
  2. 4
      api/app/lib/controllers/projectBind/projectBind.js

4
api/.vscode/launch.json

@ -33,8 +33,8 @@
"--wxDomain https://api.weixin.qq.com", "--wxDomain https://api.weixin.qq.com",
"--wxAppId wxdd82ae635b22ccdb", "--wxAppId wxdd82ae635b22ccdb",
"--wxAppSecret 08e3d4ea9484cd7837d171e7af7c7db8", "--wxAppSecret 08e3d4ea9484cd7837d171e7af7c7db8",
"--apiAnxinyunUrl https://openapi.anxinyun.cn/api/v1", "--apiAnxinyunUrl https://console.anxinyun.cn/_api",
"--axyProject 1a271f12-52f2-4d16-8dad-ec0c92d3e0cc/03bzzdh/123456", "--axyProject anxinyun/liyus/123456a_",
"--iotaProxy https://iotaproxy.anxinyun.cn", // "--iotaProxy https://iotaproxy.anxinyun.cn", //
"--apiCrawUrl http://218.3.126.49:30555/v1", // "--apiCrawUrl http://218.3.126.49:30555/v1", //
//clickHouse //clickHouse

4
api/app/lib/controllers/projectBind/projectBind.js

@ -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 //放进缓存

Loading…
Cancel
Save