ai review
This commit is contained in:
+2
-5
@@ -118,11 +118,8 @@ AuthToken.prototype.koaRequest = async function (ctx, next) {
|
||||
|
||||
let tokenData = await this.get(token);
|
||||
if (tokenData && tokenData.uid) {
|
||||
const { DBModel } = await import("../models/index.js");
|
||||
const user = await DBModel.User.findOne({ _id: tokenData.uid });
|
||||
if (user) {
|
||||
ctx.userInfo = user;
|
||||
}
|
||||
// 用户体系在外部服务(user 服务),tokenData 中已包含 uid
|
||||
ctx.userInfo = tokenData;
|
||||
}
|
||||
|
||||
ctx.authToken = this;
|
||||
|
||||
Reference in New Issue
Block a user