feat:重置bug修复
This commit is contained in:
parent
8718342e3b
commit
dd9eeca150
@ -206,10 +206,10 @@ export default class HQJGFun {
|
|||||||
/** 设置我的数据 */
|
/** 设置我的数据 */
|
||||||
static async setMyData(uid: string, hdid: number, update: { [k in keyof Partial<PlayerData>]: PlayerData[k] }) {
|
static async setMyData(uid: string, hdid: number, update: { [k in keyof Partial<PlayerData>]: PlayerData[k] }) {
|
||||||
let res = await G.mongodb.cEvent(this.dataType(hdid)).updateOne(
|
let res = await G.mongodb.cEvent(this.dataType(hdid)).updateOne(
|
||||||
{uid: uid, type: this.dataType(hdid)}, {$set: update}
|
{ uid: uid, type: this.dataType(hdid) }, { $set: update }, { upsert: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
if (res.modifiedCount <= 0) {
|
if (res.upsertedCount == 1) {
|
||||||
console.log("===>", uid, hdid, update);
|
console.log("===>", uid, hdid, update);
|
||||||
await G.mongodb.cEvent(this.dataType(hdid)).updateOne(
|
await G.mongodb.cEvent(this.dataType(hdid)).updateOne(
|
||||||
{ uid: uid, type: this.dataType(hdid) }, { $set: Object.assign(this.defaultData, update) }
|
{ uid: uid, type: this.dataType(hdid) }, { $set: Object.assign(this.defaultData, update) }
|
||||||
|
Loading…
Reference in New Issue
Block a user