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 a533b60..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) } @@ -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; @@ -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/api_s2c/peijian/ApiGetList.ts b/src/api_s2c/peijian/ApiGetList.ts index 9951678..6a74c13 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({_id: {$in: fixIds}}, {$set: {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({ 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; // 看功能需要