cgserver 6.5.7 → 6.6.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/README.md +4 -0
- package/dist/lib/Config/Config.js +20 -10
- package/dist/lib/Config/FrameworkConfig.js +5 -11
- package/dist/lib/Config/ServerConfig.js +6 -4
- package/dist/lib/Database/MSSqlManager.js +5 -5
- package/dist/lib/Database/MongoManager.js +5 -5
- package/dist/lib/Database/MysqlBaseService.js +2 -2
- package/dist/lib/Database/MysqlManager.js +9 -9
- package/dist/lib/Logic/Log.js +4 -4
- package/dist/lib/SocketServer/ISocketServer.js +2 -2
- package/dist/lib/SocketServer/IWebSocket.js +2 -2
- package/dist/lib/ThirdParty/AlipayTool.js +13 -13
- package/dist/lib/ThirdParty/Alisms.js +4 -4
- package/dist/lib/ThirdParty/AppleTool.js +3 -3
- package/dist/lib/ThirdParty/EmailTool.js +7 -7
- package/dist/lib/ThirdParty/OpenSocial.js +5 -5
- package/dist/lib/ThirdParty/QQTool.js +7 -7
- package/dist/lib/ThirdParty/QiniuTool.js +4 -4
- package/dist/lib/ThirdParty/WechatTool.js +4 -4
- package/dist/lib/WebServer/IWebServer.js +2 -2
- package/dist/lib/cgserver.js +13 -0
- package/dist/lib/index.js +2 -3
- package/dist/types/Config/Config.d.ts +4 -0
- package/dist/types/Config/FrameworkConfig.d.ts +3 -8
- package/dist/types/Config/ServerConfig.d.ts +3 -3
- package/dist/types/Logic/Log.d.ts +1 -1
- package/dist/types/cgserver.d.ts +2 -0
- package/dist/types/index.d.ts +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,11 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Config = void 0;
|
|
4
4
|
const fs = require("fs");
|
|
5
5
|
const jsonc_1 = require("jsonc");
|
|
6
|
-
const FrameworkConfig_1 = require("./FrameworkConfig");
|
|
7
6
|
class Config {
|
|
8
7
|
_suffix = "";
|
|
9
8
|
_is_init = false;
|
|
10
9
|
_file_name = "";
|
|
10
|
+
/**
|
|
11
|
+
* 是否是debug调试模式,主要区别于读取数据档,debug默认读取file_d文件,release默认读取file_r文件,如果不存在都会读取file文件
|
|
12
|
+
*/
|
|
13
|
+
static debug = false;
|
|
11
14
|
constructor(filename) {
|
|
12
15
|
this._file_name = filename;
|
|
13
16
|
}
|
|
@@ -15,20 +18,26 @@ class Config {
|
|
|
15
18
|
if (this._is_init) {
|
|
16
19
|
return false;
|
|
17
20
|
}
|
|
18
|
-
|
|
19
|
-
if (
|
|
20
|
-
|
|
21
|
+
let suffix2 = "_r";
|
|
22
|
+
if (Config.debug) {
|
|
23
|
+
suffix2 = "_d";
|
|
21
24
|
}
|
|
22
|
-
let path = "data/" + this._file_name + "_" + this._suffix + ".json";
|
|
25
|
+
let path = "data/" + this._file_name + "_" + this._suffix + suffix2 + ".json";
|
|
23
26
|
path = path.toLowerCase();
|
|
24
27
|
if (!fs.existsSync(path)) {
|
|
25
|
-
|
|
26
|
-
path = "data/" + this._file_name + ".json";
|
|
28
|
+
path = "data/" + this._file_name + "_" + this._suffix + ".json";
|
|
27
29
|
path = path.toLowerCase();
|
|
28
|
-
console.error("try path:" + path);
|
|
29
30
|
if (!fs.existsSync(path)) {
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
path = "data/" + this._file_name + suffix2 + ".json";
|
|
32
|
+
path = path.toLowerCase();
|
|
33
|
+
if (!fs.existsSync(path)) {
|
|
34
|
+
path = "data/" + this._file_name + ".json";
|
|
35
|
+
path = path.toLowerCase();
|
|
36
|
+
if (!fs.existsSync(path)) {
|
|
37
|
+
console.error(path + " not exist!");
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
32
41
|
}
|
|
33
42
|
}
|
|
34
43
|
let content = fs.readFileSync(path).toString();
|
|
@@ -36,6 +45,7 @@ class Config {
|
|
|
36
45
|
for (let key in jsonData) {
|
|
37
46
|
this[key] = jsonData[key];
|
|
38
47
|
}
|
|
48
|
+
console.log("loaded cfg=" + path);
|
|
39
49
|
return true;
|
|
40
50
|
}
|
|
41
51
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FrameworkConfig = exports.
|
|
3
|
+
exports.FrameworkConfig = exports.WebServerConfig = exports.ESessionType = void 0;
|
|
4
4
|
const Log_1 = require("../Logic/Log");
|
|
5
|
-
const
|
|
5
|
+
const Config_1 = require("./Config");
|
|
6
6
|
var ESessionType;
|
|
7
7
|
(function (ESessionType) {
|
|
8
8
|
ESessionType[ESessionType["Cache"] = 0] = "Cache";
|
|
@@ -34,16 +34,11 @@ class WebServerConfig {
|
|
|
34
34
|
cors = null;
|
|
35
35
|
}
|
|
36
36
|
exports.WebServerConfig = WebServerConfig;
|
|
37
|
-
|
|
38
|
-
class FrameworkConfig extends ServerConfig_1.ServerConfig {
|
|
37
|
+
class FrameworkConfig extends Config_1.Config {
|
|
39
38
|
/*
|
|
40
39
|
*-1不输出到console,0,仅错误信息输出到console,1,都输出到console
|
|
41
40
|
*/
|
|
42
41
|
console_level = 0;
|
|
43
|
-
/**
|
|
44
|
-
* 是否是debug调试模式,主要区别于读取数据档,debug默认读取file_d文件,release默认读取file_r文件,如果不存在都会读取file文件
|
|
45
|
-
*/
|
|
46
|
-
debug = false;
|
|
47
42
|
log = {
|
|
48
43
|
appenders: {
|
|
49
44
|
console: {
|
|
@@ -232,13 +227,12 @@ class FrameworkConfig extends ServerConfig_1.ServerConfig {
|
|
|
232
227
|
//key是ip,value是domain
|
|
233
228
|
ip_to_domain = {};
|
|
234
229
|
root_path = process.cwd();
|
|
235
|
-
constructor(
|
|
236
|
-
super(
|
|
230
|
+
constructor() {
|
|
231
|
+
super("FrameworkConfig");
|
|
237
232
|
}
|
|
238
233
|
init() {
|
|
239
234
|
let ret = super.init();
|
|
240
235
|
Log_1.GLog.init(this.log, this.console_level || 0);
|
|
241
|
-
exports.GFCfg = this;
|
|
242
236
|
return ret;
|
|
243
237
|
}
|
|
244
238
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ServerConfig = void 0;
|
|
4
|
-
const
|
|
5
|
-
|
|
3
|
+
exports.ServerConfig = exports.GServerCfg = void 0;
|
|
4
|
+
const FrameworkConfig_1 = require("./FrameworkConfig");
|
|
5
|
+
exports.GServerCfg = null;
|
|
6
|
+
class ServerConfig extends FrameworkConfig_1.FrameworkConfig {
|
|
6
7
|
port = -1;
|
|
7
8
|
_server_name = "";
|
|
8
9
|
webserver = null;
|
|
@@ -10,9 +11,10 @@ class ServerConfig extends Config_1.Config {
|
|
|
10
11
|
return this._server_name;
|
|
11
12
|
}
|
|
12
13
|
constructor(server_name) {
|
|
13
|
-
super(
|
|
14
|
+
super();
|
|
14
15
|
this._suffix = server_name;
|
|
15
16
|
this._server_name = server_name;
|
|
17
|
+
exports.GServerCfg = this;
|
|
16
18
|
}
|
|
17
19
|
}
|
|
18
20
|
exports.ServerConfig = ServerConfig;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GMSSqlMgr = exports.MssqlReturn = void 0;
|
|
4
4
|
const mssql = require("mssql");
|
|
5
|
-
const
|
|
5
|
+
const ServerConfig_1 = require("../Config/ServerConfig");
|
|
6
6
|
const DBCache_1 = require("./Decorator/DBCache");
|
|
7
7
|
class MssqlReturn {
|
|
8
8
|
error = null;
|
|
@@ -24,12 +24,12 @@ class MSSqlManager {
|
|
|
24
24
|
}
|
|
25
25
|
async init() {
|
|
26
26
|
if (this._pool
|
|
27
|
-
|| !
|
|
28
|
-
|| !
|
|
27
|
+
|| !ServerConfig_1.GServerCfg.db.mssql
|
|
28
|
+
|| !ServerConfig_1.GServerCfg.db.mssql.open) {
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
|
-
this._pool = await mssql.connect(
|
|
32
|
-
console.log("mssql config=" + JSON.stringify(
|
|
31
|
+
this._pool = await mssql.connect(ServerConfig_1.GServerCfg.db.mssql);
|
|
32
|
+
console.log("mssql config=" + JSON.stringify(ServerConfig_1.GServerCfg.db.mssql));
|
|
33
33
|
//这个的初始化位置不能变,必须位于cbs前,pool后
|
|
34
34
|
await DBCache_1.GDBCache.init();
|
|
35
35
|
for (let i = 0; i < this._init_cbs.length; ++i) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GMongoMgr = exports.MgReturn = exports.MrResult = exports.MongoBaseModel = void 0;
|
|
4
|
-
const FrameworkConfig_1 = require("../Config/FrameworkConfig");
|
|
5
4
|
const Log_1 = require("../Logic/Log");
|
|
6
5
|
const mongo = require("mongodb");
|
|
7
6
|
const _error_1 = require("../Config/_error_");
|
|
8
7
|
const Core_1 = require("../Core/Core");
|
|
8
|
+
const ServerConfig_1 = require("../Config/ServerConfig");
|
|
9
9
|
class MongoBaseModel {
|
|
10
10
|
_id;
|
|
11
11
|
}
|
|
@@ -57,15 +57,15 @@ class MongoManager {
|
|
|
57
57
|
if (this._mongo) {
|
|
58
58
|
return true;
|
|
59
59
|
}
|
|
60
|
-
if (!
|
|
60
|
+
if (!ServerConfig_1.GServerCfg.db.mongo || !ServerConfig_1.GServerCfg.db.mongo.open) {
|
|
61
61
|
return true;
|
|
62
62
|
}
|
|
63
63
|
this._inited = true;
|
|
64
|
-
Log_1.GLog.info("mongo config=" + JSON.stringify(
|
|
65
|
-
let client = new mongo.MongoClient("mongodb://" +
|
|
64
|
+
Log_1.GLog.info("mongo config=" + JSON.stringify(ServerConfig_1.GServerCfg.db.mongo));
|
|
65
|
+
let client = new mongo.MongoClient("mongodb://" + ServerConfig_1.GServerCfg.db.mongo.host + ":" + ServerConfig_1.GServerCfg.db.mongo.port, ServerConfig_1.GServerCfg.db.mongo.options);
|
|
66
66
|
await client.connect();
|
|
67
67
|
this.onConnect();
|
|
68
|
-
this._mongo = client.db(
|
|
68
|
+
this._mongo = client.db(ServerConfig_1.GServerCfg.db.mongo.database);
|
|
69
69
|
for (let i = 0; i < this._init_cbs.length; ++i) {
|
|
70
70
|
this._init_cbs[i]();
|
|
71
71
|
}
|
|
@@ -5,7 +5,7 @@ const Property_1 = require("./Decorator/Property");
|
|
|
5
5
|
const MysqlManager_1 = require("./MysqlManager");
|
|
6
6
|
const Log_1 = require("../Logic/Log");
|
|
7
7
|
const DBCache_1 = require("./Decorator/DBCache");
|
|
8
|
-
const
|
|
8
|
+
const ServerConfig_1 = require("../Config/ServerConfig");
|
|
9
9
|
class BaseModel {
|
|
10
10
|
}
|
|
11
11
|
exports.BaseModel = BaseModel;
|
|
@@ -42,7 +42,7 @@ class MysqlBaseService {
|
|
|
42
42
|
throw new Error("数据表的类必须要具有Table装饰器");
|
|
43
43
|
}
|
|
44
44
|
this._table = "`" + table.table + "`";
|
|
45
|
-
if (!
|
|
45
|
+
if (!ServerConfig_1.GServerCfg.db.mysql.auto) {
|
|
46
46
|
//未开启自动创建数据表
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.GMysqlMgr = exports.SqlReturns = exports.SqlReturn = exports.SqlResult = void 0;
|
|
4
4
|
const _error_1 = require("./../Config/_error_");
|
|
5
5
|
const Log_1 = require("../Logic/Log");
|
|
6
|
-
const FrameworkConfig_1 = require("../Config/FrameworkConfig");
|
|
7
6
|
const mysql = require("mysql");
|
|
8
7
|
class SqlResult {
|
|
9
8
|
/**
|
|
@@ -48,22 +47,22 @@ class MysqlManager {
|
|
|
48
47
|
async init() {
|
|
49
48
|
return new Promise(async (resolve) => {
|
|
50
49
|
if (this._pool
|
|
51
|
-
|| !
|
|
52
|
-
|| !
|
|
50
|
+
|| !ServerConfig_1.GServerCfg.db.mysql
|
|
51
|
+
|| !ServerConfig_1.GServerCfg.db.mysql.open) {
|
|
53
52
|
resolve(null);
|
|
54
53
|
return;
|
|
55
54
|
}
|
|
56
55
|
this._pool = mysql.createPool({
|
|
57
56
|
connectionLimit: 100,
|
|
58
|
-
host:
|
|
59
|
-
port:
|
|
60
|
-
user:
|
|
61
|
-
password:
|
|
62
|
-
database:
|
|
57
|
+
host: ServerConfig_1.GServerCfg.db.mysql.host,
|
|
58
|
+
port: ServerConfig_1.GServerCfg.db.mysql.port,
|
|
59
|
+
user: ServerConfig_1.GServerCfg.db.mysql.user,
|
|
60
|
+
password: ServerConfig_1.GServerCfg.db.mysql.password,
|
|
61
|
+
database: ServerConfig_1.GServerCfg.db.mysql.database,
|
|
63
62
|
supportBigNumbers: true,
|
|
64
63
|
charset: "utf8mb4"
|
|
65
64
|
});
|
|
66
|
-
console.log("mysql config=" + JSON.stringify(
|
|
65
|
+
console.log("mysql config=" + JSON.stringify(ServerConfig_1.GServerCfg.db.mysql));
|
|
67
66
|
//这个的初始化位置不能变,必须位于cbs前,pool后
|
|
68
67
|
await DBCache_1.GDBCache.init();
|
|
69
68
|
resolve(null);
|
|
@@ -178,3 +177,4 @@ class MysqlManager {
|
|
|
178
177
|
exports.GMysqlMgr = new MysqlManager();
|
|
179
178
|
//该import必须放在GMysqlMgr实例化之后,否则version基类找不到GMysqlMgr
|
|
180
179
|
const DBCache_1 = require("./Decorator/DBCache");
|
|
180
|
+
const ServerConfig_1 = require("../Config/ServerConfig");
|
package/dist/lib/Logic/Log.js
CHANGED
|
@@ -95,15 +95,15 @@ class Log {
|
|
|
95
95
|
_isNumber(param) {
|
|
96
96
|
return typeof (param) === "number";
|
|
97
97
|
}
|
|
98
|
-
_format
|
|
99
|
-
if (this.
|
|
98
|
+
_format(src, formatStr) {
|
|
99
|
+
if (this._isString(src)) {
|
|
100
100
|
let args = Array.prototype.slice.call(arguments, 1);
|
|
101
101
|
return src.replace(/\{(\d+)\}/g, function (m, i) {
|
|
102
102
|
return args[i];
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
105
|
else {
|
|
106
|
-
if (this.
|
|
106
|
+
if (this._isNumber(src)) {
|
|
107
107
|
src = new Date(src);
|
|
108
108
|
}
|
|
109
109
|
let str = formatStr;
|
|
@@ -130,6 +130,6 @@ class Log {
|
|
|
130
130
|
str = str.replace(/s|S/g, sec);
|
|
131
131
|
return str;
|
|
132
132
|
}
|
|
133
|
-
}
|
|
133
|
+
}
|
|
134
134
|
}
|
|
135
135
|
exports.GLog = new Log();
|
|
@@ -8,10 +8,10 @@ const Log_1 = require("./../Logic/Log");
|
|
|
8
8
|
const fs = require("fs");
|
|
9
9
|
const http = require("http");
|
|
10
10
|
const https = require("https");
|
|
11
|
-
const FrameworkConfig_1 = require("../Config/FrameworkConfig");
|
|
12
11
|
const MongoManager_1 = require("../Database/MongoManager");
|
|
13
12
|
const MSSqlManager_1 = require("../Database/MSSqlManager");
|
|
14
13
|
const EventTool_1 = require("../Logic/EventTool");
|
|
14
|
+
const ServerConfig_1 = require("../Config/ServerConfig");
|
|
15
15
|
class ISocketServer {
|
|
16
16
|
//服务器已被关闭
|
|
17
17
|
_is_closed = false;
|
|
@@ -71,7 +71,7 @@ class ISocketServer {
|
|
|
71
71
|
async run() {
|
|
72
72
|
await MSSqlManager_1.GMSSqlMgr.init();
|
|
73
73
|
await MysqlManager_1.GMysqlMgr.init();
|
|
74
|
-
await RedisManager_1.GRedisMgr.init(
|
|
74
|
+
await RedisManager_1.GRedisMgr.init(ServerConfig_1.GServerCfg.db.redis);
|
|
75
75
|
await MongoManager_1.GMongoMgr.init();
|
|
76
76
|
let code = await RedisManager_1.GRedisMgr.incr("server_code");
|
|
77
77
|
this._code = code;
|
|
@@ -5,8 +5,8 @@ const Log_1 = require("../Logic/Log");
|
|
|
5
5
|
const ProtoFactory_1 = require("./ProtoFilter/ProtoFactory");
|
|
6
6
|
const IProtoFilter_1 = require("./ProtoFilter/IProtoFilter");
|
|
7
7
|
const Core_1 = require("../Core/Core");
|
|
8
|
-
const FrameworkConfig_1 = require("../Config/FrameworkConfig");
|
|
9
8
|
const _ = require("underscore");
|
|
9
|
+
const ServerConfig_1 = require("../Config/ServerConfig");
|
|
10
10
|
let WebSocketIdMgr = {
|
|
11
11
|
id: _.random(0, 99999999),
|
|
12
12
|
getNewID() {
|
|
@@ -53,7 +53,7 @@ class IWebSocket {
|
|
|
53
53
|
return false;
|
|
54
54
|
}
|
|
55
55
|
constructor(protoType = IProtoFilter_1.EProtoType.Json, protoPath = "") {
|
|
56
|
-
this._debug_msg =
|
|
56
|
+
this._debug_msg = ServerConfig_1.GServerCfg.debug_msg;
|
|
57
57
|
this._socket_id = WebSocketIdMgr.getNewID();
|
|
58
58
|
this._protoType = protoType;
|
|
59
59
|
this._protoPath = protoPath;
|
|
@@ -5,9 +5,9 @@ const alipay_sdk_1 = require("alipay-sdk");
|
|
|
5
5
|
const aliUtil = require("alipay-sdk/lib/util");
|
|
6
6
|
const AliPayUtil_1 = require("alipay_sdk2/AliPayUtil");
|
|
7
7
|
const fs = require("fs");
|
|
8
|
-
const FrameworkConfig_1 = require("../Config/FrameworkConfig");
|
|
9
8
|
const form_1 = require("alipay-sdk/lib/form");
|
|
10
9
|
const Log_1 = require("../Logic/Log");
|
|
10
|
+
const ServerConfig_1 = require("../Config/ServerConfig");
|
|
11
11
|
class AlipayResult {
|
|
12
12
|
alipay_trade_app_pay_response = {
|
|
13
13
|
code: "10000",
|
|
@@ -71,26 +71,26 @@ class AlipayTool {
|
|
|
71
71
|
notify_url: ""
|
|
72
72
|
};
|
|
73
73
|
init() {
|
|
74
|
-
if (!
|
|
75
|
-
|| !
|
|
74
|
+
if (!ServerConfig_1.GServerCfg.third_cfg.alipay
|
|
75
|
+
|| !ServerConfig_1.GServerCfg.third_cfg.alipay.open) {
|
|
76
76
|
return false;
|
|
77
77
|
}
|
|
78
78
|
let suffix = "";
|
|
79
|
-
if (
|
|
79
|
+
if (ServerConfig_1.GServerCfg.third_cfg.alipay.dev) {
|
|
80
80
|
suffix = "_dev";
|
|
81
81
|
}
|
|
82
82
|
this._cfg = {
|
|
83
|
-
app_id:
|
|
84
|
-
app_key:
|
|
85
|
-
gateway:
|
|
83
|
+
app_id: ServerConfig_1.GServerCfg.third_cfg.alipay["app_id" + suffix],
|
|
84
|
+
app_key: ServerConfig_1.GServerCfg.third_cfg.alipay["app_key" + suffix],
|
|
85
|
+
gateway: ServerConfig_1.GServerCfg.third_cfg.alipay["gateway" + suffix],
|
|
86
86
|
//RSA1 RSA2
|
|
87
|
-
signType:
|
|
87
|
+
signType: ServerConfig_1.GServerCfg.third_cfg.alipay["signType" + suffix],
|
|
88
88
|
/** 指定private key类型, 默认: PKCS1, PKCS8: PRIVATE KEY, PKCS1: RSA PRIVATE KEY */
|
|
89
|
-
keyType:
|
|
90
|
-
alipay_root_cert_sn:
|
|
91
|
-
alipay_cert_sn:
|
|
92
|
-
app_cert_sn:
|
|
93
|
-
notify_url:
|
|
89
|
+
keyType: ServerConfig_1.GServerCfg.third_cfg.alipay["signType" + suffix],
|
|
90
|
+
alipay_root_cert_sn: ServerConfig_1.GServerCfg.third_cfg.alipay["alipay_root_cert_sn" + suffix],
|
|
91
|
+
alipay_cert_sn: ServerConfig_1.GServerCfg.third_cfg.alipay["alipay_cert_sn" + suffix],
|
|
92
|
+
app_cert_sn: ServerConfig_1.GServerCfg.third_cfg.alipay["app_cert_sn" + suffix],
|
|
93
|
+
notify_url: ServerConfig_1.GServerCfg.third_cfg.alipay["notify_url" + suffix]
|
|
94
94
|
};
|
|
95
95
|
if (this._cfg.alipay_cert_sn) {
|
|
96
96
|
this._aliPay = new AliPayUtil_1.AliPayUtil(this._cfg.alipay_cert_sn, this._cfg.app_key);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GSmsTool = void 0;
|
|
4
|
+
const ServerConfig_1 = require("../Config/ServerConfig");
|
|
4
5
|
const Log_1 = require("./../Logic/Log");
|
|
5
6
|
let SMSClient = require("@alicloud/sms-sdk");
|
|
6
|
-
const FrameworkConfig_1 = require("../Config/FrameworkConfig");
|
|
7
7
|
exports.GSmsTool = null;
|
|
8
8
|
class SMSTool {
|
|
9
9
|
_is_init = false;
|
|
@@ -13,7 +13,7 @@ class SMSTool {
|
|
|
13
13
|
return true;
|
|
14
14
|
}
|
|
15
15
|
this._is_init = true;
|
|
16
|
-
this._sms_client = new SMSClient({ accessKeyId:
|
|
16
|
+
this._sms_client = new SMSClient({ accessKeyId: ServerConfig_1.GServerCfg.third_cfg.aliSms.accessKeyId, secretAccessKey: ServerConfig_1.GServerCfg.third_cfg.aliSms.secretAccessKey });
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
19
|
* 发送短信验证码
|
|
@@ -25,8 +25,8 @@ class SMSTool {
|
|
|
25
25
|
return new Promise((resolve, reject) => {
|
|
26
26
|
this._sms_client.sendSMS({
|
|
27
27
|
PhoneNumbers: phone,
|
|
28
|
-
SignName:
|
|
29
|
-
TemplateCode:
|
|
28
|
+
SignName: ServerConfig_1.GServerCfg.third_cfg.aliSms.signName,
|
|
29
|
+
TemplateCode: ServerConfig_1.GServerCfg.third_cfg.aliSms.templateCode,
|
|
30
30
|
TemplateParam: JSON.stringify({ code: code })
|
|
31
31
|
}).then((res) => {
|
|
32
32
|
if (res.Code == "OK") {
|
|
@@ -5,8 +5,8 @@ const Log_1 = require("../Logic/Log");
|
|
|
5
5
|
const HttpTool_1 = require("./../Logic/HttpTool");
|
|
6
6
|
const ec_key_1 = require("ec-key");
|
|
7
7
|
const uuid_1 = require("uuid");
|
|
8
|
-
const FrameworkConfig_1 = require("../Config/FrameworkConfig");
|
|
9
8
|
const fs = require("fs");
|
|
9
|
+
const ServerConfig_1 = require("../Config/ServerConfig");
|
|
10
10
|
//developer.apple.com/documentation/appstorereceipts/responsebody
|
|
11
11
|
class ReceiptInfo {
|
|
12
12
|
cancellation_date = "";
|
|
@@ -187,7 +187,7 @@ class AppleTool {
|
|
|
187
187
|
}
|
|
188
188
|
signature(nickname, create_time, appBundleID, productIdentifier, offerIdentifier) {
|
|
189
189
|
let keyIdentifier = "";
|
|
190
|
-
for (var k in
|
|
190
|
+
for (var k in ServerConfig_1.GServerCfg.third_cfg.apple.keyIds) {
|
|
191
191
|
keyIdentifier = k;
|
|
192
192
|
break;
|
|
193
193
|
}
|
|
@@ -200,7 +200,7 @@ class AppleTool {
|
|
|
200
200
|
nonce.toLowerCase() + '\u2063' +
|
|
201
201
|
create_time;
|
|
202
202
|
// Get the PEM-formatted private key string associated with the Key ID.
|
|
203
|
-
const path =
|
|
203
|
+
const path = ServerConfig_1.GServerCfg.third_cfg.apple.keyIds[keyIdentifier];
|
|
204
204
|
const keyString = fs.readFileSync(path).toString();
|
|
205
205
|
// Create an Elliptic Curve Digital Signature Algorithm (ECDSA) object using the private key.
|
|
206
206
|
const key = new ec_key_1.default(keyString, 'pem');
|
|
@@ -2,23 +2,23 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GEmailTool = void 0;
|
|
4
4
|
const nodeMailer = require("nodemailer");
|
|
5
|
+
const ServerConfig_1 = require("../Config/ServerConfig");
|
|
5
6
|
const Log_1 = require("../Logic/Log");
|
|
6
|
-
const FrameworkConfig_1 = require("../Config/FrameworkConfig");
|
|
7
7
|
exports.GEmailTool = null;
|
|
8
8
|
class EmailTool {
|
|
9
9
|
send(to, subject, html) {
|
|
10
10
|
return new Promise((resolve, reject) => {
|
|
11
11
|
let transport = nodeMailer.createTransport({
|
|
12
|
-
host:
|
|
13
|
-
port:
|
|
14
|
-
secure:
|
|
12
|
+
host: ServerConfig_1.GServerCfg.third_cfg.email.host,
|
|
13
|
+
port: ServerConfig_1.GServerCfg.third_cfg.email.port,
|
|
14
|
+
secure: ServerConfig_1.GServerCfg.third_cfg.email.secure,
|
|
15
15
|
auth: {
|
|
16
|
-
user:
|
|
17
|
-
pass:
|
|
16
|
+
user: ServerConfig_1.GServerCfg.third_cfg.email.auth.user,
|
|
17
|
+
pass: ServerConfig_1.GServerCfg.third_cfg.email.auth.pass
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
20
|
let mail = {
|
|
21
|
-
from:
|
|
21
|
+
from: ServerConfig_1.GServerCfg.third_cfg.email.from,
|
|
22
22
|
to: to,
|
|
23
23
|
subject: subject,
|
|
24
24
|
html: html
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GOpenSocial = void 0;
|
|
4
|
+
const ServerConfig_1 = require("../Config/ServerConfig");
|
|
4
5
|
const HttpTool_1 = require("../Logic/HttpTool");
|
|
5
|
-
const FrameworkConfig_1 = require("../Config/FrameworkConfig");
|
|
6
6
|
exports.GOpenSocial = null;
|
|
7
7
|
class OpenSocial {
|
|
8
8
|
_getNewMsg() {
|
|
9
9
|
return {
|
|
10
|
-
app_id:
|
|
11
|
-
app_secret:
|
|
10
|
+
app_id: ServerConfig_1.GServerCfg.third_cfg.open_social.app_id,
|
|
11
|
+
app_secret: ServerConfig_1.GServerCfg.third_cfg.open_social.app_secret
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
14
|
async getUser(unionid, openid) {
|
|
@@ -16,7 +16,7 @@ class OpenSocial {
|
|
|
16
16
|
unionid: unionid,
|
|
17
17
|
openid: openid
|
|
18
18
|
};
|
|
19
|
-
let rs = await HttpTool_1.GHttpTool.httpPost(
|
|
19
|
+
let rs = await HttpTool_1.GHttpTool.httpPost(ServerConfig_1.GServerCfg.third_cfg.open_social.user_url, msg);
|
|
20
20
|
return rs.body;
|
|
21
21
|
}
|
|
22
22
|
async updatePwd(unionid, openid, new_pwd) {
|
|
@@ -25,7 +25,7 @@ class OpenSocial {
|
|
|
25
25
|
openid: openid,
|
|
26
26
|
password: new_pwd
|
|
27
27
|
};
|
|
28
|
-
let jsonData = await HttpTool_1.GHttpTool.httpPost(
|
|
28
|
+
let jsonData = await HttpTool_1.GHttpTool.httpPost(ServerConfig_1.GServerCfg.third_cfg.open_social.update_pwd_url, msg);
|
|
29
29
|
return jsonData.body || jsonData.error;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.QQTool = exports.GQQTool = exports.QQUserInfo = void 0;
|
|
4
4
|
const _ = require("underscore");
|
|
5
5
|
const URLEncode = require("urlencode");
|
|
6
|
+
const ServerConfig_1 = require("../Config/ServerConfig");
|
|
6
7
|
const HttpTool_1 = require("../Logic/HttpTool");
|
|
7
|
-
const FrameworkConfig_1 = require("../Config/FrameworkConfig");
|
|
8
8
|
const Log_1 = require("../Logic/Log");
|
|
9
9
|
class QQUserInfo {
|
|
10
10
|
ret = 0;
|
|
@@ -45,9 +45,9 @@ class QQTool {
|
|
|
45
45
|
*/
|
|
46
46
|
getAuthCodeUrl(scope, display) {
|
|
47
47
|
//必须 成功授权后的回调地址,必须是注册appid时填写的主域名下的地址,建议设置为网站首页或网站的用户中心
|
|
48
|
-
let redirect_uri = URLEncode.encode(
|
|
48
|
+
let redirect_uri = URLEncode.encode(ServerConfig_1.GServerCfg.third_cfg.qq.redirect_uri);
|
|
49
49
|
//必须 申请QQ登录成功后,分配给应用的appid。
|
|
50
|
-
let client_id =
|
|
50
|
+
let client_id = ServerConfig_1.GServerCfg.third_cfg.qq.app_id;
|
|
51
51
|
//必须 授权类型,此值固定为“code”。
|
|
52
52
|
let response_type = "code";
|
|
53
53
|
//必须 client端的状态值。用于第三方应用防止CSRF攻击,成功授权后回调时会原样带回。请务必严格按照流程检查用户与state参数状态的绑定。
|
|
@@ -69,11 +69,11 @@ class QQTool {
|
|
|
69
69
|
//必须 授权类型,在本步骤中,此值为“authorization_code”。
|
|
70
70
|
let grant_type = "authorization_code";
|
|
71
71
|
//必须 申请QQ登录成功后,分配给应用的appid。
|
|
72
|
-
let client_id =
|
|
72
|
+
let client_id = ServerConfig_1.GServerCfg.third_cfg.qq.app_id;
|
|
73
73
|
//必须 申请QQ登录成功后,分配给网站的appkey。
|
|
74
|
-
let client_secret =
|
|
74
|
+
let client_secret = ServerConfig_1.GServerCfg.third_cfg.qq.app_key;
|
|
75
75
|
//必须 成功授权后的回调地址,必须是注册appid时填写的主域名下的地址,建议设置为网站首页或网站的用户中心
|
|
76
|
-
let redirect_uri = URLEncode.encode(
|
|
76
|
+
let redirect_uri = URLEncode.encode(ServerConfig_1.GServerCfg.third_cfg.qq.redirect_uri);
|
|
77
77
|
let url = "https://graph.qq.com/oauth2.0/token?code=" + auth_code + "&grant_type=" + grant_type + "&client_id=" + client_id + "&client_secret=" + client_secret + "&redirect_uri=" + redirect_uri;
|
|
78
78
|
let rs = await HttpTool_1.GHttpTool.httpRequest(url);
|
|
79
79
|
if (rs.body && rs.body.access_token) {
|
|
@@ -103,7 +103,7 @@ class QQTool {
|
|
|
103
103
|
return null;
|
|
104
104
|
}
|
|
105
105
|
async getUserInfo(access_token, openid) {
|
|
106
|
-
let url = "https://graph.qq.com/user/get_user_info?access_token=" + access_token + "&oauth_consumer_key=" +
|
|
106
|
+
let url = "https://graph.qq.com/user/get_user_info?access_token=" + access_token + "&oauth_consumer_key=" + ServerConfig_1.GServerCfg.third_cfg.qq.app_id + "&openid=" + openid;
|
|
107
107
|
let rs = await HttpTool_1.GHttpTool.httpRequest(url);
|
|
108
108
|
if (rs.body) {
|
|
109
109
|
return rs.body;
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GQiniuTool = void 0;
|
|
4
4
|
const qiniu = require("qiniu");
|
|
5
|
-
const
|
|
5
|
+
const ServerConfig_1 = require("../Config/ServerConfig");
|
|
6
6
|
exports.GQiniuTool = null;
|
|
7
7
|
class QiniuTool {
|
|
8
8
|
get host() {
|
|
9
|
-
return
|
|
9
|
+
return ServerConfig_1.GServerCfg.third_cfg.qiniu.host;
|
|
10
10
|
}
|
|
11
11
|
getUploadToken(filename) {
|
|
12
|
-
let mac = new qiniu.auth.digest.Mac(
|
|
12
|
+
let mac = new qiniu.auth.digest.Mac(ServerConfig_1.GServerCfg.third_cfg.qiniu.accessKey, ServerConfig_1.GServerCfg.third_cfg.qiniu.secretKey);
|
|
13
13
|
let options = {
|
|
14
|
-
scope:
|
|
14
|
+
scope: ServerConfig_1.GServerCfg.third_cfg.qiniu.bucket + ":" + filename,
|
|
15
15
|
};
|
|
16
16
|
let putPolicy = new qiniu.rs.PutPolicy(options);
|
|
17
17
|
let uploadToken = putPolicy.uploadToken(mac);
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.WechatTool = exports.GWechatTool = exports.WechatUserInfo = void 0;
|
|
4
4
|
const _ = require("underscore");
|
|
5
5
|
const URLEncode = require("urlencode");
|
|
6
|
+
const ServerConfig_1 = require("../Config/ServerConfig");
|
|
6
7
|
const HttpTool_1 = require("../Logic/HttpTool");
|
|
7
|
-
const FrameworkConfig_1 = require("../Config/FrameworkConfig");
|
|
8
8
|
const Log_1 = require("../Logic/Log");
|
|
9
9
|
class WechatUserInfo {
|
|
10
10
|
openid = "OPENID";
|
|
@@ -28,8 +28,8 @@ class WechatTool {
|
|
|
28
28
|
*/
|
|
29
29
|
getAuthCodeUrl() {
|
|
30
30
|
let appid = "wx80f0f10fe1304e9d";
|
|
31
|
-
let url = "https://open.weixin.qq.com/connect/qrconnect?appid=" +
|
|
32
|
-
url += "&redirect_uri=" + URLEncode.encode(
|
|
31
|
+
let url = "https://open.weixin.qq.com/connect/qrconnect?appid=" + ServerConfig_1.GServerCfg.third_cfg.wechat.app_id;
|
|
32
|
+
url += "&redirect_uri=" + URLEncode.encode(ServerConfig_1.GServerCfg.third_cfg.wechat.redirect_uri);
|
|
33
33
|
url += "&response_type=code&scope=snsapi_login";
|
|
34
34
|
//必须 client端的状态值。用于第三方应用防止CSRF攻击,成功授权后回调时会原样带回。请务必严格按照流程检查用户与state参数状态的绑定。
|
|
35
35
|
let state = _.random(1000000, 9999999);
|
|
@@ -40,7 +40,7 @@ class WechatTool {
|
|
|
40
40
|
if (!auth_code) {
|
|
41
41
|
return null;
|
|
42
42
|
}
|
|
43
|
-
let url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=" +
|
|
43
|
+
let url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=" + ServerConfig_1.GServerCfg.third_cfg.wechat.app_id + "&secret=" + ServerConfig_1.GServerCfg.third_cfg.wechat.app_key + "&code=" + auth_code + "&grant_type=authorization_code";
|
|
44
44
|
let rs = await HttpTool_1.GHttpTool.httpRequest(url);
|
|
45
45
|
/*
|
|
46
46
|
{
|
|
@@ -5,10 +5,10 @@ const Engine_1 = require("./Engine/Engine");
|
|
|
5
5
|
const Log_1 = require("../Logic/Log");
|
|
6
6
|
const RedisManager_1 = require("../Database/RedisManager");
|
|
7
7
|
const MysqlManager_1 = require("../Database/MysqlManager");
|
|
8
|
-
const FrameworkConfig_1 = require("../Config/FrameworkConfig");
|
|
9
8
|
const RazorJs_1 = require("./Engine/RazorJs");
|
|
10
9
|
const MongoManager_1 = require("../Database/MongoManager");
|
|
11
10
|
const AlipayTool_1 = require("../ThirdParty/AlipayTool");
|
|
11
|
+
const ServerConfig_1 = require("../Config/ServerConfig");
|
|
12
12
|
//实现对controller的手动注册
|
|
13
13
|
class IWebServer {
|
|
14
14
|
_engine = null;
|
|
@@ -21,7 +21,7 @@ class IWebServer {
|
|
|
21
21
|
Log_1.GLog.error("webserver 配置不存在,启动服务器失败");
|
|
22
22
|
return false;
|
|
23
23
|
}
|
|
24
|
-
await RedisManager_1.GRedisMgr.init(
|
|
24
|
+
await RedisManager_1.GRedisMgr.init(ServerConfig_1.GServerCfg.db.redis);
|
|
25
25
|
await MysqlManager_1.GMysqlMgr.init();
|
|
26
26
|
await MongoManager_1.GMongoMgr.init();
|
|
27
27
|
AlipayTool_1.GAlipayTool.init();
|
package/dist/lib/cgserver.js
CHANGED
|
@@ -4,8 +4,13 @@ exports.GCgServer = void 0;
|
|
|
4
4
|
const Log_1 = require("./Logic/Log");
|
|
5
5
|
const EventTool_1 = require("./Logic/EventTool");
|
|
6
6
|
const Core_1 = require("./Core/Core");
|
|
7
|
+
const Config_1 = require("./Config/Config");
|
|
7
8
|
class CgServer {
|
|
8
9
|
_events = {};
|
|
10
|
+
_debug = false;
|
|
11
|
+
get debug() {
|
|
12
|
+
return this._debug;
|
|
13
|
+
}
|
|
9
14
|
constructor() {
|
|
10
15
|
this.init();
|
|
11
16
|
}
|
|
@@ -13,6 +18,14 @@ class CgServer {
|
|
|
13
18
|
process.on("uncaughtException", this.onUnCaughtException.bind(this));
|
|
14
19
|
process.env.TZ = "Asia/Shanghai";
|
|
15
20
|
EventTool_1.GEventTool.on("socket_server_init_done", this.onStart.bind(this));
|
|
21
|
+
let argv = process.argv || [];
|
|
22
|
+
for (let i = 0; i < argv.length; ++i) {
|
|
23
|
+
let arg = argv[i].toLowerCase();
|
|
24
|
+
if (arg == "-d" || arg == "-debug") {
|
|
25
|
+
Config_1.Config.debug = true;
|
|
26
|
+
this._debug = true;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
16
29
|
}
|
|
17
30
|
onStart() {
|
|
18
31
|
let events = this._events["start"] || [];
|
package/dist/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GoogleProtoFilter = exports.MongoCacheModel = exports.GMongoCacheSer = exports.MongoUserModel = exports.MysqlUserModel = exports.MongoUserService = exports.MysqlUserService = exports.GMongoAccountSer = exports.MongoAccountService = exports.GMysqlAccountSer = exports.MysqlAccountService = exports.EAccountFrom = exports.EUserState = exports.ERoleGroup = exports.GLog = exports.GHttpTool = exports.GCacheTool = exports.RedisManager = exports.GRedisMgr = exports.GMysqlMgr = exports.MysqlBaseService = exports.GMSSqlMgr = exports.GMongoMgr = exports.MongoBaseModel = exports.MysqlBaseModel = exports.MongoBaseService = exports.EPropertyType = exports.Type = exports.Table = exports.Property = exports.PrimaryKey = exports.NotNull = exports.AutoIncrement = exports.Timer = exports.core = exports.
|
|
3
|
+
exports.GoogleProtoFilter = exports.MongoCacheModel = exports.GMongoCacheSer = exports.MongoUserModel = exports.MysqlUserModel = exports.MongoUserService = exports.MysqlUserService = exports.GMongoAccountSer = exports.MongoAccountService = exports.GMysqlAccountSer = exports.MysqlAccountService = exports.EAccountFrom = exports.EUserState = exports.ERoleGroup = exports.GLog = exports.GHttpTool = exports.GCacheTool = exports.RedisManager = exports.GRedisMgr = exports.GMysqlMgr = exports.MysqlBaseService = exports.GMSSqlMgr = exports.GMongoMgr = exports.MongoBaseModel = exports.MysqlBaseModel = exports.MongoBaseService = exports.EPropertyType = exports.Type = exports.Table = exports.Property = exports.PrimaryKey = exports.NotNull = exports.AutoIncrement = exports.Timer = exports.core = exports.GServerCfg = exports.ServerConfig = exports.FrameworkConfig = exports.Config = exports.FrameworkErrorCode = exports.GTriggerMgr = exports.Trigger = exports.Point = exports.Entity = exports.BehaviorAI = exports.AStar = exports.AiObject = exports.GDBCache = exports.GProtoFactory = exports.GCgServer = void 0;
|
|
4
4
|
exports.EAccountState = exports.GEventTool = exports.GAsyncQueueTool = exports.WebServerConfig = exports.Response = exports.Request = exports.RazorJs = exports.Engine = exports.GCtrMgr = exports.JsonCreatorValidate = exports.JsonAuthorityValidate = exports.JsonAdminValidate = exports.CreatorValidate = exports.AuthorityValidate = exports.AdminValidate = exports.MongoAccountModel = exports.MysqlAccountModel = exports.MongoBaseUserController = exports.BaseUserController = exports.BaseController = exports.IWebServer = exports.GWechatTool = exports.GWechatOATool = exports.GQQTool = exports.GQiniuTool = exports.GOpenSocial = exports.GEmailTool = exports.GAppleTool = exports.GSmsTool = exports.GAlipayTool = exports.IWebSocket = exports.ISocketServer = exports.IServerWebSocket = exports.IClientWebSocket = exports.JsonProtoFilter = void 0;
|
|
5
5
|
var cgserver_1 = require("./cgserver");
|
|
6
6
|
Object.defineProperty(exports, "GCgServer", { enumerable: true, get: function () { return cgserver_1.GCgServer; } });
|
|
@@ -27,10 +27,9 @@ var Config_1 = require("./Config/Config");
|
|
|
27
27
|
Object.defineProperty(exports, "Config", { enumerable: true, get: function () { return Config_1.Config; } });
|
|
28
28
|
var FrameworkConfig_1 = require("./Config/FrameworkConfig");
|
|
29
29
|
Object.defineProperty(exports, "FrameworkConfig", { enumerable: true, get: function () { return FrameworkConfig_1.FrameworkConfig; } });
|
|
30
|
-
Object.defineProperty(exports, "GFCfg", { enumerable: true, get: function () { return FrameworkConfig_1.GFCfg; } });
|
|
31
30
|
var ServerConfig_1 = require("./Config/ServerConfig");
|
|
32
31
|
Object.defineProperty(exports, "ServerConfig", { enumerable: true, get: function () { return ServerConfig_1.ServerConfig; } });
|
|
33
|
-
|
|
32
|
+
Object.defineProperty(exports, "GServerCfg", { enumerable: true, get: function () { return ServerConfig_1.GServerCfg; } });
|
|
34
33
|
var Core_1 = require("./Core/Core");
|
|
35
34
|
Object.defineProperty(exports, "core", { enumerable: true, get: function () { return Core_1.core; } });
|
|
36
35
|
var Timer_1 = require("./Core/Timer");
|
|
@@ -2,6 +2,10 @@ export declare class Config {
|
|
|
2
2
|
protected _suffix: string;
|
|
3
3
|
protected _is_init: boolean;
|
|
4
4
|
protected _file_name: string;
|
|
5
|
+
/**
|
|
6
|
+
* 是否是debug调试模式,主要区别于读取数据档,debug默认读取file_d文件,release默认读取file_r文件,如果不存在都会读取file文件
|
|
7
|
+
*/
|
|
8
|
+
static debug: boolean;
|
|
5
9
|
constructor(filename: any);
|
|
6
10
|
init(): boolean;
|
|
7
11
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MongoClientOptions } from "mongodb";
|
|
2
|
-
import {
|
|
2
|
+
import { Config } from "./Config";
|
|
3
3
|
export declare enum ESessionType {
|
|
4
4
|
Cache = 0,
|
|
5
5
|
Redis = 1,
|
|
@@ -40,13 +40,8 @@ export declare class WebServerConfig {
|
|
|
40
40
|
credentials: boolean;
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
-
export declare
|
|
44
|
-
export declare class FrameworkConfig extends ServerConfig {
|
|
43
|
+
export declare class FrameworkConfig extends Config {
|
|
45
44
|
console_level: number;
|
|
46
|
-
/**
|
|
47
|
-
* 是否是debug调试模式,主要区别于读取数据档,debug默认读取file_d文件,release默认读取file_r文件,如果不存在都会读取file文件
|
|
48
|
-
*/
|
|
49
|
-
debug: boolean;
|
|
50
45
|
log: {
|
|
51
46
|
appenders: {
|
|
52
47
|
console: {
|
|
@@ -232,6 +227,6 @@ export declare class FrameworkConfig extends ServerConfig {
|
|
|
232
227
|
};
|
|
233
228
|
ip_to_domain: {};
|
|
234
229
|
root_path: string;
|
|
235
|
-
constructor(
|
|
230
|
+
constructor();
|
|
236
231
|
init(): boolean;
|
|
237
232
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { WebServerConfig } from './FrameworkConfig';
|
|
2
|
-
|
|
3
|
-
export declare class ServerConfig extends
|
|
1
|
+
import { FrameworkConfig, WebServerConfig } from './FrameworkConfig';
|
|
2
|
+
export declare let GServerCfg: ServerConfig;
|
|
3
|
+
export declare class ServerConfig extends FrameworkConfig {
|
|
4
4
|
port: number;
|
|
5
5
|
protected _server_name: string;
|
|
6
6
|
webserver: WebServerConfig;
|
|
@@ -20,6 +20,6 @@ declare class Log {
|
|
|
20
20
|
protected _isObject(param: any): boolean;
|
|
21
21
|
protected _isString(param: any): boolean;
|
|
22
22
|
protected _isNumber(param: any): boolean;
|
|
23
|
-
protected _format
|
|
23
|
+
protected _format(src: any, formatStr: any): any;
|
|
24
24
|
}
|
|
25
25
|
export {};
|
package/dist/types/cgserver.d.ts
CHANGED
package/dist/types/index.d.ts
CHANGED
|
@@ -9,8 +9,8 @@ export { Point } from "./AI/Point";
|
|
|
9
9
|
export { Trigger, GTriggerMgr } from "./AI/TriggerMgr";
|
|
10
10
|
export { FrameworkErrorCode } from "./Config/_error_";
|
|
11
11
|
export { Config } from "./Config/Config";
|
|
12
|
-
export { FrameworkConfig
|
|
13
|
-
export { ServerConfig } from "./Config/ServerConfig";
|
|
12
|
+
export { FrameworkConfig } from "./Config/FrameworkConfig";
|
|
13
|
+
export { ServerConfig, GServerCfg } from "./Config/ServerConfig";
|
|
14
14
|
export { core } from "./Core/Core";
|
|
15
15
|
export { Timer } from "./Core/Timer";
|
|
16
16
|
export { AutoIncrement } from "./Database/Decorator/AutoIncrement";
|