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",
"--wxAppId wxdd82ae635b22ccdb",
"--wxAppSecret 08e3d4ea9484cd7837d171e7af7c7db8",
"--apiAnxinyunUrl https://openapi.anxinyun.cn/api/v1",
"--axyProject 1a271f12-52f2-4d16-8dad-ec0c92d3e0cc/03bzzdh/123456",
"--apiAnxinyunUrl https://console.anxinyun.cn/_api",
"--axyProject anxinyun/liyus/123456a_",
"--iotaProxy https://iotaproxy.anxinyun.cn", //
"--apiCrawUrl http://218.3.126.49:30555/v1", //
//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 (ctx.app.fs.opts.axyProject.split('/').length === 3) {
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],
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) {
axyTokenCache.token = axyResponse.token //放进缓存
axyTokenCache.orgId = axyResponse.orgId //放进缓存

Loading…
Cancel
Save