造型
This commit is contained in:
parent
715f564848
commit
d633d52d80
@ -6,13 +6,13 @@ import {UserShared} from '../../shared/public/user';
|
|||||||
|
|
||||||
export default async function (call: ApiCall<ReqChangeInfo, ResChangeInfo>) {
|
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({
|
const 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, call.req.pos || '');
|
const fmtId = UserShared.getInfoId(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,
|
||||||
@ -27,7 +27,7 @@ export default async function (call: ApiCall<ReqChangeInfo, ResChangeInfo>) {
|
|||||||
|
|
||||||
if (call.req.type == 'model') {
|
if (call.req.type == 'model') {
|
||||||
let d = JSON.parse(JSON.stringify(call.conn.gud.model));
|
let d = JSON.parse(JSON.stringify(call.conn.gud.model));
|
||||||
d[call.req.pos] = {
|
d[call.req.id] = {
|
||||||
id: call.req.id,
|
id: call.req.id,
|
||||||
time: active[fmtId] || -1
|
time: active[fmtId] || -1
|
||||||
};
|
};
|
||||||
|
@ -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>; }>) {
|
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 jsonName = 'player' + type.slice(0, 1).toLocaleUpperCase() + type.slice(1);
|
||||||
const json = G.gc[jsonName] as any;
|
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];
|
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];
|
||||||
|
Loading…
Reference in New Issue
Block a user