perf
This commit is contained in:
parent
e5111227fd
commit
8619bf4139
@ -52,9 +52,11 @@ app
|
|||||||
ctx.throw(400, 'Invalid state');
|
ctx.throw(400, 'Invalid state');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ctx.body = {
|
try {
|
||||||
token,
|
ctx.body = JSON.parse(token);
|
||||||
};
|
} catch (error) {
|
||||||
|
ctx.throw(500, 'Invalid token get');
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.addTo(app);
|
.addTo(app);
|
||||||
|
|
||||||
@ -70,7 +72,7 @@ app
|
|||||||
const wx = new WxServices();
|
const wx = new WxServices();
|
||||||
const token = await wx.login(code, 'mp');
|
const token = await wx.login(code, 'mp');
|
||||||
const redis = useContextKey('redis');
|
const redis = useContextKey('redis');
|
||||||
await redis.set(`wx:mp:login:${state}`, token, 'EX', 10000); // 30秒过期
|
await redis.set(`wx:mp:login:${state}`, JSON.stringify(token), 'EX', 10000); // 30秒过期
|
||||||
ctx.body = {
|
ctx.body = {
|
||||||
token,
|
token,
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user