This commit is contained in:
dy 2023-12-21 10:14:21 +08:00
parent 715f564848
commit d633d52d80
2 changed files with 5 additions and 5 deletions

View File

@ -6,13 +6,13 @@ import {UserShared} from '../../shared/public/user';
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({
uid: call.uid,
type: 'playerInfo'
}))?.active || {};
const fmtId = UserShared.getInfoId(call.req.type, call.req.id, call.req.pos || '');
const fmtId = UserShared.getInfoId(call.req.type, call.req.id);
const isMeet = UserShared.chechIsActive(fmtId, {
lv: call.conn.gud.lv,
vip: call.conn.gud.vip,
@ -27,7 +27,7 @@ export default async function (call: ApiCall<ReqChangeInfo, ResChangeInfo>) {
if (call.req.type == 'model') {
let d = JSON.parse(JSON.stringify(call.conn.gud.model));
d[call.req.pos] = {
d[call.req.id] = {
id: call.req.id,
time: active[fmtId] || -1
};

View File

@ -10,10 +10,10 @@ export class UserShared {
*/
static chechIsActive(fmtId: string, collection: Partial<{ lv: number, vip: number, lsyx: k_v<number>, model: k_v<any>, active: k_v<number>; }>) {
const [type, id, pos] = fmtId.split('_');
const [type, id] = fmtId.split('_');
const jsonName = 'player' + type.slice(0, 1).toLocaleUpperCase() + type.slice(1);
const json = G.gc[jsonName] as any;
const conf: _gcType['playerHead'][''] = pos ? json[pos][id] : json[id];
const conf: _gcType['playerHead'] = json[id];
if (conf.cond[0] == 'lv') return collection.lv >= conf.cond[1];
else if (conf.cond[0] == 'vip') return collection.vip >= conf.cond[1];