@xmobitea/gn-server 2.4.16 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/GN-app-api/handler/controller/handler/characterPlayer/GetCreateLeaderboardRequestHandler.d.ts +0 -1
- package/dist/GN-app-api/handler/controller/handler/characterPlayer/GetCurrencyLeaderboardRequestHandler.d.ts +0 -1
- package/dist/GN-app-api/handler/controller/handler/characterPlayer/GetCurrencyLogRequestHandler.d.ts +0 -1
- package/dist/GN-app-api/handler/controller/handler/characterPlayer/GetLastLoginLeaderboardRequestHandler.d.ts +22 -0
- package/dist/GN-app-api/handler/controller/handler/characterPlayer/GetStatisticsLeaderboardRequestHandler.d.ts +0 -1
- package/dist/GN-app-api/handler/controller/handler/characterPlayer/GetStatisticsLogRequestHandler.d.ts +0 -1
- package/dist/GN-app-api/handler/controller/handler/dashboard/model/CharacterPlayerPermissionRulesParam.d.ts +1 -0
- package/dist/GN-app-api/handler/controller/handler/dashboard/model/StoreInventoryPermissionRulesParam.d.ts +2 -0
- package/dist/GN-app-api/handler/controller/handler/gamePlayer/GetCurrencyLogRequestHandler.d.ts +0 -1
- package/dist/GN-app-api/handler/controller/handler/gamePlayer/GetStatisticsLogRequestHandler.d.ts +0 -1
- package/dist/GN-app-api/handler/controller/handler/group/GetCurrencyLogRequestHandler.d.ts +0 -1
- package/dist/GN-app-api/handler/controller/handler/group/GetStatisticsLogRequestHandler.d.ts +0 -1
- package/dist/GN-app-api/handler/controller/handler/inventory/GetStatisticsLogRequestHandler.d.ts +0 -1
- package/dist/GN-app-api/handler/controller/handler/masterPlayer/GetCurrencyLogRequestHandler.d.ts +0 -1
- package/dist/GN-app-api/handler/controller/handler/masterPlayer/GetStatisticsLogRequestHandler.d.ts +0 -1
- package/dist/GN-app-api/handler/controller/handler/storeInventory/GetStoreUsedRequestHandler.d.ts +17 -0
- package/dist/GN-app-api/handler/controller/handler/storeInventory/RemoveStoreUsedRequestHandler.d.ts +18 -0
- package/dist/GN-app-api/handler/controller/handler/storeInventory/SetStoreItemInformationRequestHandler.d.ts +1 -0
- package/dist/GN-app-api/handler/controller/handler/storeInventory/StoreItemBaseRequestHandler.d.ts +1 -0
- package/dist/GN-app-api/handler/controller/handler/storeInventory/model/InfoRequestParam.d.ts +1 -0
- package/dist/GN-common/constant/OperationCode.d.ts +2 -0
- package/dist/GN-common/constant/enumType/StoreItemType.d.ts +4 -0
- package/dist/GN-common/constant/errorCode/GNErrorCode.d.ts +2 -0
- package/dist/GN-common/constant/parameterCode/GNParameterCode.d.ts +4 -0
- package/dist/GN-common/entity/SecretInfo.d.ts +3 -0
- package/dist/GN-library/xdatabase/lib/entity/pro/StoreInventory.d.ts +4 -0
- package/dist/GN-library/xdatabase/lib/entity/pro/findOptions/StoreInventoryFindOptions.d.ts +1 -0
- package/dist/GN-library/xdatabase/lib/xDatabase.d.ts +12 -0
- package/dist/GN-startup/cloudScript/eventCallbackCloudScriptData.json +17 -2
- package/dist/GN-startup/cloudScript/templateCloudScript.ts +171 -165
- package/dist/GN-startup/cloudScript/templateEventCallback.ts +231 -225
- package/dist/GN-startup/settings/ApplicationSettings.d.ts +3 -0
- package/dist/GNServer.d.ts +4 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1177 -441
- package/gn.sh +2 -2
- package/package.json +2 -5
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { parentPort, workerData } from "worker_threads";
|
|
2
|
-
|
|
3
1
|
import { SecretInfo, SecretPermissionItem } from "../../index";
|
|
4
2
|
import { AuthInfo } from "../../index";
|
|
5
3
|
import { authenticate_InfoRequestParam as authenticate_InfoRequestParam } from "../../index";
|
|
@@ -138,12 +136,14 @@ import {
|
|
|
138
136
|
GroupStatus,
|
|
139
137
|
GNDebug,
|
|
140
138
|
ItemType,
|
|
139
|
+
StoreItemType,
|
|
141
140
|
LogType,
|
|
142
141
|
GNSupport,
|
|
143
142
|
PostType,
|
|
144
143
|
GetAuthInfoResponse,
|
|
145
144
|
PushPlatformType,
|
|
146
145
|
StoreReceiveType,
|
|
146
|
+
GNUtils,
|
|
147
147
|
} from "@xmobitea/gn-typescript-client";
|
|
148
148
|
|
|
149
149
|
import * as mongodb from "mongodb";
|
|
@@ -347,121 +347,128 @@ class CloudScriptSocket {
|
|
|
347
347
|
}
|
|
348
348
|
|
|
349
349
|
private async sendEvent(event: CloudScriptEvent) {
|
|
350
|
-
|
|
350
|
+
if (process?.send)
|
|
351
|
+
process.send(event);
|
|
351
352
|
}
|
|
352
353
|
}
|
|
353
354
|
|
|
354
355
|
class CloudScriptMatchmaking {
|
|
355
356
|
public async confirmServerDetail(gameId: string, matchmakingTicketCanMatch: MatchmakingTicketCanMatch, serverDetail: ServerDetail) {
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
357
|
+
if (process?.send)
|
|
358
|
+
process.send({
|
|
359
|
+
eventType: 10,
|
|
360
|
+
receiver: null,
|
|
361
|
+
operationEvent: {
|
|
362
|
+
eventCode: 0,
|
|
363
|
+
encrypted: false,
|
|
364
|
+
parameters: {
|
|
365
|
+
gameId: gameId,
|
|
366
|
+
matchmakingTicketCanMatch: matchmakingTicketCanMatch,
|
|
367
|
+
serverDetail: serverDetail,
|
|
368
|
+
},
|
|
369
|
+
},
|
|
370
|
+
});
|
|
369
371
|
}
|
|
370
372
|
}
|
|
371
373
|
|
|
372
374
|
class CloudScriptMail {
|
|
373
375
|
public async send(email: string, subject: string, contentHtml: string) {
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
376
|
+
if (process?.send)
|
|
377
|
+
process.send({
|
|
378
|
+
eventType: 20,
|
|
379
|
+
receiver: null,
|
|
380
|
+
operationEvent: {
|
|
381
|
+
eventCode: 0,
|
|
382
|
+
encrypted: false,
|
|
383
|
+
parameters: {
|
|
384
|
+
email: email,
|
|
385
|
+
subject: subject,
|
|
386
|
+
contentHtml: contentHtml,
|
|
387
|
+
},
|
|
388
|
+
},
|
|
389
|
+
});
|
|
387
390
|
}
|
|
388
391
|
|
|
389
392
|
public async sendToMore(emails: string[], subject: string, contentHtml: string) {
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
393
|
+
if (process?.send)
|
|
394
|
+
process.send({
|
|
395
|
+
eventType: 21,
|
|
396
|
+
receiver: null,
|
|
397
|
+
operationEvent: {
|
|
398
|
+
eventCode: 0,
|
|
399
|
+
encrypted: false,
|
|
400
|
+
parameters: {
|
|
401
|
+
emails: emails,
|
|
402
|
+
subject: subject,
|
|
403
|
+
contentHtml: contentHtml,
|
|
404
|
+
},
|
|
405
|
+
},
|
|
406
|
+
});
|
|
403
407
|
}
|
|
404
408
|
}
|
|
405
409
|
|
|
406
410
|
class CloudScriptPushNotification {
|
|
407
411
|
public async send(token: string, title: string, body: string, badge?: number, sound?: string, icon?: string, data?: { [k: string]: any }) {
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
412
|
+
if (process?.send)
|
|
413
|
+
process.send({
|
|
414
|
+
eventType: 30,
|
|
415
|
+
receiver: null,
|
|
416
|
+
operationEvent: {
|
|
417
|
+
eventCode: 0,
|
|
418
|
+
encrypted: false,
|
|
419
|
+
parameters: {
|
|
420
|
+
token: token,
|
|
421
|
+
title: title,
|
|
422
|
+
body: body,
|
|
423
|
+
badge: badge,
|
|
424
|
+
sound: sound,
|
|
425
|
+
icon: icon,
|
|
426
|
+
data: data,
|
|
427
|
+
},
|
|
428
|
+
},
|
|
429
|
+
});
|
|
425
430
|
}
|
|
426
431
|
|
|
427
432
|
public async sendToMore(tokens: string[], title: string, body: string, badge?: number, sound?: string, icon?: string, data?: { [k: string]: any }) {
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
433
|
+
if (process?.send)
|
|
434
|
+
process.send({
|
|
435
|
+
eventType: 31,
|
|
436
|
+
receiver: null,
|
|
437
|
+
operationEvent: {
|
|
438
|
+
eventCode: 0,
|
|
439
|
+
encrypted: false,
|
|
440
|
+
parameters: {
|
|
441
|
+
tokens: tokens,
|
|
442
|
+
title: title,
|
|
443
|
+
body: body,
|
|
444
|
+
badge: badge,
|
|
445
|
+
sound: sound,
|
|
446
|
+
icon: icon,
|
|
447
|
+
data: data,
|
|
448
|
+
},
|
|
449
|
+
},
|
|
450
|
+
});
|
|
445
451
|
}
|
|
446
452
|
|
|
447
453
|
public async sendToTopic(topic: string, title: string, body: string, badge?: number, sound?: string, icon?: string, data?: { [k: string]: any }) {
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
454
|
+
if (process?.send)
|
|
455
|
+
process.send({
|
|
456
|
+
eventType: 32,
|
|
457
|
+
receiver: null,
|
|
458
|
+
operationEvent: {
|
|
459
|
+
eventCode: 0,
|
|
460
|
+
encrypted: false,
|
|
461
|
+
parameters: {
|
|
462
|
+
topic: topic,
|
|
463
|
+
title: title,
|
|
464
|
+
body: body,
|
|
465
|
+
badge: badge,
|
|
466
|
+
sound: sound,
|
|
467
|
+
icon: icon,
|
|
468
|
+
data: data,
|
|
469
|
+
},
|
|
470
|
+
},
|
|
471
|
+
});
|
|
465
472
|
}
|
|
466
473
|
}
|
|
467
474
|
|
|
@@ -541,146 +548,145 @@ interface FunctionResponse {
|
|
|
541
548
|
errorMessage: any;
|
|
542
549
|
}
|
|
543
550
|
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
};
|
|
564
|
-
|
|
565
|
-
handleResponse = await ___handleMatchmakingFunction(functionRequest);
|
|
566
|
-
}
|
|
567
|
-
else {
|
|
568
|
-
let functionRequest: FunctionRequest = {
|
|
569
|
-
eventName: request.eventName,
|
|
570
|
-
operationRequest: null as any,
|
|
571
|
-
secretInfo: null as any,
|
|
572
|
-
request: null as any,
|
|
573
|
-
log(log: any) {
|
|
574
|
-
logs.push(JSON.stringify(log));
|
|
575
|
-
},
|
|
576
|
-
};
|
|
577
|
-
|
|
578
|
-
handleResponse = await ___handleSystemFunction(functionRequest);
|
|
579
|
-
}
|
|
580
|
-
} else if (request.eventType == EventCallbackType.Event) {
|
|
581
|
-
let originOperationEvent = request.operationRequest;
|
|
582
|
-
|
|
583
|
-
let operationEvent = new OperationEvent(originOperationEvent.operationCode, (originOperationEvent.parameters ? GNHashtable.builder().addAll(originOperationEvent.parameters).build() : null as any), originOperationEvent.encrypted);
|
|
551
|
+
process?.on("message", async (request: CloudScriptRequest) => {
|
|
552
|
+
let startTime = performance.now();
|
|
553
|
+
let startMemoryUsage = process.memoryUsage();
|
|
554
|
+
|
|
555
|
+
let logs: string[] = [];
|
|
556
|
+
|
|
557
|
+
let handleResponse: FunctionResponse = null as any;
|
|
558
|
+
|
|
559
|
+
if (request.eventType == EventCallbackType.System) {
|
|
560
|
+
if (request.eventName == "system_RequestServerDetail") {
|
|
561
|
+
let functionRequest: FunctionRequest = {
|
|
562
|
+
eventName: request.eventName,
|
|
563
|
+
operationRequest: null as any,
|
|
564
|
+
secretInfo: null as any,
|
|
565
|
+
request: request.request,
|
|
566
|
+
log(log: any) {
|
|
567
|
+
logs.push(JSON.stringify(log));
|
|
568
|
+
},
|
|
569
|
+
};
|
|
584
570
|
|
|
571
|
+
handleResponse = await ___handleMatchmakingFunction(functionRequest);
|
|
572
|
+
}
|
|
573
|
+
else {
|
|
585
574
|
let functionRequest: FunctionRequest = {
|
|
586
575
|
eventName: request.eventName,
|
|
587
576
|
operationRequest: null as any,
|
|
588
577
|
secretInfo: null as any,
|
|
589
|
-
request:
|
|
590
|
-
|
|
591
|
-
|
|
578
|
+
request: null as any,
|
|
579
|
+
log(log: any) {
|
|
580
|
+
logs.push(JSON.stringify(log));
|
|
592
581
|
},
|
|
582
|
+
};
|
|
583
|
+
|
|
584
|
+
handleResponse = await ___handleSystemFunction(functionRequest);
|
|
585
|
+
}
|
|
586
|
+
} else if (request.eventType == EventCallbackType.Event) {
|
|
587
|
+
let originOperationEvent = request.operationRequest;
|
|
588
|
+
|
|
589
|
+
let operationEvent = new OperationEvent(originOperationEvent.operationCode, (originOperationEvent.parameters ? GNHashtable.builder().addAll(originOperationEvent.parameters).build() : null as any), originOperationEvent.encrypted);
|
|
590
|
+
|
|
591
|
+
let functionRequest: FunctionRequest = {
|
|
592
|
+
eventName: request.eventName,
|
|
593
|
+
operationRequest: null as any,
|
|
594
|
+
secretInfo: null as any,
|
|
595
|
+
request: {
|
|
596
|
+
operationEvent: operationEvent,
|
|
597
|
+
request: request.request,
|
|
598
|
+
},
|
|
599
|
+
log(log: any) {
|
|
600
|
+
logs.push(JSON.stringify(log));
|
|
601
|
+
},
|
|
602
|
+
};
|
|
603
|
+
|
|
604
|
+
handleResponse = await ___handleEventFunction(functionRequest);
|
|
605
|
+
} else {
|
|
606
|
+
let originOperationRequest = request.operationRequest;
|
|
607
|
+
let operationRequest = new OperationRequest(originOperationRequest.operationCode, originOperationRequest.encrypted);
|
|
608
|
+
if (originOperationRequest.parameters) {
|
|
609
|
+
operationRequest.setParameters(GNHashtable.builder().addAll(originOperationRequest.parameters).build());
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
let originSecretInfo = request.secretInfo;
|
|
613
|
+
let secretInfo: SecretInfo = null as any;
|
|
614
|
+
if (originSecretInfo) {
|
|
615
|
+
secretInfo = SecretInfo.Builder()
|
|
616
|
+
.setSecretKey(originSecretInfo.secretKey)
|
|
617
|
+
.setRole(originSecretInfo.role)
|
|
618
|
+
.setIsRemove(originSecretInfo.remove)
|
|
619
|
+
.setTsExpire(originSecretInfo.tsExpire)
|
|
620
|
+
.setPermission(originSecretInfo.permission)
|
|
621
|
+
.setGameId(originSecretInfo.gameId)
|
|
622
|
+
.setIsDefault(originSecretInfo.isDefault)
|
|
623
|
+
.setIsOnlyMasterAdmin(originSecretInfo.onlyMasterAdmin)
|
|
624
|
+
.build();
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
if (request.eventType == EventCallbackType.Pre) {
|
|
628
|
+
let functionRequest: FunctionRequest = {
|
|
629
|
+
eventName: request.eventName,
|
|
630
|
+
operationRequest: operationRequest,
|
|
631
|
+
secretInfo: secretInfo,
|
|
632
|
+
request: request.request,
|
|
593
633
|
log(log: any) {
|
|
594
634
|
logs.push(JSON.stringify(log));
|
|
595
635
|
},
|
|
596
636
|
};
|
|
597
637
|
|
|
598
|
-
handleResponse = await
|
|
599
|
-
} else {
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
if (originOperationRequest.parameters) {
|
|
603
|
-
operationRequest.setParameters(GNHashtable.builder().addAll(originOperationRequest.parameters).build());
|
|
604
|
-
}
|
|
605
|
-
|
|
606
|
-
let originSecretInfo = request.secretInfo;
|
|
607
|
-
let secretInfo: SecretInfo = null as any;
|
|
608
|
-
if (originSecretInfo) {
|
|
609
|
-
secretInfo = SecretInfo.Builder()
|
|
610
|
-
.setSecretKey(originSecretInfo.secretKey)
|
|
611
|
-
.setRole(originSecretInfo.role)
|
|
612
|
-
.setIsRemove(originSecretInfo.remove)
|
|
613
|
-
.setTsExpire(originSecretInfo.tsExpire)
|
|
614
|
-
.setPermission(originSecretInfo.permission)
|
|
615
|
-
.setGameId(originSecretInfo.gameId)
|
|
616
|
-
.setIsDefault(originSecretInfo.isDefault)
|
|
617
|
-
.setIsOnlyMasterAdmin(originSecretInfo.onlyMasterAdmin)
|
|
618
|
-
.build();
|
|
619
|
-
}
|
|
620
|
-
|
|
621
|
-
if (request.eventType == EventCallbackType.Pre) {
|
|
622
|
-
let functionRequest: FunctionRequest = {
|
|
623
|
-
eventName: request.eventName,
|
|
624
|
-
operationRequest: operationRequest,
|
|
625
|
-
secretInfo: secretInfo,
|
|
626
|
-
request: request.request,
|
|
627
|
-
log(log: any) {
|
|
628
|
-
logs.push(JSON.stringify(log));
|
|
629
|
-
},
|
|
630
|
-
};
|
|
631
|
-
|
|
632
|
-
handleResponse = await ___handlePreFunction(functionRequest);
|
|
633
|
-
} else if (request.eventType == EventCallbackType.Post) {
|
|
634
|
-
let originOperationResponse = request.operationResponse;
|
|
635
|
-
let operationResponse: OperationResponse = null as any;
|
|
636
|
-
|
|
637
|
-
if (originOperationResponse) {
|
|
638
|
-
operationResponse = new OperationResponse(originOperationRequest.operationCode, originOperationRequest.requestId, originOperationRequest.encrypted);
|
|
639
|
-
operationResponse.setReturnCode(originOperationResponse.returnCode);
|
|
640
|
-
operationResponse.setDebugMessage(originOperationResponse.debugMessage);
|
|
641
|
-
|
|
642
|
-
if (originOperationResponse.parameters) {
|
|
643
|
-
operationResponse.setParameters(GNHashtable.builder().addAll(originOperationResponse.parameters).build());
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
|
|
647
|
-
let functionRequest: FunctionRequest = {
|
|
648
|
-
eventName: request.eventName,
|
|
649
|
-
operationRequest: operationRequest,
|
|
650
|
-
operationResponse: operationResponse,
|
|
651
|
-
secretInfo: secretInfo,
|
|
652
|
-
request: request.request,
|
|
653
|
-
log(log: any) {
|
|
654
|
-
logs.push(JSON.stringify(log));
|
|
655
|
-
},
|
|
656
|
-
};
|
|
657
|
-
|
|
658
|
-
handleResponse = await ___handlePostFunction(functionRequest);
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
let endTime = performance.now();
|
|
663
|
-
let endMemoryUsage = process.memoryUsage();
|
|
664
|
-
|
|
665
|
-
let memoryUsedInBytes = endMemoryUsage.heapUsed - startMemoryUsage.heapUsed;
|
|
666
|
-
if (memoryUsedInBytes <= 0) memoryUsedInBytes = 8192;
|
|
667
|
-
let executeTimeInMs = endTime - startTime;
|
|
668
|
-
|
|
669
|
-
//let cost = (memoryUsedInGb * executeTime) / 1000 * 0.022;
|
|
670
|
-
|
|
671
|
-
let response: CloudScriptResponse = {
|
|
672
|
-
responseId: request.requestId,
|
|
673
|
-
response: handleResponse as any,
|
|
674
|
-
stats: {
|
|
675
|
-
executeTimeInMs: executeTimeInMs,
|
|
676
|
-
memoryUsedInBytes: memoryUsedInBytes,
|
|
677
|
-
},
|
|
678
|
-
logs: logs,
|
|
679
|
-
};
|
|
638
|
+
handleResponse = await ___handlePreFunction(functionRequest);
|
|
639
|
+
} else if (request.eventType == EventCallbackType.Post) {
|
|
640
|
+
let originOperationResponse = request.operationResponse;
|
|
641
|
+
let operationResponse: OperationResponse = null as any;
|
|
680
642
|
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
643
|
+
if (originOperationResponse) {
|
|
644
|
+
operationResponse = new OperationResponse(originOperationRequest.operationCode, originOperationRequest.requestId, originOperationRequest.encrypted);
|
|
645
|
+
operationResponse.setReturnCode(originOperationResponse.returnCode);
|
|
646
|
+
operationResponse.setDebugMessage(originOperationResponse.debugMessage);
|
|
647
|
+
|
|
648
|
+
if (originOperationResponse.parameters) {
|
|
649
|
+
operationResponse.setParameters(GNHashtable.builder().addAll(originOperationResponse.parameters).build());
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
let functionRequest: FunctionRequest = {
|
|
654
|
+
eventName: request.eventName,
|
|
655
|
+
operationRequest: operationRequest,
|
|
656
|
+
operationResponse: operationResponse,
|
|
657
|
+
secretInfo: secretInfo,
|
|
658
|
+
request: request.request,
|
|
659
|
+
log(log: any) {
|
|
660
|
+
logs.push(JSON.stringify(log));
|
|
661
|
+
},
|
|
662
|
+
};
|
|
663
|
+
|
|
664
|
+
handleResponse = await ___handlePostFunction(functionRequest);
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
let endTime = performance.now();
|
|
669
|
+
let endMemoryUsage = process.memoryUsage();
|
|
670
|
+
|
|
671
|
+
let memoryUsedInBytes = endMemoryUsage.heapUsed - startMemoryUsage.heapUsed;
|
|
672
|
+
if (memoryUsedInBytes <= 0) memoryUsedInBytes = 8192;
|
|
673
|
+
let executeTimeInMs = endTime - startTime;
|
|
674
|
+
|
|
675
|
+
//let cost = (memoryUsedInGb * executeTime) / 1000 * 0.022;
|
|
676
|
+
|
|
677
|
+
let response: CloudScriptResponse = {
|
|
678
|
+
responseId: request.requestId,
|
|
679
|
+
response: handleResponse as any,
|
|
680
|
+
stats: {
|
|
681
|
+
executeTimeInMs: executeTimeInMs,
|
|
682
|
+
memoryUsedInBytes: memoryUsedInBytes,
|
|
683
|
+
},
|
|
684
|
+
logs: logs,
|
|
685
|
+
};
|
|
686
|
+
|
|
687
|
+
if (process?.send)
|
|
688
|
+
process.send(response);
|
|
689
|
+
});
|
|
684
690
|
|
|
685
691
|
async function ___handleMatchmakingFunction(request: FunctionRequest): Promise<FunctionResponse> {
|
|
686
692
|
let handler = systemMatchmakingHandlers[request.eventName];
|
|
@@ -859,7 +865,7 @@ async function ___handlePostFunction(request: FunctionRequest): Promise<Function
|
|
|
859
865
|
}
|
|
860
866
|
|
|
861
867
|
{
|
|
862
|
-
let gnServerSettingsOptions: GNServerSettingsOptions =
|
|
868
|
+
let gnServerSettingsOptions: GNServerSettingsOptions = JSON.parse(process.env.gnServerSettingsOptions ?? "");
|
|
863
869
|
|
|
864
870
|
let gnServerSettings = new GNServerSettings();
|
|
865
871
|
gnServerSettings.config(gnServerSettingsOptions);
|
|
@@ -876,12 +882,12 @@ const mail = new CloudScriptMail();
|
|
|
876
882
|
const pushNotification = new CloudScriptPushNotification();
|
|
877
883
|
|
|
878
884
|
{
|
|
879
|
-
let dbConnection =
|
|
885
|
+
let dbConnection = JSON.parse(process.env.dbConnection ?? "");
|
|
880
886
|
database.init(dbConnection.url, dbConnection.dbName, dbConnection.options);
|
|
881
887
|
}
|
|
882
888
|
|
|
883
|
-
|
|
884
|
-
|
|
889
|
+
process.env.dbConnection = "";
|
|
890
|
+
process.env.gnServerSettingsOptions = "";
|
|
885
891
|
|
|
886
892
|
const preHandlers: Record<string, (request: any, secretInfo: SecretInfo, operationRequest: OperationRequest, log: (log: any) => void) => Promise<OperationResponse | null>> = {};
|
|
887
893
|
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { IBuilder } from "./../../GN-library/xbuilder/lib/IBuilder";
|
|
2
2
|
declare abstract class BuilderBase {
|
|
3
3
|
protected port: number;
|
|
4
|
+
protected socketPort: number;
|
|
4
5
|
protected useSSL: boolean;
|
|
5
6
|
protected keyFilePath: string;
|
|
6
7
|
protected certFilePath: string;
|
|
7
8
|
protected expiredToken: number;
|
|
8
9
|
protected privateKeyToken: string;
|
|
9
10
|
getPort(): number;
|
|
11
|
+
getSocketPort(): number;
|
|
10
12
|
getUseSSL(): boolean;
|
|
11
13
|
getKeyFilePath(): string;
|
|
12
14
|
getCertFilePath(): string;
|
|
@@ -16,6 +18,7 @@ declare abstract class BuilderBase {
|
|
|
16
18
|
}
|
|
17
19
|
declare class Builder extends BuilderBase implements IBuilder<ApplicationSettings> {
|
|
18
20
|
setPort(port: number): Builder;
|
|
21
|
+
setSocketPort(socketPort: number): Builder;
|
|
19
22
|
setUseSSL(useSSL: boolean): Builder;
|
|
20
23
|
setKeyFilePath(keyFilePath: string): Builder;
|
|
21
24
|
setCertFilePath(certFilePath: string): Builder;
|
package/dist/GNServer.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ export declare class GNServer {
|
|
|
43
43
|
private xDatabase;
|
|
44
44
|
private xMail;
|
|
45
45
|
private xPushNotification;
|
|
46
|
-
private
|
|
46
|
+
private xCacheDataDic;
|
|
47
47
|
private facebookService;
|
|
48
48
|
private genericService;
|
|
49
49
|
private appleService;
|
|
@@ -87,7 +87,8 @@ export declare class GNServer {
|
|
|
87
87
|
getDatabase(): xDatabase;
|
|
88
88
|
getMail(): xMail;
|
|
89
89
|
getPushNotification(): xPushNotification;
|
|
90
|
-
getCacheData(): xCacheData;
|
|
90
|
+
getCacheData(gameId: string): xCacheData;
|
|
91
|
+
setCacheData(gameId: string, cacheData: xCacheData): void;
|
|
91
92
|
getFacebookService(): IFacebookService;
|
|
92
93
|
getGenericService(): IGenericService;
|
|
93
94
|
getPostEventCallbackService(): IPostEventCallbackService;
|
|
@@ -114,6 +115,7 @@ export declare class GNServer {
|
|
|
114
115
|
private handleSocketDisconnect;
|
|
115
116
|
private handleOnRequest;
|
|
116
117
|
private handleMatchmaking;
|
|
118
|
+
private handleRemoveCacheInvalidData;
|
|
117
119
|
private handleMatchmakingForGame;
|
|
118
120
|
private requestMatchServerDetail;
|
|
119
121
|
setMatchServerDetail(gameId: string, matchId: string, serverDetail: ServerDetail, ticketIds: string[]): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -52,6 +52,8 @@ import { InvalidMemberType } from "./GN-common/constant/enumType/InvalidMemberTy
|
|
|
52
52
|
export { InvalidMemberType };
|
|
53
53
|
import { ItemType } from "./GN-common/constant/enumType/ItemType";
|
|
54
54
|
export { ItemType };
|
|
55
|
+
import { StoreItemType } from "./GN-common/constant/enumType/StoreItemType";
|
|
56
|
+
export { StoreItemType };
|
|
55
57
|
import { MatchmakingMemberStatus } from "./GN-common/constant/enumType/MatchmakingMemberStatus";
|
|
56
58
|
export { MatchmakingMemberStatus };
|
|
57
59
|
import { MatchmakingTicketStatus } from "./GN-common/constant/enumType/MatchmakingTicketStatus";
|