feat:黄芪酒馆

This commit is contained in:
xichaoyin 2024-01-12 02:29:33 +08:00
parent 9d3dd2dbc9
commit 036abb80b4

View File

@ -116,7 +116,6 @@ export default class HQJGFun {
todaydps: {}, todaydps: {},
recdpstask: [] recdpstask: []
}, },
lasttime: 0
} }
} }
@ -209,15 +208,11 @@ 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] }) {
if (!update.lasttime) {
update.lasttime = G.time;
}
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 }
); );
if (res.upsertedCount <= 0) { if (res.modifiedCount <= 0) {
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) }
); );