diff --git a/src/api_s2c/event/huangqijiuguan/fun.ts b/src/api_s2c/event/huangqijiuguan/fun.ts index 6cc1c4f..92d9281 100644 --- a/src/api_s2c/event/huangqijiuguan/fun.ts +++ b/src/api_s2c/event/huangqijiuguan/fun.ts @@ -119,13 +119,13 @@ export default class HQJGFun { static today(hdinfo: ReqAddHuoDong) { /** * 获取活动开启到第几天 从1开始 - */ + */ return PublicShared.getDiff(hdinfo.stime, G.time) } /** * 获取排行榜 - */ + */ static async getRankList(hdid: number) { let uids = await G.mongodb.collection("event").find( { type: this.dataType(hdid), "bossres.maxdps": { $gt: 0 } }, @@ -206,10 +206,11 @@ export default class HQJGFun { /** 设置我的数据 */ static async setMyData(uid: string, hdid: number, update: { [k in keyof Partial]: PlayerData[k] }) { 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); await G.mongodb.cEvent(this.dataType(hdid)).updateOne( { uid: uid, type: this.dataType(hdid) }, { $set: Object.assign(this.defaultData, update) } ); @@ -277,7 +278,7 @@ export default class HQJGFun { /** * 最大伤害排行奖励结算 - */ + */ static async endDpsRankPrize(time: number) { console.log( "黄旗酒馆 最大伤害排行奖励结算 开始执行。。。" @@ -433,7 +434,7 @@ export default class HQJGFun { return } - let mydata = await this.getMydata(call); + let mydata = await this.getMydata(call, hd); if (!mydata.giftbuy[gift.id]) { mydata.giftbuy[gift.id] = { num: 0, select: [] }; }