perf
This commit is contained in:
parent
e5111227fd
commit
8619bf4139
@ -52,9 +52,11 @@ app
|
||||
ctx.throw(400, 'Invalid state');
|
||||
return;
|
||||
}
|
||||
ctx.body = {
|
||||
token,
|
||||
};
|
||||
try {
|
||||
ctx.body = JSON.parse(token);
|
||||
} catch (error) {
|
||||
ctx.throw(500, 'Invalid token get');
|
||||
}
|
||||
})
|
||||
.addTo(app);
|
||||
|
||||
@ -70,7 +72,7 @@ app
|
||||
const wx = new WxServices();
|
||||
const token = await wx.login(code, 'mp');
|
||||
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 = {
|
||||
token,
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user