cgserver 10.2.1 → 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的支持
@@ -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,13 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- 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 = exports.GCgRankTool = void 0;
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 = exports.EProtoType = 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, "CgRankTool", { enumerable: true, get: function () { return CgRankToo_1.CgRankTool; } });
8
- Object.defineProperty(exports, "CgRankCommandItem", { enumerable: true, get: function () { return CgRankToo_1.CgRankCommandItem; } });
9
- Object.defineProperty(exports, "CgRankRankItem", { enumerable: true, get: function () { return CgRankToo_1.CgRankRankItem; } });
10
- Object.defineProperty(exports, "CgRankRankData", { enumerable: true, get: function () { return CgRankToo_1.CgRankRankData; } });
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
+ 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 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; } });
11
10
  var MongoServiceManager_1 = require("./Database/Mongo/MongoServiceManager");
12
11
  Object.defineProperty(exports, "MongoServiceManager", { enumerable: true, get: function () { return MongoServiceManager_1.MongoServiceManager; } });
13
12
  var AiObject_1 = require("./AI/AiObject");
@@ -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, CgRankTool, 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.1",
3
+ "version": "10.2.2",
4
4
  "author": "trojan",
5
5
  "type": "commonjs",
6
6
  "description": "free for all.Websocket or Http",