mirror of
https://github.com/laochan-eacnet/backend.git
synced 2026-09-22 22:28:11 +03:00
add more dummy codes
This commit is contained in:
+31
-28
@@ -69,6 +69,10 @@ function serializeObject(obj: Object, name: string, linePrefix: string = '') {
|
|||||||
output += ` __count="${value[1].length}"`;
|
output += ` __count="${value[1].length}"`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (value && value[1] instanceof Buffer) {
|
||||||
|
output += ` __size="${value[1].length}"`;
|
||||||
|
}
|
||||||
|
|
||||||
output += '>';
|
output += '>';
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
@@ -121,32 +125,31 @@ export function kxml(topName: string = 'response', encoding: 'UTF-8' | 'SHIFT_JI
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// console.log(serializeObject({
|
||||||
console.log(serializeObject({
|
// $attr: 'attr1',
|
||||||
$attr: 'attr1',
|
// sb: {
|
||||||
sb: {
|
// $attr: 'attr2',
|
||||||
$attr: 'attr2',
|
// $__type: 'str',
|
||||||
$__type: 'str',
|
// __value: 'sba',
|
||||||
__value: 'sba',
|
// },
|
||||||
},
|
// sb1: {
|
||||||
sb1: {
|
// $attr: 'attr3',
|
||||||
$attr: 'attr3',
|
// nested: {
|
||||||
nested: {
|
// $attr: 'attr4',
|
||||||
$attr: 'attr4',
|
// $__type: 's32',
|
||||||
$__type: 's32',
|
// __value: [1, 1, 4, 5, 1, 4],
|
||||||
__value: [1, 1, 4, 5, 1, 4],
|
// }
|
||||||
}
|
// },
|
||||||
},
|
// array: [{
|
||||||
array: [{
|
// $attr: 'test'
|
||||||
$attr: 'test'
|
// }, {
|
||||||
}, {
|
// $attr: 'test2'
|
||||||
$attr: 'test2'
|
// }, {
|
||||||
}, {
|
// $attr: 'test3'
|
||||||
$attr: 'test3'
|
// }, {
|
||||||
}, {
|
// $attr: 'test4'
|
||||||
$attr: 'test4'
|
// }, {
|
||||||
}, {
|
// $attr: 'test5'
|
||||||
$attr: 'test5'
|
// }]
|
||||||
}]
|
// }, 'test'))
|
||||||
}, 'test'))
|
|
||||||
|
|
||||||
|
|||||||
+10
-8
@@ -65,7 +65,8 @@ async function main(): Promise<void> {
|
|||||||
name: serviceName,
|
name: serviceName,
|
||||||
method,
|
method,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ctx.body = ctx.body[ctx.service.name];
|
||||||
ctx.logger = ctx.service
|
ctx.logger = ctx.service
|
||||||
? register(`logger:${ctx.service.name}`, {
|
? register(`logger:${ctx.service.name}`, {
|
||||||
useValue: new Logger(ctx.service.name),
|
useValue: new Logger(ctx.service.name),
|
||||||
@@ -101,6 +102,14 @@ async function main(): Promise<void> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.info(
|
||||||
|
'%s.$s [%s]: request = %s',
|
||||||
|
ctx.service.name,
|
||||||
|
ctx.service.method,
|
||||||
|
ctx.pcbid,
|
||||||
|
JSON.stringify(ctx.request.body),
|
||||||
|
);
|
||||||
|
|
||||||
if (service === undefined || !(method in service)) {
|
if (service === undefined || !(method in service)) {
|
||||||
logger.warn(`unimplemented method ${ctx.service.method} in ${ctx.service.name}`);
|
logger.warn(`unimplemented method ${ctx.service.method} in ${ctx.service.name}`);
|
||||||
|
|
||||||
@@ -108,13 +117,6 @@ async function main(): Promise<void> {
|
|||||||
method = 'default';
|
method = 'default';
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info(
|
|
||||||
'%s [%s]: request = %s',
|
|
||||||
ctx.service,
|
|
||||||
ctx.pcbid,
|
|
||||||
JSON.stringify(ctx.request.body),
|
|
||||||
);
|
|
||||||
|
|
||||||
ctx.body = await service[method](ctx);
|
ctx.body = await service[method](ctx);
|
||||||
ctx.status = 200;
|
ctx.status = 200;
|
||||||
|
|
||||||
|
|||||||
@@ -99,6 +99,9 @@ export async function parseKxml(ctx: Context, next: Next): Promise<object> {
|
|||||||
|
|
||||||
if ('call' in body) {
|
if ('call' in body) {
|
||||||
ctx.pcbid = body.call.srcid;
|
ctx.pcbid = body.call.srcid;
|
||||||
|
ctx.tag = body.call.tag;
|
||||||
|
|
||||||
|
ctx.body = body.call;
|
||||||
}
|
}
|
||||||
|
|
||||||
return next();
|
return next();
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
import { kxml } from "../../decorators/to-kxml.js";
|
||||||
|
|
||||||
|
export default class {
|
||||||
|
@kxml()
|
||||||
|
async crate() {
|
||||||
|
return {
|
||||||
|
IIDX31music: {
|
||||||
|
$expire: 1800,
|
||||||
|
c: [
|
||||||
|
// {
|
||||||
|
// $__type: 's32',
|
||||||
|
// $mid: 11451,
|
||||||
|
// __value: new Array(20).fill(-1),
|
||||||
|
// }
|
||||||
|
],
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,257 @@
|
|||||||
|
import { kxml } from "../../decorators/to-kxml.js";
|
||||||
|
import { Context } from "../../types.js";
|
||||||
|
|
||||||
|
interface GetPCDataCall {
|
||||||
|
ccode: string,
|
||||||
|
cid: string,
|
||||||
|
ctype: string,
|
||||||
|
did: string,
|
||||||
|
lid: string,
|
||||||
|
pid: string,
|
||||||
|
rid: string,
|
||||||
|
}
|
||||||
|
|
||||||
|
export default class {
|
||||||
|
@kxml()
|
||||||
|
async common() {
|
||||||
|
return {
|
||||||
|
IIDX31pc: {
|
||||||
|
system_voice_phase: {
|
||||||
|
$phase: 0,
|
||||||
|
},
|
||||||
|
ir: {
|
||||||
|
$beat: 0,
|
||||||
|
},
|
||||||
|
vip_pass_black: {},
|
||||||
|
common_evnet: {
|
||||||
|
$flg: -1,
|
||||||
|
},
|
||||||
|
play_video: {},
|
||||||
|
music_retry: {},
|
||||||
|
display_asio_logo: {},
|
||||||
|
lane_gacha: {},
|
||||||
|
tourism_booster: {},
|
||||||
|
cm_movie_info: {
|
||||||
|
$type: 3,
|
||||||
|
},
|
||||||
|
monthly_mranking: {
|
||||||
|
$__type: 'u16',
|
||||||
|
__value: [],
|
||||||
|
},
|
||||||
|
total_mranking: {
|
||||||
|
$__type: 'u16',
|
||||||
|
__value: [],
|
||||||
|
},
|
||||||
|
hitchart: [{
|
||||||
|
$kind: 0,
|
||||||
|
$period: 0,
|
||||||
|
ranking: [{
|
||||||
|
$music_id: 31021,
|
||||||
|
$rank: 1
|
||||||
|
}]
|
||||||
|
}],
|
||||||
|
$expire: 180,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
getPlayerPcData(_: string) {
|
||||||
|
const data = {
|
||||||
|
d_auto_adjust: 0,
|
||||||
|
d_auto_scrach: 0,
|
||||||
|
d_camera_layout: 0,
|
||||||
|
d_classic_hispeed: 0,
|
||||||
|
d_disp_judge: 0,
|
||||||
|
d_gauge_disp: 0,
|
||||||
|
d_ghost_score: 0,
|
||||||
|
d_gno: 0,
|
||||||
|
d_graph_score: 0,
|
||||||
|
d_gtype: 0,
|
||||||
|
d_hispeed: 0.000000,
|
||||||
|
d_judge: 0,
|
||||||
|
d_judgeAdj: 0,
|
||||||
|
d_lane_brignt: 0,
|
||||||
|
d_liflen: 0,
|
||||||
|
d_notes: 0.000000,
|
||||||
|
d_opstyle: 0,
|
||||||
|
d_pace: 0,
|
||||||
|
d_sdlen: 0,
|
||||||
|
d_sdtype: 0,
|
||||||
|
d_sorttype: 0,
|
||||||
|
d_sub_gno: 0,
|
||||||
|
d_timing: 0,
|
||||||
|
d_timing_split: 0,
|
||||||
|
d_tsujigiri_disp: 0,
|
||||||
|
d_visualization: 0,
|
||||||
|
dach: 0,
|
||||||
|
dp_opt: 1048577,
|
||||||
|
dp_opt2: 1048577,
|
||||||
|
dpnum: 0,
|
||||||
|
gpos: 0,
|
||||||
|
id: 0,
|
||||||
|
idstr: '00000000',
|
||||||
|
mode: 3,
|
||||||
|
name: 'MK_',
|
||||||
|
ngrade: 0,
|
||||||
|
pid: 48,
|
||||||
|
player_kind: 0,
|
||||||
|
pmode: 0,
|
||||||
|
rtype: 0,
|
||||||
|
s_auto_adjust: 1,
|
||||||
|
s_auto_scrach: 0,
|
||||||
|
s_camera_layout: 0,
|
||||||
|
s_classic_hispeed: 0,
|
||||||
|
s_disp_judge: 1,
|
||||||
|
s_gauge_disp: 0,
|
||||||
|
s_ghost_score: 0,
|
||||||
|
s_gno: 0,
|
||||||
|
s_graph_score: 0,
|
||||||
|
s_gtype: 1,
|
||||||
|
s_hispeed: 7.888014,
|
||||||
|
s_judge: 0,
|
||||||
|
s_judgeAdj: -22,
|
||||||
|
s_lane_brignt: 0,
|
||||||
|
s_liflen: 90,
|
||||||
|
s_notes: 28.497925,
|
||||||
|
s_opstyle: 2,
|
||||||
|
s_pace: 0,
|
||||||
|
s_sdlen: 258,
|
||||||
|
s_sdtype: 1,
|
||||||
|
s_sorttype: 0,
|
||||||
|
s_sub_gno: 0,
|
||||||
|
s_timing: 1,
|
||||||
|
s_timing_split: 1,
|
||||||
|
s_tsujigiri_disp: 0,
|
||||||
|
s_visualization: 0,
|
||||||
|
sach: 49,
|
||||||
|
sp_opt: 17180950528,
|
||||||
|
spnum: 2,
|
||||||
|
};
|
||||||
|
|
||||||
|
return Object.fromEntries(
|
||||||
|
Object.entries(data).map(v => ['$' + v[0], v[1]])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@kxml()
|
||||||
|
get(ctx: Context) {
|
||||||
|
const { cid } = ctx.body as GetPCDataCall;
|
||||||
|
return {
|
||||||
|
pcdata: this.getPlayerPcData(cid),
|
||||||
|
bind_eaappli: {},
|
||||||
|
secret: {
|
||||||
|
flg1: {
|
||||||
|
$__type: 's64',
|
||||||
|
__value: [-1, -1, 1048575],
|
||||||
|
},
|
||||||
|
flg2: {
|
||||||
|
$__type: 's64',
|
||||||
|
__value: [-1, -1, 0],
|
||||||
|
},
|
||||||
|
flg3: {
|
||||||
|
$__type: 's64',
|
||||||
|
__value: [-1, -1, 0],
|
||||||
|
},
|
||||||
|
flg4: {
|
||||||
|
$__type: 's64',
|
||||||
|
__value: [-1, -1, 0],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
favorite: {
|
||||||
|
sp_mlist: {
|
||||||
|
$__type: 'bin',
|
||||||
|
__value: Buffer.alloc(1, 0),
|
||||||
|
},
|
||||||
|
sp_clist: {
|
||||||
|
$__type: 'bin',
|
||||||
|
__value: Buffer.alloc(1, 0),
|
||||||
|
},
|
||||||
|
dp_mlist: {
|
||||||
|
$__type: 'bin',
|
||||||
|
__value: Buffer.alloc(1, 0),
|
||||||
|
},
|
||||||
|
dp_clist: {
|
||||||
|
$__type: 'bin',
|
||||||
|
__value: Buffer.alloc(1, 0),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
extra_favorite: [{
|
||||||
|
$folder_id: 0,
|
||||||
|
sp_mlist: {
|
||||||
|
$__type: 'bin',
|
||||||
|
__value: Buffer.alloc(1, 0),
|
||||||
|
},
|
||||||
|
sp_clist: {
|
||||||
|
$__type: 'bin',
|
||||||
|
__value: Buffer.alloc(1, 0),
|
||||||
|
},
|
||||||
|
dp_mlist: {
|
||||||
|
$__type: 'bin',
|
||||||
|
__value: Buffer.alloc(1, 0),
|
||||||
|
},
|
||||||
|
dp_clist: {
|
||||||
|
$__type: 'bin',
|
||||||
|
__value: Buffer.alloc(1, 0),
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
$folder_id: 0,
|
||||||
|
sp_mlist: {
|
||||||
|
$__type: 'bin',
|
||||||
|
__value: Buffer.alloc(1, 0),
|
||||||
|
},
|
||||||
|
sp_clist: {
|
||||||
|
$__type: 'bin',
|
||||||
|
__value: Buffer.alloc(1, 0),
|
||||||
|
},
|
||||||
|
dp_mlist: {
|
||||||
|
$__type: 'bin',
|
||||||
|
__value: Buffer.alloc(1, 0),
|
||||||
|
},
|
||||||
|
dp_clist: {
|
||||||
|
$__type: 'bin',
|
||||||
|
__value: Buffer.alloc(1, 0),
|
||||||
|
},
|
||||||
|
}],
|
||||||
|
grade: {
|
||||||
|
$dgid: -1,
|
||||||
|
$sgid: -1,
|
||||||
|
g: {
|
||||||
|
$__type: 'u8',
|
||||||
|
__value: [0, 13, 3, 58],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
skin: {
|
||||||
|
$__type: 's16',
|
||||||
|
__value: new Array(20).fill(0),
|
||||||
|
},
|
||||||
|
tdjskin: {
|
||||||
|
$__type: 's16',
|
||||||
|
__value: [0, 0, 0, 0],
|
||||||
|
},
|
||||||
|
qprodata: {
|
||||||
|
$__type: 'u32',
|
||||||
|
__value: [0, 0, 0, 0, 0],
|
||||||
|
},
|
||||||
|
spdp_rival: {
|
||||||
|
$flg: 1,
|
||||||
|
},
|
||||||
|
rlist: {},
|
||||||
|
ex: {},
|
||||||
|
secret_course_data: {},
|
||||||
|
weekly: {
|
||||||
|
$mid: 31048,
|
||||||
|
$wid: 2041,
|
||||||
|
},
|
||||||
|
weekly_score: [],
|
||||||
|
visitor: {
|
||||||
|
$anum: 1,
|
||||||
|
$pnum: 1,
|
||||||
|
$snum: 1,
|
||||||
|
$vs_flg: 0,
|
||||||
|
},
|
||||||
|
step: {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
import { kxml } from "../../decorators/to-kxml.js";
|
||||||
|
|
||||||
|
export default class {
|
||||||
|
@kxml()
|
||||||
|
async getname() {
|
||||||
|
return {
|
||||||
|
IIDX31shop: {
|
||||||
|
$cls_opt: 14400,
|
||||||
|
$expire: 0,
|
||||||
|
$opname: '原神, 启动',
|
||||||
|
$pid: 30,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@kxml()
|
||||||
|
async sentinfo() {
|
||||||
|
return {
|
||||||
|
IIDX31shop: {},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
import { kxml } from "../../decorators/to-kxml.js";
|
||||||
|
|
||||||
|
export default class {
|
||||||
|
@kxml()
|
||||||
|
common() {
|
||||||
|
return {
|
||||||
|
IIDX31streaming: {
|
||||||
|
$expire: Math.floor(new Date().valueOf() / 1000) + 259200,
|
||||||
|
cm_info: {},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
import { kxml } from "../../decorators/to-kxml.js";
|
||||||
|
import { Context } from "../../types.js";
|
||||||
|
|
||||||
|
interface CardInquire {
|
||||||
|
cardid: string,
|
||||||
|
cardtype: string,
|
||||||
|
}
|
||||||
|
|
||||||
|
interface CardAuth {
|
||||||
|
pass: string,
|
||||||
|
refid: string,
|
||||||
|
}
|
||||||
|
|
||||||
|
export default class {
|
||||||
|
@kxml()
|
||||||
|
inquire(ctx: Context) {
|
||||||
|
const { cardid, cardtype } = ctx.body as CardInquire;
|
||||||
|
ctx.logger.info('card %s (type %d) inquire', cardid, cardtype);
|
||||||
|
|
||||||
|
return {
|
||||||
|
cardmng: {
|
||||||
|
$binded: 1,
|
||||||
|
$dataid: cardid,
|
||||||
|
$ecflag: 1,
|
||||||
|
$expired: 0,
|
||||||
|
$method: 'inquire',
|
||||||
|
$newflag: 0,
|
||||||
|
$refid: cardid,
|
||||||
|
$status: 0,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@kxml()
|
||||||
|
authpass(ctx: Context) {
|
||||||
|
const { refid, pass } = ctx.body as CardAuth;
|
||||||
|
ctx.logger.info('auth %s with pass %s', refid, pass);
|
||||||
|
|
||||||
|
return {
|
||||||
|
$cardmng: {
|
||||||
|
method: 'authpass',
|
||||||
|
status: 0,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
+5
-2
@@ -3,11 +3,14 @@ import { DefaultState, ParameterizedContext } from 'koa';
|
|||||||
|
|
||||||
export interface ILaochanContext {
|
export interface ILaochanContext {
|
||||||
model?: string;
|
model?: string;
|
||||||
service?: {
|
tag?: string;
|
||||||
|
pcbid?: string;
|
||||||
|
|
||||||
|
service: {
|
||||||
name: string,
|
name: string,
|
||||||
method: string,
|
method: string,
|
||||||
};
|
};
|
||||||
pcbid?: string;
|
|
||||||
logger: Logger;
|
logger: Logger;
|
||||||
|
|
||||||
request: {
|
request: {
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
response
|
|
||||||
message(
|
|
||||||
expire=expire,
|
|
||||||
method="get",
|
|
||||||
status=status,
|
|
||||||
)
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
response
|
|
||||||
pcbtracker(
|
|
||||||
ecenable=ecEnable,
|
|
||||||
expire=expire,
|
|
||||||
method="alive",
|
|
||||||
status=status,
|
|
||||||
time=time,
|
|
||||||
)
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
response
|
|
||||||
services(expire=43200 method="get" mode="operation" product_domain=1 status=0)
|
|
||||||
item(name="keepalive" url=keepaliveUrl)
|
|
||||||
item(name="ntp" url=ntpUrl)
|
|
||||||
item(name="services" url=selfUrl)
|
|
||||||
item(name="dlstatus" url=selfUrl)
|
|
||||||
item(name="cardmng" url=selfUrl)
|
|
||||||
item(name="eacoin" url=selfUrl)
|
|
||||||
item(name="userdata" url=selfUrl)
|
|
||||||
item(name="userid" url=selfUrl)
|
|
||||||
item(name="pcbtracker" url=selfUrl)
|
|
||||||
item(name="pcbevent" url=selfUrl)
|
|
||||||
item(name="message" url=selfUrl)
|
|
||||||
item(name="facility" url=selfUrl)
|
|
||||||
item(name="apsmanager" url=selfUrl)
|
|
||||||
item(name="sidmgr" url=selfUrl)
|
|
||||||
item(name="package" url=selfUrl)
|
|
||||||
item(name="uploader" url=selfUrl)
|
|
||||||
item(name="local" url=selfUrl)
|
|
||||||
item(name="local2" url=selfUrl)
|
|
||||||
item(name="lobby" url=selfUrl)
|
|
||||||
Reference in New Issue
Block a user