cgserver 6.5.2 → 6.5.5
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 +6 -0
- package/dist/lib/AI/BehaviorAI.js +1 -1
- package/dist/lib/Config/FrameworkConfig.js +3 -1
- package/dist/lib/Database/MongoManager.js +4 -4
- package/dist/lib/Database/MysqlBaseService.js +3 -3
- package/dist/lib/Database/RedisManager.js +3 -3
- package/dist/lib/Logic/EventTool.js +3 -0
- package/dist/lib/Logic/Log.js +38 -24
- package/dist/lib/Service/AccountService.js +2 -2
- package/dist/lib/Service/MongoAccountService.js +2 -2
- package/dist/lib/Service/UserService.js +2 -2
- package/dist/lib/Service/ini.js +1 -0
- package/dist/lib/SocketServer/ISocketServer.js +3 -3
- package/dist/lib/SocketServer/IWebSocket.js +4 -4
- package/dist/lib/ThirdParty/AppleTool.js +5 -5
- package/dist/lib/WebServer/Engine/Engine.js +2 -2
- package/dist/lib/WebServer/Engine/Request.js +1 -1
- package/dist/lib/WebServer/Engine/Response.js +2 -2
- package/dist/lib/cgserver.js +3 -1
- package/dist/types/Config/FrameworkConfig.d.ts +1 -0
- package/dist/types/Database/MongoBaseService.d.ts +1 -1
- package/dist/types/Database/MongoManager.d.ts +1 -1
- package/dist/types/Logic/EventTool.d.ts +1 -0
- package/dist/types/Logic/Log.d.ts +16 -10
- package/dist/types/Service/ini.d.ts +1 -0
- package/dist/types/cgserver.d.ts +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ class BehaviorAI {
|
|
|
33
33
|
//启动行为树AI
|
|
34
34
|
start() {
|
|
35
35
|
if (!this._behavior_data) {
|
|
36
|
-
Log_1.GLog.info("------------error------------this._behavior_data can not be null!"
|
|
36
|
+
Log_1.GLog.info("------------error------------this._behavior_data can not be null!");
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
this.goto(this._behavior_data.start);
|
|
@@ -36,6 +36,8 @@ class WebServerConfig {
|
|
|
36
36
|
exports.WebServerConfig = WebServerConfig;
|
|
37
37
|
exports.GFCfg = null;
|
|
38
38
|
class FrameworkConfig extends ServerConfig_1.ServerConfig {
|
|
39
|
+
//-1不输出到console,0,仅错误信息输出到console,1,都输出到console
|
|
40
|
+
console_level = 0;
|
|
39
41
|
log = {
|
|
40
42
|
appenders: {
|
|
41
43
|
console: {
|
|
@@ -226,7 +228,7 @@ class FrameworkConfig extends ServerConfig_1.ServerConfig {
|
|
|
226
228
|
}
|
|
227
229
|
init() {
|
|
228
230
|
let ret = super.init();
|
|
229
|
-
Log_1.GLog.init(this.log);
|
|
231
|
+
Log_1.GLog.init(this.log, this.console_level || 0);
|
|
230
232
|
exports.GFCfg = this;
|
|
231
233
|
return ret;
|
|
232
234
|
}
|
|
@@ -61,7 +61,7 @@ class MongoManager {
|
|
|
61
61
|
return true;
|
|
62
62
|
}
|
|
63
63
|
this._inited = true;
|
|
64
|
-
Log_1.GLog.info("mongo config=" + JSON.stringify(FrameworkConfig_1.GFCfg.db.mongo)
|
|
64
|
+
Log_1.GLog.info("mongo config=" + JSON.stringify(FrameworkConfig_1.GFCfg.db.mongo));
|
|
65
65
|
let client = new mongo.MongoClient("mongodb://" + FrameworkConfig_1.GFCfg.db.mongo.host + ":" + FrameworkConfig_1.GFCfg.db.mongo.port, FrameworkConfig_1.GFCfg.db.mongo.options);
|
|
66
66
|
await client.connect();
|
|
67
67
|
this.onConnect();
|
|
@@ -80,13 +80,13 @@ class MongoManager {
|
|
|
80
80
|
}
|
|
81
81
|
onEnd() {
|
|
82
82
|
this._mongo_init_succ = false;
|
|
83
|
-
Log_1.GLog.error("mongo has ended!"
|
|
84
|
-
Log_1.GLog.info("mongo try reconnect"
|
|
83
|
+
Log_1.GLog.error("mongo has ended!");
|
|
84
|
+
Log_1.GLog.info("mongo try reconnect");
|
|
85
85
|
this.init();
|
|
86
86
|
}
|
|
87
87
|
onError(err) {
|
|
88
88
|
Log_1.GLog.error("Error " + err);
|
|
89
|
-
Log_1.GLog.info("mongo try reconnect"
|
|
89
|
+
Log_1.GLog.info("mongo try reconnect");
|
|
90
90
|
this.init();
|
|
91
91
|
}
|
|
92
92
|
async getAutoIds(key) {
|
|
@@ -48,7 +48,7 @@ class MysqlBaseService {
|
|
|
48
48
|
}
|
|
49
49
|
let droped = await this._checkDropTable(table.version);
|
|
50
50
|
if (!droped) {
|
|
51
|
-
Log_1.GLog.info("table(" + this._table + ")无需升级..."
|
|
51
|
+
Log_1.GLog.info("table(" + this._table + ")无需升级...");
|
|
52
52
|
//既然版本号没变,就快速返回
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
@@ -100,7 +100,7 @@ class MysqlBaseService {
|
|
|
100
100
|
}
|
|
101
101
|
else {
|
|
102
102
|
DBCache_1.GDBCache.setVersion(this.table, table.version);
|
|
103
|
-
Log_1.GLog.info("table(" + this._table + ")初始化成功..."
|
|
103
|
+
Log_1.GLog.info("table(" + this._table + ")初始化成功...");
|
|
104
104
|
await this._onReCreated();
|
|
105
105
|
}
|
|
106
106
|
}
|
|
@@ -120,7 +120,7 @@ class MysqlBaseService {
|
|
|
120
120
|
throw Error(sr.error);
|
|
121
121
|
}
|
|
122
122
|
else {
|
|
123
|
-
Log_1.GLog.info("table(" + this._table + ")删除成功..."
|
|
123
|
+
Log_1.GLog.info("table(" + this._table + ")删除成功...");
|
|
124
124
|
await this._onDroped();
|
|
125
125
|
}
|
|
126
126
|
return true;
|
|
@@ -24,7 +24,7 @@ class RedisManager {
|
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
26
|
this._redisCfg = redisCfg;
|
|
27
|
-
Log_1.GLog.info("begin conect redis=" + JSON.stringify(redisCfg)
|
|
27
|
+
Log_1.GLog.info("begin conect redis=" + JSON.stringify(redisCfg));
|
|
28
28
|
this._redis = redis.createClient(redisCfg.port, redisCfg.host, { parser: "javascript", return_buffers: false, connect_timeout: 3000, password: redisCfg.password });
|
|
29
29
|
this._redis.on("connect", () => {
|
|
30
30
|
this.onConnect();
|
|
@@ -39,7 +39,7 @@ class RedisManager {
|
|
|
39
39
|
this._redis.select(this._redisCfg.database);
|
|
40
40
|
}
|
|
41
41
|
this._resis_init_succ = true;
|
|
42
|
-
Log_1.GLog.info("redis has connected!"
|
|
42
|
+
Log_1.GLog.info("redis has connected!");
|
|
43
43
|
}
|
|
44
44
|
onEnd() {
|
|
45
45
|
this._resis_init_succ = false;
|
|
@@ -47,7 +47,7 @@ class RedisManager {
|
|
|
47
47
|
this.init(this._redisCfg); //重连
|
|
48
48
|
}
|
|
49
49
|
onError(err) {
|
|
50
|
-
Log_1.GLog.info("Error connected=" + this._redis.connected + ": " + err
|
|
50
|
+
Log_1.GLog.info("Error connected=" + this._redis.connected + ": " + err);
|
|
51
51
|
}
|
|
52
52
|
expire(key, seconds) {
|
|
53
53
|
return new Promise((resolve, reject) => {
|
package/dist/lib/Logic/Log.js
CHANGED
|
@@ -27,7 +27,12 @@ class Log {
|
|
|
27
27
|
//error and warn
|
|
28
28
|
_errorLogger = null;
|
|
29
29
|
_inited = false;
|
|
30
|
-
|
|
30
|
+
/**
|
|
31
|
+
* 该level只是用来控制控制台的显示的
|
|
32
|
+
* -1不输出到console,0,仅错误信息输出到console,1,都输出到console
|
|
33
|
+
*/
|
|
34
|
+
_console_level = 0;
|
|
35
|
+
init(cfg, console_level = 0) {
|
|
31
36
|
if (this._inited) {
|
|
32
37
|
return;
|
|
33
38
|
}
|
|
@@ -37,59 +42,68 @@ class Log {
|
|
|
37
42
|
this._logger = log4js.getLogger(cfg.categories.default.appenders[0] || "log_date");
|
|
38
43
|
this._client_logger = log4js.getLogger(cfg.categories.default.appenders[1] || "client_log_date");
|
|
39
44
|
this._errorLogger = log4js.getLogger(cfg.categories.default.appenders[2] || "error_log_file");
|
|
45
|
+
this._console_level = console_level;
|
|
40
46
|
}
|
|
41
|
-
error(message
|
|
42
|
-
if (this.
|
|
47
|
+
error(message) {
|
|
48
|
+
if (this._isObject(message)) {
|
|
43
49
|
message = JSON.stringify(message);
|
|
44
50
|
}
|
|
45
51
|
this._errorLogger.error(message);
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
52
|
+
if (this._console_level >= 0) {
|
|
53
|
+
let time_str = this._getTimeStr();
|
|
54
|
+
console.error(time_str + " " + message);
|
|
55
|
+
}
|
|
50
56
|
}
|
|
51
|
-
info(message
|
|
52
|
-
if (this.
|
|
57
|
+
info(message) {
|
|
58
|
+
if (this._isObject(message)) {
|
|
53
59
|
message = JSON.stringify(message);
|
|
54
60
|
}
|
|
55
61
|
this._logger.info(message);
|
|
56
|
-
if (
|
|
57
|
-
|
|
58
|
-
var time_str = this.format(time, "[YYYY-MM-DD HH:mm:SS.");
|
|
59
|
-
time_str += time.getMilliseconds() + "]";
|
|
62
|
+
if (this._console_level >= 0) {
|
|
63
|
+
let time_str = this._getTimeStr();
|
|
60
64
|
console.log(time_str + " " + message);
|
|
61
65
|
}
|
|
62
66
|
}
|
|
63
|
-
warn(message
|
|
64
|
-
if (this.
|
|
67
|
+
warn(message) {
|
|
68
|
+
if (this._isObject(message)) {
|
|
65
69
|
message = JSON.stringify(message);
|
|
66
70
|
}
|
|
67
71
|
this._errorLogger.warn(message);
|
|
72
|
+
if (this._console_level >= 0) {
|
|
73
|
+
let time_str = this._getTimeStr();
|
|
74
|
+
console.error(time_str + " " + message);
|
|
75
|
+
}
|
|
68
76
|
}
|
|
69
|
-
record(message
|
|
70
|
-
this.info(message
|
|
77
|
+
record(message) {
|
|
78
|
+
this.info(message);
|
|
71
79
|
}
|
|
72
|
-
clientLog(message
|
|
80
|
+
clientLog(message) {
|
|
73
81
|
this._client_logger.error(message);
|
|
74
82
|
}
|
|
75
|
-
|
|
83
|
+
_getTimeStr() {
|
|
84
|
+
let time = new Date();
|
|
85
|
+
let time_str = this._format(time, "[YYYY-MM-DD HH:mm:SS.");
|
|
86
|
+
time_str += time.getMilliseconds() + "]";
|
|
87
|
+
return time_str;
|
|
88
|
+
}
|
|
89
|
+
_isObject(param) {
|
|
76
90
|
return typeof (param) === "object";
|
|
77
91
|
}
|
|
78
|
-
|
|
92
|
+
_isString(param) {
|
|
79
93
|
return typeof (param) === "string";
|
|
80
94
|
}
|
|
81
|
-
|
|
95
|
+
_isNumber(param) {
|
|
82
96
|
return typeof (param) === "number";
|
|
83
97
|
}
|
|
84
|
-
|
|
85
|
-
if (
|
|
98
|
+
_format = function (src, formatStr) {
|
|
99
|
+
if (this.isString(src)) {
|
|
86
100
|
let args = Array.prototype.slice.call(arguments, 1);
|
|
87
101
|
return src.replace(/\{(\d+)\}/g, function (m, i) {
|
|
88
102
|
return args[i];
|
|
89
103
|
});
|
|
90
104
|
}
|
|
91
105
|
else {
|
|
92
|
-
if (
|
|
106
|
+
if (this.isNumber(src)) {
|
|
93
107
|
src = new Date(src);
|
|
94
108
|
}
|
|
95
109
|
let str = formatStr;
|
|
@@ -34,7 +34,7 @@ let AccountModel = class AccountModel extends MysqlBaseService_1.BaseModel {
|
|
|
34
34
|
login_time = -1;
|
|
35
35
|
login_ip = "";
|
|
36
36
|
from = 0;
|
|
37
|
-
state =
|
|
37
|
+
state = ini_1.EAccountState.Waitting;
|
|
38
38
|
};
|
|
39
39
|
__decorate([
|
|
40
40
|
(0, Type_1.Type)(Property_1.EPropertyType.Int),
|
|
@@ -152,7 +152,7 @@ class AccountService extends MysqlBaseService_1.MysqlBaseService {
|
|
|
152
152
|
account.login_time = Date.now();
|
|
153
153
|
account.login_ip = ip;
|
|
154
154
|
account.from = from;
|
|
155
|
-
account.state =
|
|
155
|
+
account.state = ini_1.EAccountState.Waitting;
|
|
156
156
|
delete account.id;
|
|
157
157
|
let sr = await this.insert(account);
|
|
158
158
|
if (sr.error
|
|
@@ -23,7 +23,7 @@ class AccountModel extends MongoManager_1.MongoBaseModel {
|
|
|
23
23
|
login_time = -1;
|
|
24
24
|
login_ip = "";
|
|
25
25
|
from = 0;
|
|
26
|
-
state =
|
|
26
|
+
state = ini_1.EAccountState.Waitting;
|
|
27
27
|
}
|
|
28
28
|
exports.AccountModel = AccountModel;
|
|
29
29
|
//暂时不实例化,方便重写
|
|
@@ -84,7 +84,7 @@ class AccountService extends MongoBaseService_1.MongoBaseService {
|
|
|
84
84
|
account.login_time = Date.now();
|
|
85
85
|
account.login_ip = ip;
|
|
86
86
|
account.from = from;
|
|
87
|
-
account.state =
|
|
87
|
+
account.state = ini_1.EAccountState.Waitting;
|
|
88
88
|
account.id = await this.getNextId();
|
|
89
89
|
let sr = await this.insert(account);
|
|
90
90
|
if (sr.errcode) {
|
|
@@ -20,7 +20,7 @@ class UserModel extends MysqlBaseService_1.BaseModel {
|
|
|
20
20
|
nickname = "";
|
|
21
21
|
sex = -1;
|
|
22
22
|
logo = "";
|
|
23
|
-
state =
|
|
23
|
+
state = ini_1.EUserState.Waitting;
|
|
24
24
|
role_group = 4;
|
|
25
25
|
role = 0;
|
|
26
26
|
phone = "";
|
|
@@ -139,7 +139,7 @@ class UserService extends MysqlBaseService_1.MysqlBaseService {
|
|
|
139
139
|
um.sex = sex || 0;
|
|
140
140
|
um.logo = logo || "";
|
|
141
141
|
um.account_id = account_id;
|
|
142
|
-
um.state =
|
|
142
|
+
um.state = ini_1.EUserState.Waitting;
|
|
143
143
|
um.role_group = group;
|
|
144
144
|
um.role = 0;
|
|
145
145
|
//随机userid
|
package/dist/lib/Service/ini.js
CHANGED
|
@@ -16,6 +16,7 @@ var EUserState;
|
|
|
16
16
|
})(EUserState = exports.EUserState || (exports.EUserState = {}));
|
|
17
17
|
var EAccountState;
|
|
18
18
|
(function (EAccountState) {
|
|
19
|
+
EAccountState[EAccountState["Delete"] = -2] = "Delete";
|
|
19
20
|
EAccountState[EAccountState["Ban"] = -1] = "Ban";
|
|
20
21
|
EAccountState[EAccountState["Waitting"] = 0] = "Waitting";
|
|
21
22
|
EAccountState[EAccountState["Normarl"] = 1] = "Normarl";
|
|
@@ -143,13 +143,13 @@ class ISocketServer {
|
|
|
143
143
|
let allowed = this.isOriginAllowed(req.origin);
|
|
144
144
|
if (!allowed) {
|
|
145
145
|
req.reject();
|
|
146
|
-
Log_1.GLog.info(' Connection from origin ' + req.origin + ' rejected.'
|
|
146
|
+
Log_1.GLog.info(' Connection from origin ' + req.origin + ' rejected.');
|
|
147
147
|
return;
|
|
148
148
|
}
|
|
149
149
|
try {
|
|
150
150
|
let conn = req.accept(this._accepted_protocol, req.origin);
|
|
151
151
|
if (!conn) {
|
|
152
|
-
Log_1.GLog.info(' protocol reject'
|
|
152
|
+
Log_1.GLog.info(' protocol reject');
|
|
153
153
|
return;
|
|
154
154
|
}
|
|
155
155
|
Log_1.GLog.info((new Date()) + ' Connection accepted.');
|
|
@@ -157,7 +157,7 @@ class ISocketServer {
|
|
|
157
157
|
this.createWebSocketObjectByProtocol(server_name, conn);
|
|
158
158
|
}
|
|
159
159
|
catch (e) {
|
|
160
|
-
Log_1.GLog.info(' protocol reject'
|
|
160
|
+
Log_1.GLog.info(' protocol reject');
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
createWebSocketObjectByProtocol(server_name, _ws) {
|
|
@@ -134,8 +134,8 @@ class IWebSocket {
|
|
|
134
134
|
if (this._debug_msg
|
|
135
135
|
&& jsonData
|
|
136
136
|
&& jsonData.cmd != "heartbeat") {
|
|
137
|
-
Log_1.GLog.info(this.tipKey + " receive:--------"
|
|
138
|
-
Log_1.GLog.info({ tipKey: this.tipKey, jsonData }
|
|
137
|
+
Log_1.GLog.info(this.tipKey + " receive:--------");
|
|
138
|
+
Log_1.GLog.info({ tipKey: this.tipKey, jsonData });
|
|
139
139
|
}
|
|
140
140
|
if (!jsonData.cmd || jsonData.cmd == "") {
|
|
141
141
|
Log_1.GLog.error(this.tipKey + ' Received Message warning: no cmd param,data=');
|
|
@@ -208,8 +208,8 @@ class IWebSocket {
|
|
|
208
208
|
}
|
|
209
209
|
if (this._debug_msg
|
|
210
210
|
&& data.cmd != "heartbeat") {
|
|
211
|
-
Log_1.GLog.info(this.tipKey + " send:-----------------------------------"
|
|
212
|
-
Log_1.GLog.info({ tipKey: this.tipKey, data }
|
|
211
|
+
Log_1.GLog.info(this.tipKey + " send:-----------------------------------");
|
|
212
|
+
Log_1.GLog.info({ tipKey: this.tipKey, data });
|
|
213
213
|
}
|
|
214
214
|
let msg = this._onEncode(data);
|
|
215
215
|
this._ws.send(msg);
|
|
@@ -160,27 +160,27 @@ class AppleTool {
|
|
|
160
160
|
"expire_date": latest_one?.expires_date,
|
|
161
161
|
"receipt_expire_date": nb.unified_receipt?.receipt?.expiration_date
|
|
162
162
|
};
|
|
163
|
-
Log_1.GLog.info(msg
|
|
163
|
+
Log_1.GLog.info(msg);
|
|
164
164
|
Log_1.GLog.info(nb);
|
|
165
165
|
}
|
|
166
166
|
async onVerify(receipt, environment) {
|
|
167
|
-
Log_1.GLog.info("begin onVerify============================" + environment
|
|
167
|
+
Log_1.GLog.info("begin onVerify============================" + environment);
|
|
168
168
|
let url = this._verifyUrl;
|
|
169
169
|
// if(environment.toLowerCase()=="sandbox")
|
|
170
170
|
// {
|
|
171
171
|
// url=this._sandboxVerifyUrl
|
|
172
172
|
// }
|
|
173
|
-
Log_1.GLog.info("url============================" + url
|
|
173
|
+
Log_1.GLog.info("url============================" + url);
|
|
174
174
|
let reqb = new RequestBody();
|
|
175
175
|
reqb['receipt-data'] = receipt;
|
|
176
176
|
//先验证生产环境
|
|
177
177
|
var resb = (await HttpTool_1.GHttpTool.httpPost(url, JSON.stringify(reqb))).body;
|
|
178
|
-
Log_1.GLog.info("production end onVerify_Res============================status=" + (resb ? resb.status : "null")
|
|
178
|
+
Log_1.GLog.info("production end onVerify_Res============================status=" + (resb ? resb.status : "null"));
|
|
179
179
|
//状态21007表示是沙盒环境
|
|
180
180
|
if (resb && resb.status == 21007) {
|
|
181
181
|
url = this._sandboxVerifyUrl;
|
|
182
182
|
resb = (await HttpTool_1.GHttpTool.httpPost(url, JSON.stringify(reqb))).body;
|
|
183
|
-
Log_1.GLog.info("sandbox end onVerify_Res============================status=" + (resb ? resb.status : "null")
|
|
183
|
+
Log_1.GLog.info("sandbox end onVerify_Res============================status=" + (resb ? resb.status : "null"));
|
|
184
184
|
}
|
|
185
185
|
Log_1.GLog.info(resb);
|
|
186
186
|
return resb;
|
|
@@ -32,7 +32,7 @@ class Engine {
|
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
34
|
http.createServer(this._app).listen(port, () => {
|
|
35
|
-
Log_1.GLog.info("Server(" + this._cfg.web_name + ") running at http://127.0.0.1:" + port + "/"
|
|
35
|
+
Log_1.GLog.info("Server(" + this._cfg.web_name + ") running at http://127.0.0.1:" + port + "/");
|
|
36
36
|
});
|
|
37
37
|
if (this._cfg.ssl) {
|
|
38
38
|
const httpsOption = {
|
|
@@ -40,7 +40,7 @@ class Engine {
|
|
|
40
40
|
cert: fs.readFileSync(this._cfg.ssl.crt)
|
|
41
41
|
};
|
|
42
42
|
https.createServer(httpsOption, this._app).listen(port + 1);
|
|
43
|
-
Log_1.GLog.info("Server(" + this._cfg.web_name + ") running at https://127.0.0.1:" + (port + 1) + "/"
|
|
43
|
+
Log_1.GLog.info("Server(" + this._cfg.web_name + ") running at https://127.0.0.1:" + (port + 1) + "/");
|
|
44
44
|
}
|
|
45
45
|
this._app.use(cookieParser());
|
|
46
46
|
this._app.use(bodyParser.json({ limit: '10mb' }));
|
|
@@ -93,8 +93,8 @@ class Response {
|
|
|
93
93
|
if (!this._cfg.debug) {
|
|
94
94
|
return;
|
|
95
95
|
}
|
|
96
|
-
Log_1.GLog.info("dttime:" + (Date.now() - this._create_time).toLocaleString() + "ms"
|
|
97
|
-
Log_1.GLog.info(data
|
|
96
|
+
Log_1.GLog.info("dttime:" + (Date.now() - this._create_time).toLocaleString() + "ms");
|
|
97
|
+
Log_1.GLog.info(data);
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
exports.Response = Response;
|
package/dist/lib/cgserver.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.JsonProtoFilter = 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.ServerConfig = exports.GFCfg = exports.FrameworkConfig = exports.Config = exports.FrameworkErrorCode = exports.GTriggerMgr = exports.Trigger = exports.Point = exports.Entity = exports.BehaviorAI = exports.AStar = exports.AiObject = exports.GDBCache = exports.GProtoFactory = void 0;
|
|
4
|
-
exports.GCgServer = 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 = void 0;
|
|
4
|
+
exports.GCgServer = 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 = void 0;
|
|
5
5
|
var ProtoFactory_1 = require("./SocketServer/ProtoFilter/ProtoFactory");
|
|
6
6
|
Object.defineProperty(exports, "GProtoFactory", { enumerable: true, get: function () { return ProtoFactory_1.GProtoFactory; } });
|
|
7
7
|
var DBCache_1 = require("./Database/Decorator/DBCache");
|
|
@@ -161,6 +161,8 @@ var AsyncQueueTool_1 = require("./Logic/AsyncQueueTool");
|
|
|
161
161
|
Object.defineProperty(exports, "GAsyncQueueTool", { enumerable: true, get: function () { return AsyncQueueTool_1.GAsyncQueueTool; } });
|
|
162
162
|
var EventTool_1 = require("./Logic/EventTool");
|
|
163
163
|
Object.defineProperty(exports, "GEventTool", { enumerable: true, get: function () { return EventTool_1.GEventTool; } });
|
|
164
|
+
var ini_2 = require("./Service/ini");
|
|
165
|
+
Object.defineProperty(exports, "EAccountState", { enumerable: true, get: function () { return ini_2.EAccountState; } });
|
|
164
166
|
const Log_2 = require("./Logic/Log");
|
|
165
167
|
class CgServer {
|
|
166
168
|
constructor() {
|
|
@@ -114,7 +114,7 @@ declare class MongoManager {
|
|
|
114
114
|
id: number;
|
|
115
115
|
des: string;
|
|
116
116
|
};
|
|
117
|
-
rs: mongo.
|
|
117
|
+
rs: mongo.UpdateResult | mongo.Document;
|
|
118
118
|
}>;
|
|
119
119
|
createIndex(collection: string, index: any, callback?: mongo.CreateIndexesOptions): Promise<{
|
|
120
120
|
errcode: {
|
|
@@ -6,6 +6,7 @@ declare class EventTool {
|
|
|
6
6
|
on(event: string, func: (...args: any[]) => void): void;
|
|
7
7
|
off(event: string, func: (...args: any[]) => void): void;
|
|
8
8
|
once(event: string, func: (...args: any[]) => void): void;
|
|
9
|
+
emit(event: string, ...args: any[]): void;
|
|
9
10
|
}
|
|
10
11
|
export declare let GEventTool: EventTool;
|
|
11
12
|
export {};
|
|
@@ -5,15 +5,21 @@ declare class Log {
|
|
|
5
5
|
protected _client_logger: log4js.Logger;
|
|
6
6
|
protected _errorLogger: log4js.Logger;
|
|
7
7
|
protected _inited: boolean;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
/**
|
|
9
|
+
* 该level只是用来控制控制台的显示的
|
|
10
|
+
* -1不输出到console,0,仅错误信息输出到console,1,都输出到console
|
|
11
|
+
*/
|
|
12
|
+
protected _console_level: number;
|
|
13
|
+
init(cfg: log4js.Configuration, console_level?: number): void;
|
|
14
|
+
error(message?: any): void;
|
|
15
|
+
info(message: any): void;
|
|
16
|
+
warn(message?: any): void;
|
|
17
|
+
record(message?: any): void;
|
|
18
|
+
clientLog(message?: any): void;
|
|
19
|
+
protected _getTimeStr(): any;
|
|
20
|
+
protected _isObject(param: any): boolean;
|
|
21
|
+
protected _isString(param: any): boolean;
|
|
22
|
+
protected _isNumber(param: any): boolean;
|
|
23
|
+
protected _format: (src: any, formatStr: any) => any;
|
|
18
24
|
}
|
|
19
25
|
export {};
|
package/dist/types/cgserver.d.ts
CHANGED
|
@@ -74,6 +74,7 @@ export { Response } from './WebServer/Engine/Response';
|
|
|
74
74
|
export { WebServerConfig } from './Config/FrameworkConfig';
|
|
75
75
|
export { GAsyncQueueTool } from './Logic/AsyncQueueTool';
|
|
76
76
|
export { GEventTool } from './Logic/EventTool';
|
|
77
|
+
export { EAccountState } from './Service/ini';
|
|
77
78
|
declare class CgServer {
|
|
78
79
|
constructor();
|
|
79
80
|
init(): void;
|