Compare commits
No commits in common. "48d512a3a655db12b9a4eccce840e61360b0d33e" and "48b07c2d74c36b2c04e7b2d23627c6f1866a0cec" have entirely different histories.
48d512a3a6
...
48b07c2d74
@ -12,38 +12,11 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
|
|||||||
// 无此活动
|
// 无此活动
|
||||||
return call.error('', { code: -1, message: globalThis.lng.huodong_open_1 })
|
return call.error('', { code: -1, message: globalThis.lng.huodong_open_1 })
|
||||||
}
|
}
|
||||||
|
|
||||||
let db = await G.mongodb.cEvent(`chuanshuozhilu${call.req.hdid}`).findOne({ uid: call.uid, type: `chuanshuozhilu${call.req.hdid}` });
|
let db = await G.mongodb.cEvent(`chuanshuozhilu${call.req.hdid}`).findOne({ uid: call.uid, type: `chuanshuozhilu${call.req.hdid}` });
|
||||||
let _info = db?.info || {}
|
|
||||||
// 如果初始没有数据,就判断玩家是否有活动对应的影响,生成一下初始化数据
|
|
||||||
if (!db) {
|
|
||||||
|
|
||||||
let _dbType: `chuanshuozhilu${number}` = `chuanshuozhilu${call.req.hdid}`
|
|
||||||
const hid = _hdinfo.data.hid
|
|
||||||
let heros = await G.mongodb.collection("hero").find({uid: call.uid, heroId: hid})
|
|
||||||
.sort({ "zhanli": -1 }).limit(1).toArray();
|
|
||||||
|
|
||||||
if (heros) {
|
|
||||||
let hero = heros[0]
|
|
||||||
const lv = hero.lv || 0
|
|
||||||
const jieji = hero.jieji || 0
|
|
||||||
let setInfo = {"lv": lv, "jieji": jieji}
|
|
||||||
await G.mongodb.cEvent(_dbType).updateOne(
|
|
||||||
{ uid: call.uid, type: _dbType },
|
|
||||||
{ $set: G.mongodb.createTreeObj({ key: `info.${hid}`, val: setInfo})},
|
|
||||||
{ upsert: true}
|
|
||||||
)
|
|
||||||
if (!cache[call.uid]) cache[call.uid] = {hid:{}};
|
|
||||||
if (!cache[call.uid][hid]) cache[call.uid][hid] = setInfo;
|
|
||||||
_info[hid] = setInfo
|
|
||||||
|
|
||||||
G.server.sendMsgByUid(call.uid, 'msg_s2c/HongDianChange', ['huodonghd']);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
call.succ({
|
call.succ({
|
||||||
info: _info,
|
info: db?.info || {},
|
||||||
hdinfo: _hdinfo
|
hdinfo: _hdinfo
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user