From bf39147538790b026309c4840274fbd917e5a57a Mon Sep 17 00:00:00 2001 From: dy Date: Fri, 29 Dec 2023 15:19:19 +0800 Subject: [PATCH 1/4] =?UTF-8?q?Revert=20"fix=20=E7=BA=A2=E7=82=B9"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit e9a27e135ea2024f0ee6381b5426a014bf8c1659. --- src/api_s2c/hongdian/fun.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api_s2c/hongdian/fun.ts b/src/api_s2c/hongdian/fun.ts index a533b60..7f7781c 100644 --- a/src/api_s2c/hongdian/fun.ts +++ b/src/api_s2c/hongdian/fun.ts @@ -358,7 +358,7 @@ export class HuoDongHongDianFun { _res.show = true _res.val.hdid.push(element.hdid) if (_res.val.htype.indexOf(element.htype) == -1) _res.val.htype.push(element.htype) - _res.val.hdxq[element.stype] = ishd + _res.val.hdxq[element.hdid] = ishd } } return _res; From b56a0c4591443f210369878b9925db51d0ff721e Mon Sep 17 00:00:00 2001 From: dy Date: Fri, 29 Dec 2023 15:19:43 +0800 Subject: [PATCH 2/4] =?UTF-8?q?fix=20=E9=85=8D=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api_s2c/peijian/ApiGetList.ts | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/api_s2c/peijian/ApiGetList.ts b/src/api_s2c/peijian/ApiGetList.ts index 9951678..ae5801d 100644 --- a/src/api_s2c/peijian/ApiGetList.ts +++ b/src/api_s2c/peijian/ApiGetList.ts @@ -1,14 +1,14 @@ -import { ApiCall } from "tsrpc"; -import { ReqGetList, ResGetList } from "../../shared/protocols/peijian/PtlGetList"; +import {ApiCall} from "tsrpc"; +import {ReqGetList, ResGetList} from "../../shared/protocols/peijian/PtlGetList"; export default async function (call: ApiCall) { let _maxLv = 0 let color = {} let peijianCon = G.gc.peijian - let dbList = (await G.mongodb.collection('peijian').find({ uid: call.uid }).toArray()).map(p => { + let dbList = (await G.mongodb.collection('peijian').find({uid: call.uid}).toArray()).map(p => { let np = G.mongodb.conversionIdObj(p); - let { uid, ...ops } = np; + let {uid, ...ops} = np; if (np.lv > _maxLv) _maxLv = np.lv if (!color[peijianCon[np.peijianId].colour]) color[peijianCon[np.peijianId].colour] = 0 @@ -16,15 +16,25 @@ export default async function (call: ApiCall) { return ops; }); + // 修复配件穿戴在不存在的英雄身上 + let heroIds = R.values(call.conn.gud.heroPos) + let fixIds = dbList.filter(i => i.wearId && !heroIds.includes(i.wearId)).map(i => G.mongodb.conversionId(i._id)) + if (fixIds.length) { + await G.mongodb.collection('peijian').updateMany({uid: call.uid, _id: {$in: fixIds}}, {wearId: ''}) + } + // 记录玩家最大等级,颜色相关数据 注册任务用 - await G.mongodb.collection('playerInfo', 'usertasklog').updateOne({ uid: call.conn.uid, type: 'usertasklog' }, - { $set: { maxpeijianlv: _maxLv, peijiancolor: color } }, { upsert: true }) + await G.mongodb.collection('playerInfo', 'usertasklog').updateOne({uid: call.conn.uid, type: 'usertasklog'}, + {$set: {maxpeijianlv: _maxLv, peijiancolor: color}}, {upsert: true}) let list = Object.fromEntries(dbList.map(p => [G.formatRedisKey(p._id), p])); G.redis.set('peijian', call.uid, list); - let recLshd = await G.mongodb.collection('playerInfo', 'lshd_peijian').findOne({ uid: call.conn.uid, type: 'lshd_peijian' }); - let { uid, _id, type, ...peijians } = (recLshd || {}); + let recLshd = await G.mongodb.collection('playerInfo', 'lshd_peijian').findOne({ + uid: call.conn.uid, + type: 'lshd_peijian' + }); + let {uid, _id, type, ...peijians} = (recLshd || {}); call.conn.lshd.peijian = peijians || {}; call.succ({ From aa671a332b4e442a16f6a2f2d9582e08aa32c76d Mon Sep 17 00:00:00 2001 From: dy Date: Fri, 29 Dec 2023 15:24:44 +0800 Subject: [PATCH 3/4] =?UTF-8?q?fix=20=E9=85=8D=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api_s2c/peijian/ApiGetList.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api_s2c/peijian/ApiGetList.ts b/src/api_s2c/peijian/ApiGetList.ts index ae5801d..6a74c13 100644 --- a/src/api_s2c/peijian/ApiGetList.ts +++ b/src/api_s2c/peijian/ApiGetList.ts @@ -20,7 +20,7 @@ export default async function (call: ApiCall) { let heroIds = R.values(call.conn.gud.heroPos) let fixIds = dbList.filter(i => i.wearId && !heroIds.includes(i.wearId)).map(i => G.mongodb.conversionId(i._id)) if (fixIds.length) { - await G.mongodb.collection('peijian').updateMany({uid: call.uid, _id: {$in: fixIds}}, {wearId: ''}) + await G.mongodb.collection('peijian').updateMany({_id: {$in: fixIds}}, {$set: {wearId: ''}}) } // 记录玩家最大等级,颜色相关数据 注册任务用 From d5d5d72badc7a3d533d6308b585d5338f17428ec Mon Sep 17 00:00:00 2001 From: dy Date: Fri, 29 Dec 2023 16:21:40 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=85=83=E6=97=A6=E6=B4=BB=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api_s2c/event/yuandan/ApiDMRec.ts | 2 +- src/api_s2c/event/yuandan/ApiDZRec.ts | 2 +- src/api_s2c/event/yuandan/ApiExchange.ts | 2 +- src/api_s2c/event/yuandan/ApiTaskRec.ts | 6 +++--- src/api_s2c/event/yuandan/ApiZLRec.ts | 2 +- src/api_s2c/event/yuandan/fun.ts | 2 +- src/api_s2c/hongdian/fun.ts | 9 ++++----- src/shared/protocols/hongdian/PtlGet.ts | 2 +- 8 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/api_s2c/event/yuandan/ApiDMRec.ts b/src/api_s2c/event/yuandan/ApiDMRec.ts index 693d595..5527059 100644 --- a/src/api_s2c/event/yuandan/ApiDMRec.ts +++ b/src/api_s2c/event/yuandan/ApiDMRec.ts @@ -31,5 +31,5 @@ export default async function (call: ApiCall) { call.succ({prize}) - HongDianChange.sendChangeKey(call.uid, ['yuandan']); + HongDianChange.sendChangeKey(call.uid, ['huodonghd']); } diff --git a/src/api_s2c/event/yuandan/ApiDZRec.ts b/src/api_s2c/event/yuandan/ApiDZRec.ts index a2dd1b8..bc6e083 100644 --- a/src/api_s2c/event/yuandan/ApiDZRec.ts +++ b/src/api_s2c/event/yuandan/ApiDZRec.ts @@ -32,5 +32,5 @@ export default async function (call: ApiCall) { call.succ({[gift.id]: prize}) - HongDianChange.sendChangeKey(call.uid, ['yuandan']); + HongDianChange.sendChangeKey(call.uid, ['huodonghd']); } diff --git a/src/api_s2c/event/yuandan/ApiExchange.ts b/src/api_s2c/event/yuandan/ApiExchange.ts index 72bbe41..6278286 100644 --- a/src/api_s2c/event/yuandan/ApiExchange.ts +++ b/src/api_s2c/event/yuandan/ApiExchange.ts @@ -25,5 +25,5 @@ export default async function (call: ApiCall) { call.succ({}) - HongDianChange.sendChangeKey(call.uid, ['yuandan']); + HongDianChange.sendChangeKey(call.uid, ['huodonghd']); } diff --git a/src/api_s2c/event/yuandan/ApiTaskRec.ts b/src/api_s2c/event/yuandan/ApiTaskRec.ts index 04e95eb..5966b31 100644 --- a/src/api_s2c/event/yuandan/ApiTaskRec.ts +++ b/src/api_s2c/event/yuandan/ApiTaskRec.ts @@ -29,9 +29,9 @@ export default async function (call: ApiCall) { await PlayerFun.sendPrize(call, _prize); let changedata = { data: _mydata, prize: _prize} - // 推送红点 - HongDianChange.sendChangeKey(call.uid, ['huodonghd']); + call.succ(changedata); - + // 推送红点 + HongDianChange.sendChangeKey(call.uid, ['huodonghd']); } \ No newline at end of file diff --git a/src/api_s2c/event/yuandan/ApiZLRec.ts b/src/api_s2c/event/yuandan/ApiZLRec.ts index 4b1340a..5902f8f 100644 --- a/src/api_s2c/event/yuandan/ApiZLRec.ts +++ b/src/api_s2c/event/yuandan/ApiZLRec.ts @@ -40,5 +40,5 @@ export default async function (call: ApiCall) { call.succ({[call.req.id]: prize}) - HongDianChange.sendChangeKey(call.uid, ['yuandan']); + HongDianChange.sendChangeKey(call.uid, ['huodonghd']); } diff --git a/src/api_s2c/event/yuandan/fun.ts b/src/api_s2c/event/yuandan/fun.ts index 785049d..b09da3d 100644 --- a/src/api_s2c/event/yuandan/fun.ts +++ b/src/api_s2c/event/yuandan/fun.ts @@ -24,7 +24,7 @@ export class Yuandanfun { exchange: {}, taskfinish: [], taskval: await this.getTaskVal(call), - qiandaoTime: data?.qiandaoTime || 0, + qiandaoTime: data?.qiandaoTime || 1, refreshTime: G.time }, }, {upsert: true, returnDocument: 'after'})).value diff --git a/src/api_s2c/hongdian/fun.ts b/src/api_s2c/hongdian/fun.ts index 7f7781c..345af02 100644 --- a/src/api_s2c/hongdian/fun.ts +++ b/src/api_s2c/hongdian/fun.ts @@ -349,7 +349,7 @@ export class HuoDongHongDianFun { ishd = await this.pobinglibao(call, element) } if (element.htype == 14) { - // 检测 htype 10 破冰活动红点 + // 检测 htype 10 元旦活动红点 ishd = await this.yuandan(call, element) } @@ -392,16 +392,15 @@ export class HuoDongHongDianFun { if (data?.gameNum < _hd.data.gamefree) return {show: true} - if (!PublicShared.chkSameDate(data?.qiandaoTime || 0, G.time)) { + if (!PublicShared.chkSameDate(data?.qiandaoTime || 1, G.time)) { return {show: true} } - for (let i = 1; i <= data.taskval.length; i++) { - if (data?.taskval[i] >= _hd?.data?.task?.[i]?.pval && !data?.taskfinish.find(v => v == i + '')) { + for (const i in data.taskval) { + if (data?.taskval[i] >= _hd?.data?.task?.[i]?.pval && !data?.taskfinish.find(v => v == i)) { return {show: true} } } - return {show: false} } diff --git a/src/shared/protocols/hongdian/PtlGet.ts b/src/shared/protocols/hongdian/PtlGet.ts index 2d661c0..5e97353 100644 --- a/src/shared/protocols/hongdian/PtlGet.ts +++ b/src/shared/protocols/hongdian/PtlGet.ts @@ -55,7 +55,7 @@ export type hongdianKey = | 'pobinglibao' | 'payForDiamond' | 'leichonglibao' - | 'yuandan'; + export type hongdianVal = { show?: boolean; // 看功能需要