cgserver 10.2.0 → 10.2.2

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 CHANGED
@@ -1,3 +1,5 @@
1
+ 10.2.1
2
+ 1、cgrank支持密码
1
3
  10.2.0
2
4
  1、修复redis
3
5
  2、增加对cgrank的支持
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GCgRankTool = exports.CgRankCommandItem = exports.CgRankRankData = exports.CgRankRankItem = exports.CgRankErrcode = void 0;
3
+ exports.GCgRankTool = exports.CgRankTool = exports.CgRankCommandItem = exports.CgRankRankData = exports.CgRankRankItem = exports.CgRankErrcode = void 0;
4
4
  const HttpTool_1 = require("../Logic/HttpTool");
5
5
  class CgRankErrcode {
6
6
  id = 0;
@@ -33,8 +33,10 @@ class CgRankCommandItem {
33
33
  exports.CgRankCommandItem = CgRankCommandItem;
34
34
  class CgRankTool {
35
35
  _url = "";
36
- init(url) {
36
+ _password = "";
37
+ init(url, password) {
37
38
  this._url = url;
39
+ this._password = password;
38
40
  return true;
39
41
  }
40
42
  /**
@@ -45,14 +47,16 @@ class CgRankTool {
45
47
  async removeRank(key) {
46
48
  let msg = {
47
49
  cmd: "removeRank",
48
- key: key
50
+ key: key,
51
+ password: this._password
49
52
  };
50
53
  let rs = await HttpTool_1.gHttpTool.post({ url: this._url, json: msg });
51
54
  return rs.body;
52
55
  }
53
56
  async saveAllRank() {
54
57
  let msg = {
55
- cmd: "saveAllRank"
58
+ cmd: "saveAllRank",
59
+ password: this._password
56
60
  };
57
61
  let rs = await HttpTool_1.gHttpTool.post({ url: this._url, json: msg });
58
62
  return rs.body;
@@ -61,7 +65,8 @@ class CgRankTool {
61
65
  let msg = {
62
66
  cmd: "getRankItem",
63
67
  key: key,
64
- id: id
68
+ id: id,
69
+ password: this._password
65
70
  };
66
71
  let rs = await HttpTool_1.gHttpTool.post({ url: this._url, json: msg });
67
72
  return rs.body;
@@ -70,7 +75,8 @@ class CgRankTool {
70
75
  let msg = {
71
76
  cmd: "getRankItems",
72
77
  key: key,
73
- ids: ids
78
+ ids: ids,
79
+ password: this._password
74
80
  };
75
81
  let rs = await HttpTool_1.gHttpTool.post({ url: this._url, json: msg });
76
82
  return rs.body;
@@ -86,7 +92,8 @@ class CgRankTool {
86
92
  cmd: "getRankList",
87
93
  key: key,
88
94
  start: start,
89
- count: count
95
+ count: count,
96
+ password: this._password
90
97
  };
91
98
  let rs = await HttpTool_1.gHttpTool.post({ url: this._url, json: msg });
92
99
  return rs.body;
@@ -94,7 +101,8 @@ class CgRankTool {
94
101
  async getRankCount(key) {
95
102
  let msg = {
96
103
  cmd: "getRankCount",
97
- key: key
104
+ key: key,
105
+ password: this._password
98
106
  };
99
107
  let rs = await HttpTool_1.gHttpTool.post({ url: this._url, json: msg });
100
108
  return rs.body;
@@ -104,7 +112,8 @@ class CgRankTool {
104
112
  cmd: "getRevRankList",
105
113
  key: key,
106
114
  start: start,
107
- count: count
115
+ count: count,
116
+ password: this._password
108
117
  };
109
118
  let rs = await HttpTool_1.gHttpTool.post({ url: this._url, json: msg });
110
119
  return rs.body;
@@ -116,7 +125,8 @@ class CgRankTool {
116
125
  id: id,
117
126
  score: score,
118
127
  other: other,
119
- isreplace: isreplace
128
+ isreplace: isreplace,
129
+ password: this._password
120
130
  };
121
131
  let rs = await HttpTool_1.gHttpTool.post({ url: this._url, json: msg });
122
132
  return rs.body;
@@ -126,7 +136,8 @@ class CgRankTool {
126
136
  cmd: "addsToRank",
127
137
  key: key,
128
138
  datas: datas,
129
- isreplace: isreplace
139
+ isreplace: isreplace,
140
+ password: this._password
130
141
  };
131
142
  let rs = await HttpTool_1.gHttpTool.post({ url: this._url, json: msg });
132
143
  return rs.body;
@@ -135,7 +146,8 @@ class CgRankTool {
135
146
  let msg = {
136
147
  cmd: "removeFromRank",
137
148
  key: key,
138
- id: id
149
+ id: id,
150
+ password: this._password
139
151
  };
140
152
  let rs = await HttpTool_1.gHttpTool.post({ url: this._url, json: msg });
141
153
  return rs.body;
@@ -144,7 +156,8 @@ class CgRankTool {
144
156
  let msg = {
145
157
  cmd: "updateInRank",
146
158
  key: key,
147
- command: command
159
+ command: command,
160
+ password: this._password
148
161
  };
149
162
  let rs = await HttpTool_1.gHttpTool.post({ url: this._url, json: msg });
150
163
  return rs.body;
@@ -153,7 +166,8 @@ class CgRankTool {
153
166
  let msg = {
154
167
  cmd: "updatesInRank",
155
168
  key: key,
156
- commands: commands
169
+ commands: commands,
170
+ password: this._password
157
171
  };
158
172
  let rs = await HttpTool_1.gHttpTool.post({ url: this._url, json: msg });
159
173
  return rs.body;
@@ -162,7 +176,8 @@ class CgRankTool {
162
176
  let msg = {
163
177
  cmd: "executeCommand",
164
178
  key: key,
165
- commands: commands
179
+ commands: commands,
180
+ password: this._password
166
181
  };
167
182
  let rs = await HttpTool_1.gHttpTool.post({ url: this._url, json: msg });
168
183
  return rs.body;
@@ -170,10 +185,12 @@ class CgRankTool {
170
185
  async anyCall(call, ...args) {
171
186
  let msg = {
172
187
  cmd: call,
173
- args: args
188
+ args: args,
189
+ password: this._password
174
190
  };
175
191
  let rs = await HttpTool_1.gHttpTool.post({ url: this._url, json: msg });
176
192
  return rs.body;
177
193
  }
178
194
  }
195
+ exports.CgRankTool = CgRankTool;
179
196
  exports.GCgRankTool = new CgRankTool();
@@ -0,0 +1,196 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.gCgRankTool = exports.CgRankTool = exports.CgRankCommandItem = exports.CgRankRankData = exports.CgRankRankItem = exports.CgRankErrcode = void 0;
4
+ const HttpTool_1 = require("../Logic/HttpTool");
5
+ class CgRankErrcode {
6
+ id = 0;
7
+ des = "";
8
+ }
9
+ exports.CgRankErrcode = CgRankErrcode;
10
+ class CgRankRankItem {
11
+ id = "";
12
+ score = 0;
13
+ rank = 0;
14
+ other = {};
15
+ }
16
+ exports.CgRankRankItem = CgRankRankItem;
17
+ class CgRankRankData {
18
+ //每个榜都有一个关键词
19
+ key = "";
20
+ //数据
21
+ maps = {};
22
+ //有序列表
23
+ list = [];
24
+ timeout = -1;
25
+ }
26
+ exports.CgRankRankData = CgRankRankData;
27
+ class CgRankCommandItem {
28
+ id = "";
29
+ score = 0;
30
+ inc = {};
31
+ set = {};
32
+ }
33
+ exports.CgRankCommandItem = CgRankCommandItem;
34
+ class CgRankTool {
35
+ _url = "";
36
+ _password = "";
37
+ init(url, password) {
38
+ this._url = url;
39
+ this._password = password;
40
+ return true;
41
+ }
42
+ /**
43
+ *
44
+ * @param key 排行榜的关键字
45
+ * @returns
46
+ */
47
+ async removeRank(key) {
48
+ let msg = {
49
+ cmd: "removeRank",
50
+ key: key,
51
+ password: this._password
52
+ };
53
+ let rs = await HttpTool_1.gHttpTool.post({ url: this._url, json: msg });
54
+ return rs.body;
55
+ }
56
+ async saveAllRank() {
57
+ let msg = {
58
+ cmd: "saveAllRank",
59
+ password: this._password
60
+ };
61
+ let rs = await HttpTool_1.gHttpTool.post({ url: this._url, json: msg });
62
+ return rs.body;
63
+ }
64
+ async getRankItem(key, id) {
65
+ let msg = {
66
+ cmd: "getRankItem",
67
+ key: key,
68
+ id: id,
69
+ password: this._password
70
+ };
71
+ let rs = await HttpTool_1.gHttpTool.post({ url: this._url, json: msg });
72
+ return rs.body;
73
+ }
74
+ async getRankItems(key, ids) {
75
+ let msg = {
76
+ cmd: "getRankItems",
77
+ key: key,
78
+ ids: ids,
79
+ password: this._password
80
+ };
81
+ let rs = await HttpTool_1.gHttpTool.post({ url: this._url, json: msg });
82
+ return rs.body;
83
+ }
84
+ /**
85
+ *
86
+ * @param key
87
+ * @param start
88
+ * @param count 小于等于0表示全部
89
+ */
90
+ async getRankList(key, start, count) {
91
+ let msg = {
92
+ cmd: "getRankList",
93
+ key: key,
94
+ start: start,
95
+ count: count,
96
+ password: this._password
97
+ };
98
+ let rs = await HttpTool_1.gHttpTool.post({ url: this._url, json: msg });
99
+ return rs.body;
100
+ }
101
+ async getRankCount(key) {
102
+ let msg = {
103
+ cmd: "getRankCount",
104
+ key: key,
105
+ password: this._password
106
+ };
107
+ let rs = await HttpTool_1.gHttpTool.post({ url: this._url, json: msg });
108
+ return rs.body;
109
+ }
110
+ async getRevRankList(key, start, count) {
111
+ let msg = {
112
+ cmd: "getRevRankList",
113
+ key: key,
114
+ start: start,
115
+ count: count,
116
+ password: this._password
117
+ };
118
+ let rs = await HttpTool_1.gHttpTool.post({ url: this._url, json: msg });
119
+ return rs.body;
120
+ }
121
+ async addToRank(key, id, score, other, isreplace = false) {
122
+ let msg = {
123
+ cmd: "addToRank",
124
+ key: key,
125
+ id: id,
126
+ score: score,
127
+ other: other,
128
+ isreplace: isreplace,
129
+ password: this._password
130
+ };
131
+ let rs = await HttpTool_1.gHttpTool.post({ url: this._url, json: msg });
132
+ return rs.body;
133
+ }
134
+ async addsToRank(key, datas, isreplace = false) {
135
+ let msg = {
136
+ cmd: "addsToRank",
137
+ key: key,
138
+ datas: datas,
139
+ isreplace: isreplace,
140
+ password: this._password
141
+ };
142
+ let rs = await HttpTool_1.gHttpTool.post({ url: this._url, json: msg });
143
+ return rs.body;
144
+ }
145
+ async removeFromRank(key, id) {
146
+ let msg = {
147
+ cmd: "removeFromRank",
148
+ key: key,
149
+ id: id,
150
+ password: this._password
151
+ };
152
+ let rs = await HttpTool_1.gHttpTool.post({ url: this._url, json: msg });
153
+ return rs.body;
154
+ }
155
+ async updateInRank(key, command) {
156
+ let msg = {
157
+ cmd: "updateInRank",
158
+ key: key,
159
+ command: command,
160
+ password: this._password
161
+ };
162
+ let rs = await HttpTool_1.gHttpTool.post({ url: this._url, json: msg });
163
+ return rs.body;
164
+ }
165
+ async updatesInRank(key, commands) {
166
+ let msg = {
167
+ cmd: "updatesInRank",
168
+ key: key,
169
+ commands: commands,
170
+ password: this._password
171
+ };
172
+ let rs = await HttpTool_1.gHttpTool.post({ url: this._url, json: msg });
173
+ return rs.body;
174
+ }
175
+ async executeCommand(key, commands) {
176
+ let msg = {
177
+ cmd: "executeCommand",
178
+ key: key,
179
+ commands: commands,
180
+ password: this._password
181
+ };
182
+ let rs = await HttpTool_1.gHttpTool.post({ url: this._url, json: msg });
183
+ return rs.body;
184
+ }
185
+ async anyCall(call, ...args) {
186
+ let msg = {
187
+ cmd: call,
188
+ args: args,
189
+ password: this._password
190
+ };
191
+ let rs = await HttpTool_1.gHttpTool.post({ url: this._url, json: msg });
192
+ return rs.body;
193
+ }
194
+ }
195
+ exports.CgRankTool = CgRankTool;
196
+ exports.gCgRankTool = new CgRankTool();
@@ -26,6 +26,7 @@ const ControllerManager_1 = require("./WebServer/Engine/ControllerManager");
26
26
  const cgserver_1 = require("./cgserver");
27
27
  const Core_1 = require("./Core/Core");
28
28
  const RedisManager_1 = require("./Database/Redis/RedisManager");
29
+ const CgRankTool_1 = require("./ThirdParty/CgRankTool");
29
30
  /**
30
31
  * cg引擎的,全局对象
31
32
  */
@@ -53,6 +54,7 @@ class global {
53
54
  static gAlipayTool = AlipayTool_1.gAlipayTool;
54
55
  static gAppleTool = AppleTool_1.gAppleTool;
55
56
  static gProtoFactory = ProtoFactory_1.gProtoFactory;
57
+ static gCgRankTool = CgRankTool_1.gCgRankTool;
56
58
  /**
57
59
  * web服务中mvc的控制器管理器
58
60
  */
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EProtoType = exports.RedisManager = exports.RedisConfig = exports.MysqlConfig = exports.MongoConfig = exports.MSSqlConfig = exports.DbConfig = exports.MongoCacheService = exports.MongoCacheModel = exports.MongoUserModel = exports.MysqlUserModel = exports.MongoUserService = exports.MysqlUserService = exports.MongoAccountService = exports.MysqlAccountService = exports.EAccountFrom = exports.EUserState = exports.ERoleGroup = exports.SqlReturns = exports.SqlReturn = exports.MysqlBaseService = exports.MongoExt = exports.MongoManager = 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.IServerConfig = exports.FrameworkConfig = exports.Config = exports.FrameworkErrorCode = exports.Trigger = exports.Point = exports.Entity = exports.BehaviorAI = exports.AStar = exports.AiObject = exports.MongoServiceManager = exports.CgRankRankData = exports.CgRankRankItem = exports.CgRankCommandItem = exports.GCgRankTool = void 0;
3
+ exports.EProtoType = exports.RedisManager = exports.RedisConfig = exports.MysqlConfig = exports.MongoConfig = exports.MSSqlConfig = exports.DbConfig = exports.MongoCacheService = exports.MongoCacheModel = exports.MongoUserModel = exports.MysqlUserModel = exports.MongoUserService = exports.MysqlUserService = exports.MongoAccountService = exports.MysqlAccountService = exports.EAccountFrom = exports.EUserState = exports.ERoleGroup = exports.SqlReturns = exports.SqlReturn = exports.MysqlBaseService = exports.MongoExt = exports.MongoManager = 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.IServerConfig = exports.FrameworkConfig = exports.Config = exports.FrameworkErrorCode = exports.Trigger = exports.Point = exports.Entity = exports.BehaviorAI = exports.AStar = exports.AiObject = exports.MongoServiceManager = exports.CgRankRankData = exports.CgRankRankItem = exports.CgRankCommandItem = exports.CgRankTool = void 0;
4
4
  exports.global = exports.SyncCallServer2 = exports.SyncCallServer = exports.SyncCall2 = exports.SyncCall = exports.IRpcClientWebSocket = exports.IRpcServerWebSocket = exports.RpcConfig = exports.CgMq = exports.Rpc = exports.RpcBaseMsg = exports.EAccountState = exports.WebServerConfig = exports.Response = exports.Request = exports.RazorJs = exports.Engine = exports.JsonCreatorValidate = exports.JsonAuthorityValidate = exports.JsonAdminValidate = exports.CreatorValidate = exports.AuthorityValidate = exports.AdminValidate = exports.MongoAccountModel = exports.MysqlAccountModel = exports.MongoBaseUserController = exports.MysqlBaseUserController = exports.BaseController = exports.IWebServer = exports.AlipayCallBack = exports.AlipayResult = exports.BaseMsg = exports.IWebSocket = exports.ISocketServer = exports.IClientWebSocket = exports.IServerWebSocket = exports.JsonProtoFilter = exports.GoogleProtoFilter = void 0;
5
- var CgRankToo_1 = require("./ThirdParty/CgRankToo");
6
- Object.defineProperty(exports, "GCgRankTool", { enumerable: true, get: function () { return CgRankToo_1.GCgRankTool; } });
7
- Object.defineProperty(exports, "CgRankCommandItem", { enumerable: true, get: function () { return CgRankToo_1.CgRankCommandItem; } });
8
- Object.defineProperty(exports, "CgRankRankItem", { enumerable: true, get: function () { return CgRankToo_1.CgRankRankItem; } });
9
- Object.defineProperty(exports, "CgRankRankData", { enumerable: true, get: function () { return CgRankToo_1.CgRankRankData; } });
5
+ var CgRankTool_1 = require("./ThirdParty/CgRankTool");
6
+ Object.defineProperty(exports, "CgRankTool", { enumerable: true, get: function () { return CgRankTool_1.CgRankTool; } });
7
+ Object.defineProperty(exports, "CgRankCommandItem", { enumerable: true, get: function () { return CgRankTool_1.CgRankCommandItem; } });
8
+ Object.defineProperty(exports, "CgRankRankItem", { enumerable: true, get: function () { return CgRankTool_1.CgRankRankItem; } });
9
+ Object.defineProperty(exports, "CgRankRankData", { enumerable: true, get: function () { return CgRankTool_1.CgRankRankData; } });
10
10
  var MongoServiceManager_1 = require("./Database/Mongo/MongoServiceManager");
11
11
  Object.defineProperty(exports, "MongoServiceManager", { enumerable: true, get: function () { return MongoServiceManager_1.MongoServiceManager; } });
12
12
  var AiObject_1 = require("./AI/AiObject");
@@ -28,9 +28,10 @@ export declare class CgRankCommandItem {
28
28
  [key: string]: number;
29
29
  };
30
30
  }
31
- declare class CgRankTool {
31
+ export declare class CgRankTool {
32
32
  protected _url: string;
33
- init(url: string): boolean;
33
+ protected _password: string;
34
+ init(url: string, password: string): boolean;
34
35
  /**
35
36
  *
36
37
  * @param key 排行榜的关键字
@@ -100,4 +101,3 @@ declare class CgRankTool {
100
101
  }>;
101
102
  }
102
103
  export declare let GCgRankTool: CgRankTool;
103
- export {};
@@ -0,0 +1,103 @@
1
+ export declare class CgRankErrcode {
2
+ id: number;
3
+ des: string;
4
+ }
5
+ export declare class CgRankRankItem {
6
+ id: string;
7
+ score: number;
8
+ rank: number;
9
+ other: {
10
+ [key: string]: any;
11
+ };
12
+ }
13
+ export declare class CgRankRankData {
14
+ key: string;
15
+ maps: {
16
+ [id: string]: CgRankRankItem;
17
+ };
18
+ list: CgRankRankItem[];
19
+ timeout: number;
20
+ }
21
+ export declare class CgRankCommandItem {
22
+ id: string;
23
+ score: number;
24
+ inc: {
25
+ [key: string]: number;
26
+ };
27
+ set: {
28
+ [key: string]: number;
29
+ };
30
+ }
31
+ export declare class CgRankTool {
32
+ protected _url: string;
33
+ protected _password: string;
34
+ init(url: string, password: string): boolean;
35
+ /**
36
+ *
37
+ * @param key 排行榜的关键字
38
+ * @returns
39
+ */
40
+ removeRank(key: string): Promise<{
41
+ errcode?: CgRankErrcode;
42
+ }>;
43
+ saveAllRank(): Promise<{
44
+ keys: string[];
45
+ }>;
46
+ getRankItem(key: string, id: string): Promise<{
47
+ rank: CgRankRankItem;
48
+ }>;
49
+ getRankItems(key: string, ids: string[]): Promise<{
50
+ ranks: {
51
+ [id: string]: CgRankRankItem;
52
+ };
53
+ }>;
54
+ /**
55
+ *
56
+ * @param key
57
+ * @param start
58
+ * @param count 小于等于0表示全部
59
+ */
60
+ getRankList(key: string, start: number, count: number): Promise<{
61
+ ranks: CgRankRankItem[];
62
+ }>;
63
+ getRankCount(key: string): Promise<{
64
+ count: number;
65
+ }>;
66
+ getRevRankList(key: string, start: number, count: number): Promise<{
67
+ ranks: CgRankRankItem[];
68
+ }>;
69
+ addToRank(key: string, id: string, score: number, other: any, isreplace?: boolean): Promise<{
70
+ rank: CgRankRankItem;
71
+ }>;
72
+ addsToRank(key: string, datas: {
73
+ [id: string]: CgRankCommandItem;
74
+ }, isreplace?: boolean): Promise<{
75
+ ranks: {
76
+ [id: string]: CgRankRankItem;
77
+ };
78
+ }>;
79
+ removeFromRank(key: string, id: string): Promise<{
80
+ rank: CgRankRankItem;
81
+ }>;
82
+ updateInRank(key: string, command: CgRankCommandItem): Promise<{
83
+ rank: CgRankRankItem;
84
+ }>;
85
+ updatesInRank(key: string, commands: {
86
+ [id: string]: CgRankCommandItem;
87
+ }): Promise<{
88
+ ranks: {
89
+ [id: string]: CgRankRankItem;
90
+ };
91
+ }>;
92
+ executeCommand(key: string, commands: {
93
+ [id: string]: CgRankCommandItem;
94
+ }): Promise<{
95
+ ranks: {
96
+ [id: string]: CgRankRankItem;
97
+ };
98
+ }>;
99
+ anyCall(call: string, ...args: any[]): Promise<{
100
+ result: any;
101
+ }>;
102
+ }
103
+ export declare let gCgRankTool: CgRankTool;
@@ -26,6 +26,7 @@ export declare class global {
26
26
  static gAlipayTool: import("./ThirdParty/AlipayTool").AlipayTool;
27
27
  static gAppleTool: import("./ThirdParty/AppleTool").AppleTool;
28
28
  static gProtoFactory: import("./SocketServer/ProtoFilter/ProtoFactory").ProtoFactory;
29
+ static gCgRankTool: import("./ThirdParty/CgRankTool").CgRankTool;
29
30
  /**
30
31
  * web服务中mvc的控制器管理器
31
32
  */
@@ -1,4 +1,4 @@
1
- export { GCgRankTool, CgRankCommandItem, CgRankRankItem, CgRankRankData } from './ThirdParty/CgRankToo';
1
+ export { CgRankTool, CgRankCommandItem, CgRankRankItem, CgRankRankData } from './ThirdParty/CgRankTool';
2
2
  export { MongoServiceManager } from './Database/Mongo/MongoServiceManager';
3
3
  export { AiObject } from "./AI/AiObject";
4
4
  export { AStar } from "./AI/Astar";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cgserver",
3
- "version": "10.2.0",
3
+ "version": "10.2.2",
4
4
  "author": "trojan",
5
5
  "type": "commonjs",
6
6
  "description": "free for all.Websocket or Http",