Compare commits

...

4 Commits

Author SHA1 Message Date
dy
b615f5d4fc Merge branch 'dev-json' into dev 2023-12-18 14:47:30 +08:00
dy
fdbf22f62f Merge branch 'bugfix' into dev 2023-12-18 14:47:13 +08:00
dy
7474b4583f json 2023-12-18 14:46:36 +08:00
327f9c9b5a 全面去掉hero的redis依赖 2023-12-18 14:43:13 +08:00
14 changed files with 453 additions and 55 deletions

View File

@ -120,7 +120,13 @@ export default async function (call: ApiCall<ReqBingo, ResBingo>) {
} }
} else if (shell[0] == 'heroMaxLv') { } else if (shell[0] == 'heroMaxLv') {
let heros = await G.redis.get('hero', call.uid); //let heros = await G.redis.get('hero', call.uid);
let s = await G.mongodb.collection('hero').find({
uid: call.uid
}).toArray();
let heros = s.map(h => G.mongodb.conversionIdObj(h));
for (let [_id, hero] of Object.entries(heros)) { for (let [_id, hero] of Object.entries(heros)) {
await HeroFun.changeHeroAttr(call, hero, { await HeroFun.changeHeroAttr(call, hero, {
lv: Object.keys(G.gc.playerLv).length * 3, lv: Object.keys(G.gc.playerLv).length * 3,

View File

@ -39,7 +39,7 @@ export default async function (call: ApiCall<ReqChangePos, ResChangePos>) {
} }
} else if (call.req.state == 'change') { } else if (call.req.state == 'change') {
if (heroPos[call.req.pos]) { if (heroPos[call.req.pos]) {
let unLoadHero = await G.redis.get('hero', call.uid, heroPos[call.req.pos]); let unLoadHero = await HeroFun.getHero(call, heroPos[call.req.pos]);
unLoadHero && fightHeros.removeOne(id => id == unLoadHero.heroId); unLoadHero && fightHeros.removeOne(id => id == unLoadHero.heroId);
} }
if (fightHeros.includes(hero.heroId.toString())) return call.errorCode(-2); if (fightHeros.includes(hero.heroId.toString())) return call.errorCode(-2);

View File

@ -4,7 +4,7 @@ import { ReqGetList, ResGetList } from "../../shared/protocols/hero/PtlGetList";
export default async function (call: ApiCall<ReqGetList, ResGetList>) { export default async function (call: ApiCall<ReqGetList, ResGetList>) {
let list: ResGetList['list'] = {}; let list: ResGetList['list'] = {};
let kvList: k_v<RedisCollections2['hero']> = {}; //let kvList: k_v<RedisCollections2['hero']> = {};
let arrList = await G.mongodb.collection('hero').find({ uid: call.uid }).toArray(); let arrList = await G.mongodb.collection('hero').find({ uid: call.uid }).toArray();
let heroCon = G.gc.hero; let heroCon = G.gc.hero;
@ -12,7 +12,7 @@ export default async function (call: ApiCall<ReqGetList, ResGetList>) {
let maxherolv = 0; let maxherolv = 0;
arrList.forEach(v => { arrList.forEach(v => {
let d = G.mongodb.conversionIdObj(v); let d = G.mongodb.conversionIdObj(v);
kvList[G.formatRedisKey(d._id)] = d; //kvList[G.formatRedisKey(d._id)] = d;
list[d._id] = d; list[d._id] = d;
if (v.lv > maxherolv) maxherolv = v.lv; if (v.lv > maxherolv) maxherolv = v.lv;
@ -23,7 +23,7 @@ export default async function (call: ApiCall<ReqGetList, ResGetList>) {
await G.mongodb.collection('playerInfo', 'usertasklog').updateOne({ uid: call.conn.uid, type: 'usertasklog' }, await G.mongodb.collection('playerInfo', 'usertasklog').updateOne({ uid: call.conn.uid, type: 'usertasklog' },
{ $set: { maxherolv: maxherolv, herocolor: color } }, { upsert: true }); { $set: { maxherolv: maxherolv, herocolor: color } }, { upsert: true });
G.redis.set('hero', call.uid, kvList); //G.redis.set('hero', call.uid, kvList);
let recLshd = await G.mongodb.collection('playerInfo', 'lshd_hero').findOne({ uid: call.conn.uid, type: 'lshd_hero' }); let recLshd = await G.mongodb.collection('playerInfo', 'lshd_hero').findOne({ uid: call.conn.uid, type: 'lshd_hero' });
let { uid, _id, type, ...heros } = (recLshd || {}); let { uid, _id, type, ...heros } = (recLshd || {});

View File

@ -39,7 +39,7 @@ export default async function (call: ApiCall<ReqJinJie, ResJinJie, ServiceType>)
let selectHeros: ResGetList['list'][''][] = []; let selectHeros: ResGetList['list'][''][] = [];
for (let _id of call.req.idArr) { for (let _id of call.req.idArr) {
let _hero = await G.redis.get('hero', call.uid, _id); let _hero = await HeroFun.getHero(call, _id);
if (!_hero) return call.error(globalThis.lng.hero_1); if (!_hero) return call.error(globalThis.lng.hero_1);
selectHeros.push(_hero); selectHeros.push(_hero);
} }

View File

@ -0,0 +1,62 @@
{
"1": {
"id": 1,
"jieji": 0,
"ewai_buff": 0
},
"2": {
"id": 2,
"jieji": 1,
"ewai_buff": 0
},
"3": {
"id": 3,
"jieji": 2,
"ewai_buff": 0
},
"4": {
"id": 4,
"jieji": 3,
"ewai_buff": 0
},
"5": {
"id": 5,
"jieji": 4,
"ewai_buff": 0.4
},
"6": {
"id": 6,
"jieji": 5,
"ewai_buff": 0.5
},
"7": {
"id": 7,
"jieji": 6,
"ewai_buff": 0.6
},
"8": {
"id": 8,
"jieji": 7,
"ewai_buff": 0.8
},
"9": {
"id": 9,
"jieji": 8,
"ewai_buff": 1
},
"10": {
"id": 10,
"jieji": 9,
"ewai_buff": 1.2
},
"11": {
"id": 11,
"jieji": 10,
"ewai_buff": 1.4
},
"12": {
"id": 12,
"jieji": 11,
"ewai_buff": 1.8
}
}

View File

@ -3332,17 +3332,17 @@
//玩游戏需要消耗 //玩游戏需要消耗
"gameneed": [{"a": "attr", "t":"jinbi", "n": 1}], "gameneed": [{"a": "attr", "t":"jinbi", "n": 1}],
//玩游戏拿分 //玩游戏拿分
"game": [0,1,2,3,4,5], "game": [5,10,20,30,50],
//战令 //战令
"zhanling":[ "zhanling":[
{ {
"val": 1, "val": 2500,
"pt": [{"a": "attr", "t":"jinbi", "n": 1}], "pt": [{"a": "item", "t":"1", "n": 200000}],
"gj": [{"a": "attr", "t":"jinbi", "n": 1}] "gj": [{"a": "item", "t":"50101", "n": 1},{"a": "item", "t":"1", "n": 500000}]
}, },
{ {
"val": 2, "val": 2,
"pt": [{"a": "attr", "t":"jinbi", "n": 1}], "pt": [{"a": "attr", "t":"rmbmoney", "n": 500}],
"gj": [{"a": "attr", "t":"jinbi", "n": 1}] "gj": [{"a": "attr", "t":"jinbi", "n": 1}]
}, },
{ {
@ -3351,6 +3351,7 @@
"gj": [{"a": "attr", "t":"jinbi", "n": 1}] "gj": [{"a": "attr", "t":"jinbi", "n": 1}]
} }
], ],
//战令PayID
"zlpayid":"ycmb_1_1", "zlpayid":"ycmb_1_1",
//活动礼包 //活动礼包
"libao": { "libao": {
@ -3475,6 +3476,7 @@
intr: "czlbtips_1", intr: "czlbtips_1",
intr: "czlbtips_2", intr: "czlbtips_2",
//礼包 //礼包
//礼包
gift: [ gift: [
{ {
id: '1', id: '1',
@ -3483,7 +3485,10 @@
free: false, free: false,
payId: 'czlb_1', payId: 'czlb_1',
buyNum: 1, buyNum: 1,
prize: [{'a': 'item', 't': '13', 'n': 600},{'a': 'item', 't': '13', 'n': 600},{'a': 'item', 't': '13', 'n': 600}] prize:{"1":[{'a': 'item', 't': '13', 'n': 600}],
"2":[{'a': 'item', 't': '13', 'n': 600}],
"3":[{'a': 'item', 't': '13', 'n': 600}]
}
}, },
{ {
id: '2', id: '2',
@ -3492,7 +3497,10 @@
free: false, free: false,
payId: 'czlb_2', payId: 'czlb_2',
buyNum: 1, buyNum: 1,
prize: [{'a': 'item', 't': '13', 'n': 600},{'a': 'item', 't': '13', 'n': 600},{'a': 'item', 't': '13', 'n': 600}] prize: {"1":[{'a': 'item', 't': '13', 'n': 600}],
"2":[{'a': 'item', 't': '13', 'n': 600}],
"3":[{'a': 'item', 't': '13', 'n': 600}]
}
}, },
{ {
id: '3', id: '3',
@ -3501,7 +3509,10 @@
free: false, free: false,
payId: 'czlb_3', payId: 'czlb_3',
buyNum: 1, buyNum: 1,
prize: [{'a': 'item', 't': '13', 'n': 600},{'a': 'item', 't': '13', 'n': 600},{'a': 'item', 't': '13', 'n': 600}] prize: {"1":[{'a': 'item', 't': '13', 'n': 600}],
"2":[{'a': 'item', 't': '13', 'n': 600}],
"3":[{'a': 'item', 't': '13', 'n': 600}]
}
} }
] ]
} }

View File

@ -4183,7 +4183,33 @@
"n": 60 "n": 60
} }
], ],
"prize": [], "prize": [
{
"a": "hero",
"t": "4002",
"n": 1
},
{
"a": "attr",
"t": "rmbmoney",
"n": 120
},
{
"a": "item",
"t": "12",
"n": 500
},
{
"a": "item",
"t": "1",
"n": 50000
},
{
"a": "attr",
"t": "jinbi",
"n": 100000
}
],
"firstPayPrize": [], "firstPayPrize": [],
"name": "pay_name_shouchong_1", "name": "pay_name_shouchong_1",
"undefined": "首充礼包_6", "undefined": "首充礼包_6",
@ -4203,7 +4229,33 @@
"n": 300 "n": 300
} }
], ],
"prize": [], "prize": [
{
"a": "hero",
"t": "5001",
"n": 1
},
{
"a": "attr",
"t": "rmbmoney",
"n": 600
},
{
"a": "item",
"t": "12",
"n": 1500
},
{
"a": "item",
"t": "1",
"n": 300000
},
{
"a": "attr",
"t": "jinbi",
"n": 300000
}
],
"firstPayPrize": [], "firstPayPrize": [],
"name": "pay_name_shouchong_2", "name": "pay_name_shouchong_2",
"undefined": "首充礼包_30", "undefined": "首充礼包_30",
@ -4223,7 +4275,33 @@
"n": 980 "n": 980
} }
], ],
"prize": [], "prize": [
{
"a": "hero",
"t": "5001",
"n": 1
},
{
"a": "equip",
"t": "1009",
"n": 1
},
{
"a": "equip",
"t": "2009",
"n": 1
},
{
"a": "equip",
"t": "3009",
"n": 1
},
{
"a": "equip",
"t": "4009",
"n": 1
}
],
"firstPayPrize": [], "firstPayPrize": [],
"name": "pay_name_shouchong_3", "name": "pay_name_shouchong_3",
"undefined": "首充礼包_98", "undefined": "首充礼包_98",
@ -4243,7 +4321,23 @@
"n": 60 "n": 60
} }
], ],
"prize": "[{a: 'attr', t: 'jinbi', n: 200000},{a: 'item', t: '1', n: 100000},{a: 'item', t: '4', n: 5}]", "prize": [
{
"a": "item",
"t": "4",
"n": 5
},
{
"a": "item",
"t": "1",
"n": 100000
},
{
"a": "attr",
"t": "jinbi",
"n": 200000
}
],
"firstPayPrize": [], "firstPayPrize": [],
"name": "pay_name_jitianlibao_1", "name": "pay_name_jitianlibao_1",
"undefined": "积天礼包_6", "undefined": "积天礼包_6",
@ -4263,7 +4357,23 @@
"n": 60 "n": 60
} }
], ],
"prize": "[{a: 'attr', t: 'jinbi', n: 400000},{a: 'item', t: '1', n: 200000},{a: 'item', t: '607', n: 20}]", "prize": [
{
"a": "item",
"t": "607",
"n": 20
},
{
"a": "item",
"t": "1",
"n": 200000
},
{
"a": "attr",
"t": "jinbi",
"n": 400000
}
],
"firstPayPrize": [], "firstPayPrize": [],
"name": "pay_name_jitianlibao_2", "name": "pay_name_jitianlibao_2",
"undefined": "积天礼包_6", "undefined": "积天礼包_6",
@ -4283,7 +4393,23 @@
"n": 60 "n": 60
} }
], ],
"prize": "[{a: 'attr', t: 'jinbi', n: 600000},{a: 'item', t: '1', n: 300000},{a: 'item', t: '4', n: 10}]", "prize": [
{
"a": "item",
"t": "4",
"n": 10
},
{
"a": "item",
"t": "1",
"n": 300000
},
{
"a": "attr",
"t": "jinbi",
"n": 600000
}
],
"firstPayPrize": [], "firstPayPrize": [],
"name": "pay_name_jitianlibao_3", "name": "pay_name_jitianlibao_3",
"undefined": "积天礼包_6", "undefined": "积天礼包_6",
@ -4303,7 +4429,23 @@
"n": 60 "n": 60
} }
], ],
"prize": "[{a: 'attr', t: 'jinbi', n: 800000},{a: 'item', t: '1', n: 400000},{a: 'item', t: '12', n: 500}]", "prize": [
{
"a": "item",
"t": "12",
"n": 500
},
{
"a": "item",
"t": "1",
"n": 400000
},
{
"a": "attr",
"t": "jinbi",
"n": 800000
}
],
"firstPayPrize": [], "firstPayPrize": [],
"name": "pay_name_jitianlibao_4", "name": "pay_name_jitianlibao_4",
"undefined": "积天礼包_6", "undefined": "积天礼包_6",
@ -4323,7 +4465,23 @@
"n": 60 "n": 60
} }
], ],
"prize": "[{a: 'attr', t: 'jinbi', n: 1000000},{a: 'item', t: '1', n: 500000},{a: 'item', t: '12', n: 500}]", "prize": [
{
"a": "item",
"t": "12",
"n": 500
},
{
"a": "item",
"t": "1",
"n": 500000
},
{
"a": "attr",
"t": "jinbi",
"n": 1000000
}
],
"firstPayPrize": [], "firstPayPrize": [],
"name": "pay_name_jitianlibao_5", "name": "pay_name_jitianlibao_5",
"undefined": "积天礼包_6", "undefined": "积天礼包_6",
@ -4343,7 +4501,23 @@
"n": 60 "n": 60
} }
], ],
"prize": "[{a: 'attr', t: 'jinbi', n: 1200000},{a: 'item', t: '1', n: 600000},{a: 'item', t: '12', n: 500}]", "prize": [
{
"a": "item",
"t": "12",
"n": 500
},
{
"a": "item",
"t": "1",
"n": 600000
},
{
"a": "attr",
"t": "jinbi",
"n": 1200000
}
],
"firstPayPrize": [], "firstPayPrize": [],
"name": "pay_name_jitianlibao_6", "name": "pay_name_jitianlibao_6",
"undefined": "积天礼包_6", "undefined": "积天礼包_6",
@ -4363,7 +4537,23 @@
"n": 60 "n": 60
} }
], ],
"prize": "[{a: 'attr', t: 'jinbi', n: 1400000},{a: 'item', t: '1', n: 700000},{a: 'item', t: '600', n: 20}]", "prize": [
{
"a": "item",
"t": "600",
"n": 20
},
{
"a": "item",
"t": "1",
"n": 700000
},
{
"a": "attr",
"t": "jinbi",
"n": 1400000
}
],
"firstPayPrize": [], "firstPayPrize": [],
"name": "pay_name_jitianlibao_7", "name": "pay_name_jitianlibao_7",
"undefined": "积天礼包_6", "undefined": "积天礼包_6",
@ -4383,7 +4573,23 @@
"n": 60 "n": 60
} }
], ],
"prize": "[{a: 'attr', t: 'jinbi', n: 1600000},{a: 'item', t: '1', n: 800000},{a: 'item', t: '12', n: 500}]", "prize": [
{
"a": "item",
"t": "12",
"n": 500
},
{
"a": "item",
"t": "1",
"n": 800000
},
{
"a": "attr",
"t": "jinbi",
"n": 1600000
}
],
"firstPayPrize": [], "firstPayPrize": [],
"name": "pay_name_jitianlibao_8", "name": "pay_name_jitianlibao_8",
"undefined": "积天礼包_6", "undefined": "积天礼包_6",
@ -4403,7 +4609,23 @@
"n": 60 "n": 60
} }
], ],
"prize": "[{a: 'attr', t: 'jinbi', n: 1800000},{a: 'item', t: '1', n: 900000},{a: 'item', t: '4', n: 10}]", "prize": [
{
"a": "item",
"t": "4",
"n": 10
},
{
"a": "item",
"t": "1",
"n": 900000
},
{
"a": "attr",
"t": "jinbi",
"n": 1800000
}
],
"firstPayPrize": [], "firstPayPrize": [],
"name": "pay_name_jitianlibao_9", "name": "pay_name_jitianlibao_9",
"undefined": "积天礼包_6", "undefined": "积天礼包_6",
@ -4423,7 +4645,23 @@
"n": 60 "n": 60
} }
], ],
"prize": "[{a: 'attr', t: 'jinbi', n: 2000000},{a: 'item', t: '1', n: 1000000},{a: 'item', t: '12', n: 500}]", "prize": [
{
"a": "item",
"t": "12",
"n": 500
},
{
"a": "item",
"t": "1",
"n": 1000000
},
{
"a": "attr",
"t": "jinbi",
"n": 2000000
}
],
"firstPayPrize": [], "firstPayPrize": [],
"name": "pay_name_jitianlibao_10", "name": "pay_name_jitianlibao_10",
"undefined": "积天礼包_6", "undefined": "积天礼包_6",
@ -4443,7 +4681,23 @@
"n": 60 "n": 60
} }
], ],
"prize": "[{a: 'attr', t: 'jinbi', n: 2200000},{a: 'item', t: '1', n: 1100000},{a: 'item', t: '12', n: 500}]", "prize": [
{
"a": "item",
"t": "12",
"n": 500
},
{
"a": "item",
"t": "1",
"n": 1100000
},
{
"a": "attr",
"t": "jinbi",
"n": 2200000
}
],
"firstPayPrize": [], "firstPayPrize": [],
"name": "pay_name_jitianlibao_11", "name": "pay_name_jitianlibao_11",
"undefined": "积天礼包_6", "undefined": "积天礼包_6",
@ -4463,7 +4717,23 @@
"n": 60 "n": 60
} }
], ],
"prize": "[{a: 'attr', t: 'jinbi', n: 2400000},{a: 'item', t: '1', n: 1200000},{a: 'item', t: '4', n: 10}]", "prize": [
{
"a": "item",
"t": "4",
"n": 10
},
{
"a": "item",
"t": "1",
"n": 1200000
},
{
"a": "attr",
"t": "jinbi",
"n": 2400000
}
],
"firstPayPrize": [], "firstPayPrize": [],
"name": "pay_name_jitianlibao_12", "name": "pay_name_jitianlibao_12",
"undefined": "积天礼包_6", "undefined": "积天礼包_6",
@ -4483,7 +4753,23 @@
"n": 60 "n": 60
} }
], ],
"prize": "[{a: 'attr', t: 'jinbi', n: 2600000},{a: 'item', t: '1', n: 1300000},{a: 'item', t: '12', n: 500}]", "prize": [
{
"a": "item",
"t": "12",
"n": 500
},
{
"a": "item",
"t": "1",
"n": 1300000
},
{
"a": "attr",
"t": "jinbi",
"n": 2600000
}
],
"firstPayPrize": [], "firstPayPrize": [],
"name": "pay_name_jitianlibao_13", "name": "pay_name_jitianlibao_13",
"undefined": "积天礼包_6", "undefined": "积天礼包_6",
@ -4503,7 +4789,23 @@
"n": 60 "n": 60
} }
], ],
"prize": "[{a: 'attr', t: 'jinbi', n: 2800000},{a: 'item', t: '1', n: 1400000},{a: 'item', t: '12', n: 500}]", "prize": [
{
"a": "item",
"t": "12",
"n": 500
},
{
"a": "item",
"t": "1",
"n": 1400000
},
{
"a": "attr",
"t": "jinbi",
"n": 2800000
}
],
"firstPayPrize": [], "firstPayPrize": [],
"name": "pay_name_jitianlibao_14", "name": "pay_name_jitianlibao_14",
"undefined": "积天礼包_6", "undefined": "积天礼包_6",
@ -4523,7 +4825,23 @@
"n": 60 "n": 60
} }
], ],
"prize": "[{a: 'attr', t: 'jinbi', n: 3000000},{a: 'item', t: '1', n: 1500000},{a: 'item', t: '600', n: 20}]", "prize": [
{
"a": "item",
"t": "600",
"n": 20
},
{
"a": "item",
"t": "1",
"n": 1500000
},
{
"a": "attr",
"t": "jinbi",
"n": 3000000
}
],
"firstPayPrize": [], "firstPayPrize": [],
"name": "pay_name_jitianlibao_15", "name": "pay_name_jitianlibao_15",
"undefined": "积天礼包_6", "undefined": "积天礼包_6",

View File

@ -1011,7 +1011,7 @@
"mofa": 0, "mofa": 0,
"islong": 0 "islong": 0
}, },
"describe": "普通攻击替换为随机攻击3个目标造成基础伤害95%的物理伤害" "describe": "普通攻击替换为随机攻击2个目标造成基础伤害95%的物理伤害"
}, },
"4002201": { "4002201": {
"skillid": 4002201, "skillid": 4002201,
@ -1029,7 +1029,7 @@
"mofa": 0, "mofa": 0,
"islong": 0 "islong": 0
}, },
"describe": "普通攻击替换为随机攻击3个目标造成基础伤害114%的物理伤害" "describe": "普通攻击替换为随机攻击2个目标造成基础伤害114%的物理伤害"
}, },
"4003200": { "4003200": {
"skillid": 4003200, "skillid": 4003200,
@ -1202,7 +1202,7 @@
"order": "rand", "order": "rand",
"limit": 6, "limit": 6,
"data": { "data": {
"pro": 0.11 "pro": 0.13
}, },
"chkdata": {}, "chkdata": {},
"ext": {}, "ext": {},
@ -1217,7 +1217,7 @@
"order": "rand", "order": "rand",
"limit": 6, "limit": 6,
"data": { "data": {
"pro": 0.11 "pro": 0.13
}, },
"chkdata": {}, "chkdata": {},
"ext": {}, "ext": {},

View File

@ -739,7 +739,7 @@
"sxleixing": "zhongdu", "sxleixing": "zhongdu",
"buff_type": 2, "buff_type": 2,
"xiaoguocanshu": { "xiaoguocanshu": {
"pro": 0.15, "pro": 0.18,
"type": "hp" "type": "hp"
}, },
"round": 2, "round": 2,
@ -759,7 +759,7 @@
"sxleixing": "zhongdu", "sxleixing": "zhongdu",
"buff_type": 2, "buff_type": 2,
"xiaoguocanshu": { "xiaoguocanshu": {
"pro": 0.15, "pro": 0.18,
"type": "hp" "type": "hp"
}, },
"round": 2, "round": 2,

View File

@ -17,7 +17,7 @@ export class EquipFun {
//穿戴装备时该装备穿戴在另一个英雄身上 //穿戴装备时该装备穿戴在另一个英雄身上
if (change.wearaId != undefined && equip.wearaId && equip.wearaId != change.wearaId && changeHero) { if (change.wearaId != undefined && equip.wearaId && equip.wearaId != change.wearaId && changeHero) {
let takeHero = await G.redis.get('hero', call.uid, equip.wearaId); let takeHero = await HeroFun.getHero(call, equip.wearaId);
if (takeHero) { if (takeHero) {
let _equip = Object.assign({}, takeHero.equip); let _equip = Object.assign({}, takeHero.equip);
_equip[G.gc.equip[equip.equipId].type] = ''; _equip[G.gc.equip[equip.equipId].type] = '';

View File

@ -24,9 +24,9 @@ export class HeroFun {
hero.zhanli = HeroShared.getHeroZhanLi(hero, call.otherBuff, Object.values(call.conn.gud.heroPos).indexOf(hero._id)); hero.zhanli = HeroShared.getHeroZhanLi(hero, call.otherBuff, Object.values(call.conn.gud.heroPos).indexOf(hero._id));
change.zhanli = hero.zhanli; change.zhanli = hero.zhanli;
for (let k in change) { // for (let k in change) {
await G.redis.set('hero', call.uid, hero._id, k as any, change[k]); // await G.redis.set('hero', call.uid, hero._id, k as any, change[k]);
} // }
await G.mongodb.collection('hero').updateOne({uid: call.uid, _id: new ObjectId(hero._id)}, { await G.mongodb.collection('hero').updateOne({uid: call.uid, _id: new ObjectId(hero._id)}, {
$set: { $set: {
@ -41,13 +41,13 @@ export class HeroFun {
/**获取英雄 */ /**获取英雄 */
static async getHero(call: call, oid: string) { static async getHero(call: call, oid: string) {
let data = await G.redis.get('hero', call.uid, oid); //let data = await G.redis.get('hero', call.uid, oid);
if (!data) { // 如果redis中的hero数据被清理掉 直接查询数据库 //if (!data) { // 如果redis中的hero数据被清理掉 直接查询数据库
let {_id, ...info} = await G.mongodb.collection("hero").findOne({ let {_id, ...info} = await G.mongodb.collection("hero").findOne({
_id: G.mongodb.conversionId(oid) _id: G.mongodb.conversionId(oid)
}) })
data = Object.assign({_id: _id.toHexString()}, info) let data = Object.assign({_id: _id.toHexString()}, info)
} //}
return data return data
} }

View File

@ -454,12 +454,12 @@ export class PlayerFun {
//hero/apiGetList里会G.redis.set('hero', call.uid, kvList); //hero/apiGetList里会G.redis.set('hero', call.uid, kvList);
//在这之后再执行下面的代码则不会报错 //在这之后再执行下面的代码则不会报错
if (await G.redis.type('hero', call.uid) != null) { // if (await G.redis.type('hero', call.uid) != null) {
G.redis.set('hero', call.uid, id, { // G.redis.set('hero', call.uid, id, {
_id: id, // _id: id,
...ops // ...ops
}); // });
} // }
call.addEventMsg('msg_s2c/HeroChange', id, { call.addEventMsg('msg_s2c/HeroChange', id, {

View File

@ -38,7 +38,7 @@ export class ShiwuFun {
//穿戴饰物时该装备穿戴在另一个英雄身上 //穿戴饰物时该装备穿戴在另一个英雄身上
if (change.wearId != undefined && shiwu.wearId && shiwu.wearId != change.wearId && changeHero) { if (change.wearId != undefined && shiwu.wearId && shiwu.wearId != change.wearId && changeHero) {
let takeHero = await G.redis.get('hero', call.uid, shiwu.wearId); let takeHero = await HeroFun.getHero(call, shiwu.wearId);
if (takeHero) { if (takeHero) {
let _shiwu = Object.assign({}, takeHero.shiwu); let _shiwu = Object.assign({}, takeHero.shiwu);
let _pos = Object.keys(_shiwu).filter(pos => _shiwu[pos]._id == shiwu._id)[0]; let _pos = Object.keys(_shiwu).filter(pos => _shiwu[pos]._id == shiwu._id)[0];
@ -55,7 +55,7 @@ export class ShiwuFun {
//属性发生变化并且穿戴在英雄身上时 //属性发生变化并且穿戴在英雄身上时
if (change.wearId == undefined && shiwu.wearId) { if (change.wearId == undefined && shiwu.wearId) {
let takeHero = await G.redis.get('hero', call.uid, shiwu.wearId); let takeHero = await HeroFun.getHero(call, shiwu.wearId);
if (takeHero) { if (takeHero) {
let _shiwu = Object.assign({}, takeHero.shiwu); let _shiwu = Object.assign({}, takeHero.shiwu);
let _pos = Object.keys(_shiwu).filter(pos => _shiwu[pos]._id == shiwu._id)[0]; let _pos = Object.keys(_shiwu).filter(pos => _shiwu[pos]._id == shiwu._id)[0];

View File

@ -75,8 +75,9 @@ async function clearRedis() {
G.redis.fromatKey('jjc'), G.redis.fromatKey('jjc'),
G.redis.fromatKey('user'), G.redis.fromatKey('user'),
G.redis.fromatKey('item'), G.redis.fromatKey('item'),
G.redis.fromatKey('hero'),
//G.redis.fromatKey('equip'), //G.redis.fromatKey('equip'),
//G.redis.fromatKey('hero'),
//G.redis.fromatKey('shiwu'), //G.redis.fromatKey('shiwu'),
//G.redis.fromatKey('gbtx'), //G.redis.fromatKey('gbtx'),
//G.redis.fromatKey('dxlt'), //G.redis.fromatKey('dxlt'),