用户头像造型修复bug

This commit is contained in:
dy 2023-12-21 11:32:15 +08:00
parent d633d52d80
commit 552da79951
2 changed files with 22 additions and 3 deletions

View File

@ -8,11 +8,13 @@ export default async function (call: ApiCall<ReqChangeInfo, ResChangeInfo>) {
// if (call.req.type == 'model' && !call.req.pos) return call.error(globalThis.lng.shiwu_6); // if (call.req.type == 'model' && !call.req.pos) return call.error(globalThis.lng.shiwu_6);
const active = (await G.mongodb.collection('playerInfo', 'playerInfo').findOne({ let active = (await G.mongodb.collection('playerInfo', 'playerInfo').findOne({
uid: call.uid, uid: call.uid,
type: 'playerInfo' type: 'playerInfo'
}))?.active || {}; }))?.active || {};
const fmtId = UserShared.getInfoId(call.req.type, call.req.id); const fmtId = UserShared.getInfoId(call.req.type, call.req.id);
if (R.values(active).length == 0) active = UserShared.getActive(fmtId, call.conn.gud, call.req.type, call.req.id)
const isMeet = UserShared.chechIsActive(fmtId, { const isMeet = UserShared.chechIsActive(fmtId, {
lv: call.conn.gud.lv, lv: call.conn.gud.lv,
vip: call.conn.gud.vip, vip: call.conn.gud.vip,

View File

@ -4,6 +4,22 @@ export class UserShared {
return Array.from(arguments).filter(s => s != '').join('_'); return Array.from(arguments).filter(s => s != '').join('_');
} }
// todo active始终为空暂时获取对应的avtive解决打包上线的圣诞版本
// 后续要理清数据格式填入playerinfo的active包括user/infoOpen接口的返回
static getActive(fmtId, player, type, id?) {
switch (type) {
case 'head':
return {[fmtId]: player.head?.time}
case 'headFrame':
return {[fmtId]: player.headFrames[id]}
case 'chatFrame':
return {[fmtId]: player.chatFrames[id]}
case 'model':
return {[fmtId]: player.model?.[id]?.time}
}
return {}
}
/** /**
* *
* @param id 使 UserShared.getInfo id * @param id 使 UserShared.getInfo id
@ -18,8 +34,9 @@ export class UserShared {
if (conf.cond[0] == 'lv') return collection.lv >= conf.cond[1]; if (conf.cond[0] == 'lv') return collection.lv >= conf.cond[1];
else if (conf.cond[0] == 'vip') return collection.vip >= conf.cond[1]; else if (conf.cond[0] == 'vip') return collection.vip >= conf.cond[1];
else if (conf.cond[0] == 'hero') return collection.lsyx[conf.cond[1]] > 0; else if (conf.cond[0] == 'hero') return collection.lsyx[conf.cond[1]] > 0;
else if (conf.cond[0] == 'time') return collection.active[fmtId] == -1 || collection.active[fmtId] > G.time; // else if (conf.cond[0] == 'time') return collection.active[fmtId] == -1 || collection.active[fmtId] > G.time;
else if (conf.cond[0] == 'model') return Object.values(collection.model).find(i=>i.id==conf.cond[1]); else if (conf.cond[0] == 'time') return conf.cond[1] == -1 || collection.active[fmtId] > G.time;
else if (conf.cond[0] == 'model') return Object.values(collection.model).find(i => i.id == conf.cond[1]);
else return false; else return false;
} }
} }