修复mongodb{}对象不更新问题
This commit is contained in:
@@ -56,6 +56,8 @@ class HandlerUser {
|
||||
return ResponseUtil.badRequest(ctx, "缺少微信登录凭证 code 或 appId");
|
||||
}
|
||||
|
||||
|
||||
|
||||
let app = config.app[appId];
|
||||
if (!app) {
|
||||
return ResponseUtil.badRequest(ctx, `未配置 appId: ${appId}`);
|
||||
@@ -104,6 +106,7 @@ class HandlerUser {
|
||||
user.app[appId] = { role: ["user"], wxopenid: openid };
|
||||
}
|
||||
user.app[appId].wxopenid = openid;
|
||||
user.markModified('app');
|
||||
} else {
|
||||
return ResponseUtil.internalError(ctx, "用户不存在");
|
||||
}
|
||||
@@ -214,7 +217,7 @@ class HandlerUser {
|
||||
else {
|
||||
user = await DBModel.User.findOne({ "_id": userId });
|
||||
}
|
||||
|
||||
|
||||
if (!user) {
|
||||
return ResponseUtil.unauthorized(ctx, "用户未登录或 token 无效");
|
||||
}
|
||||
|
||||
@@ -68,6 +68,8 @@ const UserSchema = mongoose.Schema(
|
||||
|
||||
// 带wxopenid
|
||||
app: {
|
||||
type: mongoose.Schema.Types.Mixed,
|
||||
default: {}
|
||||
},
|
||||
|
||||
// 元数据 - 系统管理信息
|
||||
|
||||
Reference in New Issue
Block a user