用户头像造型修复bug
This commit is contained in:
parent
d633d52d80
commit
552da79951
@ -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,
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user