修改字段名错误

This commit is contained in:
liangtongchuan
2021-12-30 00:32:02 +08:00
parent ad26e19090
commit 2514b634e2

View File

@@ -128,14 +128,14 @@ export default class User extends BaseModel {
return user;
}
public static async createUserWithChannel(channelId: string, channelType: string, channelInfO: ChannelInfo, token: string, platform: string, pkgName: string, serverType: string, deviceId: string, ip: string = '') {
public static async createUserWithChannel(channelId: string, channelType: string, channelInfo: ChannelInfo, token: string, platform: string, pkgName: string, serverType: string, deviceId: string, ip: string = '') {
const curTime: Date = new Date();
const uid = await CounterModel.getNewCounter(COUNTER.UID);
const userCode = genCode(8);
const doc = new UserModel();
let update = {};
update = Object.assign(update, doc.toJSON(), { platform, pkgName, serverType, createTime: curTime, uid, userCode, username: `用户${uid}`, token, lastLoginTime: curTime, ip, channelInfO, channelType });
update = Object.assign(update, doc.toJSON(), { platform, pkgName, serverType, createTime: curTime, uid, userCode, username: `用户${uid}`, token, lastLoginTime: curTime, ip, channelInfo, channelType });
delete update["device"];
const user: UserType = await UserModel.findOneAndUpdate({ channelId }, { $set: update, $addToSet: { device: deviceId } }, { upsert: true, new: true }).lean({ getters: true });