cgserver 10.2.3 → 10.2.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.
@@ -36,12 +36,15 @@ class Log {
36
36
  return;
37
37
  }
38
38
  this._inited = true;
39
+ this._console_level = console_level;
40
+ if (!cfg) {
41
+ return;
42
+ }
39
43
  colors.enable();
40
44
  log4js.configure(cfg);
41
45
  this._logger = log4js.getLogger(cfg.categories.default.appenders[0] || "log_file");
42
46
  this._client_logger = log4js.getLogger(cfg.categories.client_log_file.appenders[0] || "client_log_file");
43
47
  this._errorLogger = log4js.getLogger(cfg.categories.error_log_file.appenders[0] || "error_log_file");
44
- this._console_level = console_level;
45
48
  }
46
49
  _convertMsg(message) {
47
50
  if (this._isObject(message)) {
@@ -39,6 +39,25 @@ class CgRankTool {
39
39
  this._password = password;
40
40
  return true;
41
41
  }
42
+ async setTimeout(key, timeout) {
43
+ let msg = {
44
+ cmd: "setTimeout",
45
+ key: key,
46
+ timeout: timeout,
47
+ password: this._password
48
+ };
49
+ await HttpTool_1.gHttpTool.post({ url: this._url, json: msg });
50
+ return;
51
+ }
52
+ async getTimeout(key) {
53
+ let msg = {
54
+ cmd: "getTimeout",
55
+ key: key,
56
+ password: this._password
57
+ };
58
+ let rs = await HttpTool_1.gHttpTool.post({ url: this._url, json: msg });
59
+ return rs.body;
60
+ }
42
61
  /**
43
62
  *
44
63
  * @param key 排行榜的关键字
@@ -9,7 +9,7 @@ export declare class Log {
9
9
  * -1不输出到console,0,仅错误信息输出到console,1,都输出到console
10
10
  */
11
11
  protected _console_level: number;
12
- init(cfg: log4js.Configuration, console_level?: number): void;
12
+ init(cfg?: log4js.Configuration, console_level?: number): void;
13
13
  protected _convertMsg(message?: any): any;
14
14
  error(message?: any): void;
15
15
  info(message: any): void;
@@ -32,6 +32,10 @@ export declare class CgRankTool {
32
32
  protected _url: string;
33
33
  protected _password: string;
34
34
  init(url: string, password: string): boolean;
35
+ setTimeout(key: string, timeout: number): Promise<void>;
36
+ getTimeout(key: string): Promise<{
37
+ timeout: number;
38
+ }>;
35
39
  /**
36
40
  *
37
41
  * @param key 排行榜的关键字
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cgserver",
3
- "version": "10.2.3",
3
+ "version": "10.2.5",
4
4
  "author": "trojan",
5
5
  "type": "commonjs",
6
6
  "description": "free for all.Websocket or Http",