cgserver 8.6.7 → 8.6.10
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/Framework/AI/AiObject.js +10 -10
- package/dist/lib/Framework/AI/Astar.js +133 -133
- package/dist/lib/Framework/AI/BehaviorAI.js +307 -307
- package/dist/lib/Framework/AI/Entity.js +33 -33
- package/dist/lib/Framework/AI/Point.js +68 -68
- package/dist/lib/Framework/AI/TriggerMgr.js +201 -201
- package/dist/lib/Framework/Config/Config.js +53 -53
- package/dist/lib/Framework/Config/DbConfig.js +14 -0
- package/dist/lib/Framework/Config/FrameworkConfig.js +207 -240
- package/dist/lib/Framework/Config/IServerConfig.js +26 -26
- package/dist/lib/Framework/Config/_error_.js +35 -35
- package/dist/lib/Framework/Core/Core.js +639 -639
- package/dist/lib/Framework/Core/Timer.js +116 -116
- package/dist/lib/Framework/Database/Decorator/AutoIncrement.js +11 -11
- package/dist/lib/Framework/Database/Decorator/DBCache.js +64 -64
- package/dist/lib/Framework/Database/Decorator/NotNull.js +11 -11
- package/dist/lib/Framework/Database/Decorator/PrimaryKey.js +11 -11
- package/dist/lib/Framework/Database/Decorator/Property.js +61 -61
- package/dist/lib/Framework/Database/Decorator/Table.js +15 -15
- package/dist/lib/Framework/Database/Decorator/Type.js +20 -20
- package/dist/lib/Framework/Database/MSSqlManager.js +53 -43
- package/dist/lib/Framework/Database/MongoBaseService.js +117 -117
- package/dist/lib/Framework/Database/MongoManager.js +462 -462
- package/dist/lib/Framework/Database/MysqlBaseService.js +281 -281
- package/dist/lib/Framework/Database/MysqlManager.js +179 -180
- package/dist/lib/Framework/Database/RedisManager.js +61 -53
- package/dist/lib/Framework/Decorator/AdminValidate.js +19 -19
- package/dist/lib/Framework/Decorator/AuthorityValidate.js +22 -22
- package/dist/lib/Framework/Decorator/CreatorValidate.js +19 -19
- package/dist/lib/Framework/Decorator/JsonAdminValidate.js +15 -15
- package/dist/lib/Framework/Decorator/JsonAuthorityValidate.js +20 -20
- package/dist/lib/Framework/Decorator/JsonCreatorValidate.js +19 -19
- package/dist/lib/Framework/Decorator/SyncCall.js +42 -42
- package/dist/lib/Framework/Decorator/SyncCallServer.js +77 -77
- package/dist/lib/Framework/Logic/CacheTool.js +73 -73
- package/dist/lib/Framework/Logic/EventTool.js +27 -27
- package/dist/lib/Framework/Logic/HttpTool.js +75 -75
- package/dist/lib/Framework/Logic/Log.js +140 -140
- package/dist/lib/Framework/Logic/SyncQueueTool.js +43 -43
- package/dist/lib/Framework/Service/MongoAccountService.js +367 -367
- package/dist/lib/Framework/Service/MongoCacheService.js +42 -42
- package/dist/lib/Framework/Service/MongoUserService.js +100 -100
- package/dist/lib/Framework/Service/MysqlAccountService.js +441 -441
- package/dist/lib/Framework/Service/MysqlUserService.js +171 -171
- package/dist/lib/Framework/Service/ini.js +36 -36
- package/dist/lib/Framework/SocketServer/IClientWebSocket.js +44 -44
- package/dist/lib/Framework/SocketServer/IRpc.js +12 -12
- package/dist/lib/Framework/SocketServer/IRpcClientWebSocket.js +63 -63
- package/dist/lib/Framework/SocketServer/IRpcServerWebSocket.js +63 -63
- package/dist/lib/Framework/SocketServer/IServerWebSocket.js +75 -75
- package/dist/lib/Framework/SocketServer/ISocketServer.js +205 -202
- package/dist/lib/Framework/SocketServer/IWebSocket.js +195 -195
- package/dist/lib/Framework/SocketServer/ProtoFilter/GoogleProtoFilter.js +57 -57
- package/dist/lib/Framework/SocketServer/ProtoFilter/IProtoFilter.js +8 -8
- package/dist/lib/Framework/SocketServer/ProtoFilter/JsonProtoFilter.js +29 -29
- package/dist/lib/Framework/SocketServer/ProtoFilter/ProtoFactory.js +31 -31
- package/dist/lib/Framework/ThirdParty/AlipayTool.js +203 -203
- package/dist/lib/Framework/ThirdParty/Alisms.js +46 -46
- package/dist/lib/Framework/ThirdParty/AppleTool.js +234 -234
- package/dist/lib/Framework/ThirdParty/CgMq.js +132 -132
- package/dist/lib/Framework/ThirdParty/EmailTool.js +33 -33
- package/dist/lib/Framework/ThirdParty/OpenSocial.js +32 -32
- package/dist/lib/Framework/ThirdParty/QQTool.js +118 -118
- package/dist/lib/Framework/ThirdParty/QiniuTool.js +21 -21
- package/dist/lib/Framework/ThirdParty/Rpc.js +63 -63
- package/dist/lib/Framework/ThirdParty/WechatOATool.js +61 -61
- package/dist/lib/Framework/ThirdParty/WechatTool.js +74 -74
- package/dist/lib/Framework/WebServer/Controller/BaseController.js +112 -112
- package/dist/lib/Framework/WebServer/Controller/MongoBaseUserController.js +169 -169
- package/dist/lib/Framework/WebServer/Controller/MysqlBaseUserController.js +169 -169
- package/dist/lib/Framework/WebServer/Engine/ControllerManager.js +112 -112
- package/dist/lib/Framework/WebServer/Engine/Engine.js +152 -153
- package/dist/lib/Framework/WebServer/Engine/RazorJs.js +544 -544
- package/dist/lib/Framework/WebServer/Engine/Request.js +237 -237
- package/dist/lib/Framework/WebServer/Engine/Response.js +100 -100
- package/dist/lib/Framework/WebServer/IWebServer.js +59 -54
- package/dist/lib/Framework/cgserver.js +121 -111
- package/dist/lib/Framework/index.js +201 -191
- package/dist/lib/test/test.js +21 -21
- package/dist/types/Framework/AI/AiObject.d.ts +5 -5
- package/dist/types/Framework/AI/Astar.d.ts +38 -38
- package/dist/types/Framework/AI/BehaviorAI.d.ts +24 -24
- package/dist/types/Framework/AI/Entity.d.ts +12 -12
- package/dist/types/Framework/AI/Point.d.ts +17 -17
- package/dist/types/Framework/AI/TriggerMgr.d.ts +52 -52
- package/dist/types/Framework/Config/Config.d.ts +12 -12
- package/dist/types/Framework/Config/DbConfig.d.ts +10 -0
- package/dist/types/Framework/Config/FrameworkConfig.d.ts +203 -228
- package/dist/types/Framework/Config/IServerConfig.d.ts +9 -9
- package/dist/types/Framework/Config/_error_.d.ts +99 -99
- package/dist/types/Framework/Core/Core.d.ts +108 -108
- package/dist/types/Framework/Core/Timer.d.ts +16 -16
- package/dist/types/Framework/Database/Decorator/AutoIncrement.d.ts +1 -1
- package/dist/types/Framework/Database/Decorator/DBCache.d.ts +23 -23
- package/dist/types/Framework/Database/Decorator/NotNull.d.ts +1 -1
- package/dist/types/Framework/Database/Decorator/PrimaryKey.d.ts +1 -1
- package/dist/types/Framework/Database/Decorator/Property.d.ts +57 -57
- package/dist/types/Framework/Database/Decorator/Table.d.ts +1 -1
- package/dist/types/Framework/Database/Decorator/Type.d.ts +1 -1
- package/dist/types/Framework/Database/MSSqlManager.d.ts +27 -17
- package/dist/types/Framework/Database/MongoBaseService.d.ts +81 -81
- package/dist/types/Framework/Database/MongoManager.d.ts +156 -156
- package/dist/types/Framework/Database/MysqlBaseService.d.ts +34 -34
- package/dist/types/Framework/Database/MysqlManager.d.ts +53 -41
- package/dist/types/Framework/Database/RedisManager.d.ts +24 -17
- package/dist/types/Framework/Decorator/AdminValidate.d.ts +1 -1
- package/dist/types/Framework/Decorator/AuthorityValidate.d.ts +2 -2
- package/dist/types/Framework/Decorator/CreatorValidate.d.ts +1 -1
- package/dist/types/Framework/Decorator/JsonAdminValidate.d.ts +1 -1
- package/dist/types/Framework/Decorator/JsonAuthorityValidate.d.ts +2 -2
- package/dist/types/Framework/Decorator/JsonCreatorValidate.d.ts +1 -1
- package/dist/types/Framework/Decorator/SyncCall.d.ts +12 -12
- package/dist/types/Framework/Decorator/SyncCallServer.d.ts +14 -14
- package/dist/types/Framework/Logic/CacheTool.d.ts +27 -27
- package/dist/types/Framework/Logic/EventTool.d.ts +13 -13
- package/dist/types/Framework/Logic/HttpTool.d.ts +15 -15
- package/dist/types/Framework/Logic/Log.d.ts +25 -25
- package/dist/types/Framework/Logic/SyncQueueTool.d.ts +21 -21
- package/dist/types/Framework/Service/MongoAccountService.d.ts +69 -69
- package/dist/types/Framework/Service/MongoCacheService.d.ts +14 -14
- package/dist/types/Framework/Service/MongoUserService.d.ts +35 -35
- package/dist/types/Framework/Service/MysqlAccountService.d.ts +74 -74
- package/dist/types/Framework/Service/MysqlUserService.d.ts +33 -33
- package/dist/types/Framework/Service/ini.d.ts +29 -29
- package/dist/types/Framework/SocketServer/IClientWebSocket.d.ts +17 -17
- package/dist/types/Framework/SocketServer/IRpc.d.ts +8 -8
- package/dist/types/Framework/SocketServer/IRpcClientWebSocket.d.ts +16 -16
- package/dist/types/Framework/SocketServer/IRpcServerWebSocket.d.ts +16 -16
- package/dist/types/Framework/SocketServer/IServerWebSocket.d.ts +28 -28
- package/dist/types/Framework/SocketServer/ISocketServer.d.ts +45 -45
- package/dist/types/Framework/SocketServer/IWebSocket.d.ts +60 -60
- package/dist/types/Framework/SocketServer/ProtoFilter/GoogleProtoFilter.d.ts +9 -9
- package/dist/types/Framework/SocketServer/ProtoFilter/IProtoFilter.d.ts +9 -9
- package/dist/types/Framework/SocketServer/ProtoFilter/JsonProtoFilter.d.ts +6 -6
- package/dist/types/Framework/SocketServer/ProtoFilter/ProtoFactory.d.ts +8 -8
- package/dist/types/Framework/ThirdParty/AlipayTool.d.ts +109 -109
- package/dist/types/Framework/ThirdParty/Alisms.d.ts +14 -14
- package/dist/types/Framework/ThirdParty/AppleTool.d.ts +131 -131
- package/dist/types/Framework/ThirdParty/CgMq.d.ts +51 -51
- package/dist/types/Framework/ThirdParty/EmailTool.d.ts +5 -5
- package/dist/types/Framework/ThirdParty/OpenSocial.d.ts +7 -7
- package/dist/types/Framework/ThirdParty/QQTool.d.ts +41 -41
- package/dist/types/Framework/ThirdParty/QiniuTool.d.ts +6 -6
- package/dist/types/Framework/ThirdParty/Rpc.d.ts +20 -20
- package/dist/types/Framework/ThirdParty/WechatOATool.d.ts +13 -13
- package/dist/types/Framework/ThirdParty/WechatTool.d.ts +20 -20
- package/dist/types/Framework/WebServer/Controller/BaseController.d.ts +33 -33
- package/dist/types/Framework/WebServer/Controller/MongoBaseUserController.d.ts +27 -27
- package/dist/types/Framework/WebServer/Controller/MysqlBaseUserController.d.ts +27 -27
- package/dist/types/Framework/WebServer/Engine/ControllerManager.d.ts +35 -35
- package/dist/types/Framework/WebServer/Engine/Engine.d.ts +21 -21
- package/dist/types/Framework/WebServer/Engine/RazorJs.d.ts +21 -21
- package/dist/types/Framework/WebServer/Engine/Request.d.ts +35 -35
- package/dist/types/Framework/WebServer/Engine/Response.d.ts +30 -30
- package/dist/types/Framework/WebServer/IWebServer.d.ts +20 -20
- package/dist/types/Framework/cgserver.d.ts +27 -25
- package/dist/types/Framework/index.d.ts +91 -86
- package/dist/types/test/test.d.ts +1 -1
- package/package.json +29 -32
|
@@ -1,156 +1,156 @@
|
|
|
1
|
-
import * as mongo from 'mongodb';
|
|
2
|
-
export declare class MongoConfig {
|
|
3
|
-
open: boolean;
|
|
4
|
-
host: string;
|
|
5
|
-
port: number;
|
|
6
|
-
options: mongo.MongoClientOptions;
|
|
7
|
-
database: string;
|
|
8
|
-
}
|
|
9
|
-
export declare class MongoBaseModel {
|
|
10
|
-
_id: any;
|
|
11
|
-
}
|
|
12
|
-
export declare class MrResult {
|
|
13
|
-
/**
|
|
14
|
-
* select 的数据量
|
|
15
|
-
*/
|
|
16
|
-
length: number;
|
|
17
|
-
/**
|
|
18
|
-
* 插入数据的自增id
|
|
19
|
-
*/
|
|
20
|
-
insertId: number;
|
|
21
|
-
insertIds: {
|
|
22
|
-
[key: number]: number;
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* update 更新数据的影响条数
|
|
26
|
-
*/
|
|
27
|
-
changedRows: number;
|
|
28
|
-
/**
|
|
29
|
-
* 插入或删除数据的影响条数
|
|
30
|
-
*/
|
|
31
|
-
affectedRows: number;
|
|
32
|
-
}
|
|
33
|
-
export declare class MgReturn {
|
|
34
|
-
error: any;
|
|
35
|
-
result: MrResult;
|
|
36
|
-
list: any[];
|
|
37
|
-
}
|
|
38
|
-
export declare let GMongoMgr: MongoManager;
|
|
39
|
-
declare class MongoManager {
|
|
40
|
-
protected _mongocfg: MongoConfig;
|
|
41
|
-
protected _init_cbs: any[];
|
|
42
|
-
protected _mongoDb: mongo.Db;
|
|
43
|
-
get mongoDb(): mongo.Db;
|
|
44
|
-
protected _mongoClient: mongo.MongoClient;
|
|
45
|
-
get mongoClient(): mongo.MongoClient;
|
|
46
|
-
protected _mongo_init_succ: boolean;
|
|
47
|
-
protected _inited: boolean;
|
|
48
|
-
get isValid(): boolean;
|
|
49
|
-
constructor();
|
|
50
|
-
init(cfg: MongoConfig): Promise<boolean>;
|
|
51
|
-
registerInitCb(cb: Function): void;
|
|
52
|
-
onConnect(): void;
|
|
53
|
-
onEnd(): void;
|
|
54
|
-
onError(err: any): void;
|
|
55
|
-
/**
|
|
56
|
-
* 获取自增长id
|
|
57
|
-
* @param key
|
|
58
|
-
* @returns 小于等于0为异常
|
|
59
|
-
*/
|
|
60
|
-
getAutoIds(key: string): Promise<number>;
|
|
61
|
-
protected _convertWhere(where?: any): any;
|
|
62
|
-
/**
|
|
63
|
-
* 获取单条消息
|
|
64
|
-
* @param collection
|
|
65
|
-
*/
|
|
66
|
-
findOne(collection: string, property?: {}, where?: {}): Promise<{
|
|
67
|
-
errcode: {
|
|
68
|
-
id: number;
|
|
69
|
-
des: string;
|
|
70
|
-
};
|
|
71
|
-
one: any;
|
|
72
|
-
}>;
|
|
73
|
-
findMany(collection: string, property?: {}, where?: {}, sort?: {}, skip?: number, limit?: number): Promise<{
|
|
74
|
-
errcode: {
|
|
75
|
-
id: number;
|
|
76
|
-
des: string;
|
|
77
|
-
};
|
|
78
|
-
list: any[];
|
|
79
|
-
}>;
|
|
80
|
-
countDocuments(collection: string, where?: {}, options?: mongo.CountDocumentsOptions): Promise<{
|
|
81
|
-
errcode: {
|
|
82
|
-
id: number;
|
|
83
|
-
des: string;
|
|
84
|
-
};
|
|
85
|
-
count: number;
|
|
86
|
-
}>;
|
|
87
|
-
deleteOne(collection: any, where: any): Promise<{
|
|
88
|
-
errcode: {
|
|
89
|
-
id: number;
|
|
90
|
-
des: string;
|
|
91
|
-
};
|
|
92
|
-
count: number;
|
|
93
|
-
}>;
|
|
94
|
-
deleteMany(collection: any, where: any): Promise<{
|
|
95
|
-
errcode: {
|
|
96
|
-
id: number;
|
|
97
|
-
des: string;
|
|
98
|
-
};
|
|
99
|
-
count: number;
|
|
100
|
-
}>;
|
|
101
|
-
/**
|
|
102
|
-
* 插入数据
|
|
103
|
-
* @param collection
|
|
104
|
-
* @param data
|
|
105
|
-
*/
|
|
106
|
-
insertOne(collection: string, data: any): Promise<{
|
|
107
|
-
errcode: {
|
|
108
|
-
id: number;
|
|
109
|
-
des: string;
|
|
110
|
-
};
|
|
111
|
-
rs: mongo.InsertOneResult<any>;
|
|
112
|
-
}>;
|
|
113
|
-
insertManay(collection: string, data: []): Promise<{
|
|
114
|
-
errcode: {
|
|
115
|
-
id: number;
|
|
116
|
-
des: string;
|
|
117
|
-
};
|
|
118
|
-
rs: mongo.InsertManyResult<any>;
|
|
119
|
-
}>;
|
|
120
|
-
updateOne(collection: string, model?: {}, where?: {}, upsert?: boolean): Promise<{
|
|
121
|
-
errcode: {
|
|
122
|
-
id: number;
|
|
123
|
-
des: string;
|
|
124
|
-
};
|
|
125
|
-
rs: mongo.UpdateResult<mongo.BSON.Document>;
|
|
126
|
-
}>;
|
|
127
|
-
updateMany(collection: string, model: any, where?: {}, upsert?: boolean): Promise<{
|
|
128
|
-
errcode: {
|
|
129
|
-
id: number;
|
|
130
|
-
des: string;
|
|
131
|
-
};
|
|
132
|
-
rs: mongo.BSON.Document | mongo.UpdateResult<mongo.BSON.Document>;
|
|
133
|
-
}>;
|
|
134
|
-
createIndex(collection: string, index: any, options?: mongo.CreateIndexesOptions): Promise<{
|
|
135
|
-
errcode: {
|
|
136
|
-
id: number;
|
|
137
|
-
des: string;
|
|
138
|
-
};
|
|
139
|
-
rs: string;
|
|
140
|
-
}>;
|
|
141
|
-
simpleAggregate(collection: string, property?: {}, where?: {}, size?: number, random_size?: number): Promise<{
|
|
142
|
-
errcode: {
|
|
143
|
-
id: number;
|
|
144
|
-
des: string;
|
|
145
|
-
};
|
|
146
|
-
list: any[];
|
|
147
|
-
}>;
|
|
148
|
-
aggregate(collection: string, pipeline?: Document[], options?: mongo.AggregateOptions): mongo.AggregationCursor<mongo.BSON.Document>;
|
|
149
|
-
/**
|
|
150
|
-
* 快速事务
|
|
151
|
-
* @param collection
|
|
152
|
-
* @param cb
|
|
153
|
-
*/
|
|
154
|
-
quickTransaction(cb: Function, options?: mongo.TransactionOptions): Promise<false | any>;
|
|
155
|
-
}
|
|
156
|
-
export {};
|
|
1
|
+
import * as mongo from 'mongodb';
|
|
2
|
+
export declare class MongoConfig {
|
|
3
|
+
open: boolean;
|
|
4
|
+
host: string;
|
|
5
|
+
port: number;
|
|
6
|
+
options: mongo.MongoClientOptions;
|
|
7
|
+
database: string;
|
|
8
|
+
}
|
|
9
|
+
export declare class MongoBaseModel {
|
|
10
|
+
_id: any;
|
|
11
|
+
}
|
|
12
|
+
export declare class MrResult {
|
|
13
|
+
/**
|
|
14
|
+
* select 的数据量
|
|
15
|
+
*/
|
|
16
|
+
length: number;
|
|
17
|
+
/**
|
|
18
|
+
* 插入数据的自增id
|
|
19
|
+
*/
|
|
20
|
+
insertId: number;
|
|
21
|
+
insertIds: {
|
|
22
|
+
[key: number]: number;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* update 更新数据的影响条数
|
|
26
|
+
*/
|
|
27
|
+
changedRows: number;
|
|
28
|
+
/**
|
|
29
|
+
* 插入或删除数据的影响条数
|
|
30
|
+
*/
|
|
31
|
+
affectedRows: number;
|
|
32
|
+
}
|
|
33
|
+
export declare class MgReturn {
|
|
34
|
+
error: any;
|
|
35
|
+
result: MrResult;
|
|
36
|
+
list: any[];
|
|
37
|
+
}
|
|
38
|
+
export declare let GMongoMgr: MongoManager;
|
|
39
|
+
declare class MongoManager {
|
|
40
|
+
protected _mongocfg: MongoConfig;
|
|
41
|
+
protected _init_cbs: any[];
|
|
42
|
+
protected _mongoDb: mongo.Db;
|
|
43
|
+
get mongoDb(): mongo.Db;
|
|
44
|
+
protected _mongoClient: mongo.MongoClient;
|
|
45
|
+
get mongoClient(): mongo.MongoClient;
|
|
46
|
+
protected _mongo_init_succ: boolean;
|
|
47
|
+
protected _inited: boolean;
|
|
48
|
+
get isValid(): boolean;
|
|
49
|
+
constructor();
|
|
50
|
+
init(cfg: MongoConfig): Promise<boolean>;
|
|
51
|
+
registerInitCb(cb: Function): void;
|
|
52
|
+
onConnect(): void;
|
|
53
|
+
onEnd(): void;
|
|
54
|
+
onError(err: any): void;
|
|
55
|
+
/**
|
|
56
|
+
* 获取自增长id
|
|
57
|
+
* @param key
|
|
58
|
+
* @returns 小于等于0为异常
|
|
59
|
+
*/
|
|
60
|
+
getAutoIds(key: string): Promise<number>;
|
|
61
|
+
protected _convertWhere(where?: any): any;
|
|
62
|
+
/**
|
|
63
|
+
* 获取单条消息
|
|
64
|
+
* @param collection
|
|
65
|
+
*/
|
|
66
|
+
findOne(collection: string, property?: {}, where?: {}): Promise<{
|
|
67
|
+
errcode: {
|
|
68
|
+
id: number;
|
|
69
|
+
des: string;
|
|
70
|
+
};
|
|
71
|
+
one: any;
|
|
72
|
+
}>;
|
|
73
|
+
findMany(collection: string, property?: {}, where?: {}, sort?: {}, skip?: number, limit?: number): Promise<{
|
|
74
|
+
errcode: {
|
|
75
|
+
id: number;
|
|
76
|
+
des: string;
|
|
77
|
+
};
|
|
78
|
+
list: any[];
|
|
79
|
+
}>;
|
|
80
|
+
countDocuments(collection: string, where?: {}, options?: mongo.CountDocumentsOptions): Promise<{
|
|
81
|
+
errcode: {
|
|
82
|
+
id: number;
|
|
83
|
+
des: string;
|
|
84
|
+
};
|
|
85
|
+
count: number;
|
|
86
|
+
}>;
|
|
87
|
+
deleteOne(collection: any, where: any): Promise<{
|
|
88
|
+
errcode: {
|
|
89
|
+
id: number;
|
|
90
|
+
des: string;
|
|
91
|
+
};
|
|
92
|
+
count: number;
|
|
93
|
+
}>;
|
|
94
|
+
deleteMany(collection: any, where: any): Promise<{
|
|
95
|
+
errcode: {
|
|
96
|
+
id: number;
|
|
97
|
+
des: string;
|
|
98
|
+
};
|
|
99
|
+
count: number;
|
|
100
|
+
}>;
|
|
101
|
+
/**
|
|
102
|
+
* 插入数据
|
|
103
|
+
* @param collection
|
|
104
|
+
* @param data
|
|
105
|
+
*/
|
|
106
|
+
insertOne(collection: string, data: any): Promise<{
|
|
107
|
+
errcode: {
|
|
108
|
+
id: number;
|
|
109
|
+
des: string;
|
|
110
|
+
};
|
|
111
|
+
rs: mongo.InsertOneResult<any>;
|
|
112
|
+
}>;
|
|
113
|
+
insertManay(collection: string, data: []): Promise<{
|
|
114
|
+
errcode: {
|
|
115
|
+
id: number;
|
|
116
|
+
des: string;
|
|
117
|
+
};
|
|
118
|
+
rs: mongo.InsertManyResult<any>;
|
|
119
|
+
}>;
|
|
120
|
+
updateOne(collection: string, model?: {}, where?: {}, upsert?: boolean): Promise<{
|
|
121
|
+
errcode: {
|
|
122
|
+
id: number;
|
|
123
|
+
des: string;
|
|
124
|
+
};
|
|
125
|
+
rs: mongo.UpdateResult<mongo.BSON.Document>;
|
|
126
|
+
}>;
|
|
127
|
+
updateMany(collection: string, model: any, where?: {}, upsert?: boolean): Promise<{
|
|
128
|
+
errcode: {
|
|
129
|
+
id: number;
|
|
130
|
+
des: string;
|
|
131
|
+
};
|
|
132
|
+
rs: mongo.BSON.Document | mongo.UpdateResult<mongo.BSON.Document>;
|
|
133
|
+
}>;
|
|
134
|
+
createIndex(collection: string, index: any, options?: mongo.CreateIndexesOptions): Promise<{
|
|
135
|
+
errcode: {
|
|
136
|
+
id: number;
|
|
137
|
+
des: string;
|
|
138
|
+
};
|
|
139
|
+
rs: string;
|
|
140
|
+
}>;
|
|
141
|
+
simpleAggregate(collection: string, property?: {}, where?: {}, size?: number, random_size?: number): Promise<{
|
|
142
|
+
errcode: {
|
|
143
|
+
id: number;
|
|
144
|
+
des: string;
|
|
145
|
+
};
|
|
146
|
+
list: any[];
|
|
147
|
+
}>;
|
|
148
|
+
aggregate(collection: string, pipeline?: Document[], options?: mongo.AggregateOptions): mongo.AggregationCursor<mongo.BSON.Document>;
|
|
149
|
+
/**
|
|
150
|
+
* 快速事务
|
|
151
|
+
* @param collection
|
|
152
|
+
* @param cb
|
|
153
|
+
*/
|
|
154
|
+
quickTransaction(cb: Function, options?: mongo.TransactionOptions): Promise<false | any>;
|
|
155
|
+
}
|
|
156
|
+
export {};
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
export declare class BaseModel {
|
|
2
|
-
}
|
|
3
|
-
export declare class MysqlBaseService<T extends BaseModel> {
|
|
4
|
-
protected _table: string;
|
|
5
|
-
get table(): string;
|
|
6
|
-
get version(): number;
|
|
7
|
-
protected _inited: boolean;
|
|
8
|
-
get isInited(): boolean;
|
|
9
|
-
protected _t_type: {
|
|
10
|
-
new (): T;
|
|
11
|
-
};
|
|
12
|
-
constructor(type: {
|
|
13
|
-
new (): T;
|
|
14
|
-
});
|
|
15
|
-
protected _init(): Promise<void>;
|
|
16
|
-
protected _onReCreated(): Promise<void>;
|
|
17
|
-
protected _onDroped(): Promise<void>;
|
|
18
|
-
protected _checkDropTable(cur_version: number): Promise<boolean>;
|
|
19
|
-
/**
|
|
20
|
-
* 没有id的表不能使用该函数
|
|
21
|
-
* @param id
|
|
22
|
-
*/
|
|
23
|
-
getById(id: any): Promise<T>;
|
|
24
|
-
get(proterty?: string, where?: string, args?: Array<any>): Promise<any>;
|
|
25
|
-
getTotal(where?: string, args?: Array<any>): Promise<number>;
|
|
26
|
-
gets(proterty?: string, where?: string, args?: Array<any>): Promise<any[]>;
|
|
27
|
-
getCount(where?: string, args?: Array<any>): Promise<any>;
|
|
28
|
-
getRandoms(num: number, proterty?: string, where?: string, args?: Array<any>): Promise<any[]>;
|
|
29
|
-
updateProperty(set: string, where?: string, args?: Array<any>, limit?: number): Promise<import("./MysqlManager").SqlReturn>;
|
|
30
|
-
update(model: T, where?: string, args?: Array<any>, limit?: number): Promise<import("./MysqlManager").SqlReturn>;
|
|
31
|
-
insert(model: T, ip?: string): Promise<import("./MysqlManager").SqlReturn>;
|
|
32
|
-
removeById(id: any): Promise<import("./MysqlManager").SqlReturn>;
|
|
33
|
-
remove(where: string, args?: Array<any>): Promise<import("./MysqlManager").SqlReturn>;
|
|
34
|
-
}
|
|
1
|
+
export declare class BaseModel {
|
|
2
|
+
}
|
|
3
|
+
export declare class MysqlBaseService<T extends BaseModel> {
|
|
4
|
+
protected _table: string;
|
|
5
|
+
get table(): string;
|
|
6
|
+
get version(): number;
|
|
7
|
+
protected _inited: boolean;
|
|
8
|
+
get isInited(): boolean;
|
|
9
|
+
protected _t_type: {
|
|
10
|
+
new (): T;
|
|
11
|
+
};
|
|
12
|
+
constructor(type: {
|
|
13
|
+
new (): T;
|
|
14
|
+
});
|
|
15
|
+
protected _init(): Promise<void>;
|
|
16
|
+
protected _onReCreated(): Promise<void>;
|
|
17
|
+
protected _onDroped(): Promise<void>;
|
|
18
|
+
protected _checkDropTable(cur_version: number): Promise<boolean>;
|
|
19
|
+
/**
|
|
20
|
+
* 没有id的表不能使用该函数
|
|
21
|
+
* @param id
|
|
22
|
+
*/
|
|
23
|
+
getById(id: any): Promise<T>;
|
|
24
|
+
get(proterty?: string, where?: string, args?: Array<any>): Promise<any>;
|
|
25
|
+
getTotal(where?: string, args?: Array<any>): Promise<number>;
|
|
26
|
+
gets(proterty?: string, where?: string, args?: Array<any>): Promise<any[]>;
|
|
27
|
+
getCount(where?: string, args?: Array<any>): Promise<any>;
|
|
28
|
+
getRandoms(num: number, proterty?: string, where?: string, args?: Array<any>): Promise<any[]>;
|
|
29
|
+
updateProperty(set: string, where?: string, args?: Array<any>, limit?: number): Promise<import("./MysqlManager").SqlReturn>;
|
|
30
|
+
update(model: T, where?: string, args?: Array<any>, limit?: number): Promise<import("./MysqlManager").SqlReturn>;
|
|
31
|
+
insert(model: T, ip?: string): Promise<import("./MysqlManager").SqlReturn>;
|
|
32
|
+
removeById(id: any): Promise<import("./MysqlManager").SqlReturn>;
|
|
33
|
+
remove(where: string, args?: Array<any>): Promise<import("./MysqlManager").SqlReturn>;
|
|
34
|
+
}
|
|
@@ -1,41 +1,53 @@
|
|
|
1
|
-
import * as mysql from 'mysql';
|
|
2
|
-
export declare class
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
*
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
1
|
+
import * as mysql from 'mysql';
|
|
2
|
+
export declare class MysqlConfig {
|
|
3
|
+
open: boolean;
|
|
4
|
+
auto: boolean;
|
|
5
|
+
host: string;
|
|
6
|
+
port: number;
|
|
7
|
+
user: string;
|
|
8
|
+
password: string;
|
|
9
|
+
database: string;
|
|
10
|
+
charset: string;
|
|
11
|
+
supportBigNumbers: boolean;
|
|
12
|
+
connectionLimit: number;
|
|
13
|
+
}
|
|
14
|
+
export declare class SqlResult {
|
|
15
|
+
/**
|
|
16
|
+
* select 的数据量
|
|
17
|
+
*/
|
|
18
|
+
length: number;
|
|
19
|
+
/**
|
|
20
|
+
* 插入数据的自增id
|
|
21
|
+
*/
|
|
22
|
+
insertId: number;
|
|
23
|
+
/**
|
|
24
|
+
* update 更新数据的影响条数
|
|
25
|
+
*/
|
|
26
|
+
changedRows: number;
|
|
27
|
+
/**
|
|
28
|
+
* 插入或删除数据的影响条数
|
|
29
|
+
*/
|
|
30
|
+
affectedRows: number;
|
|
31
|
+
}
|
|
32
|
+
export declare class SqlReturn {
|
|
33
|
+
error: any;
|
|
34
|
+
results: SqlResult;
|
|
35
|
+
fields: any;
|
|
36
|
+
list: Array<any>;
|
|
37
|
+
}
|
|
38
|
+
export declare class SqlReturns {
|
|
39
|
+
error: any;
|
|
40
|
+
srs: Array<SqlResult>;
|
|
41
|
+
}
|
|
42
|
+
export declare let GMysqlMgr: MysqlManager;
|
|
43
|
+
declare class MysqlManager {
|
|
44
|
+
protected _init_cbs: any[];
|
|
45
|
+
protected _pool: mysql.Pool;
|
|
46
|
+
get isValid(): boolean;
|
|
47
|
+
constructor();
|
|
48
|
+
init(cfg: MysqlConfig): Promise<void>;
|
|
49
|
+
registerInitCb(cb: Function): void;
|
|
50
|
+
query(sqlStr: any, values?: any, no_err_log?: boolean): Promise<SqlReturn>;
|
|
51
|
+
transaction(sqls: any): Promise<SqlReturns>;
|
|
52
|
+
}
|
|
53
|
+
export {};
|
|
@@ -1,17 +1,24 @@
|
|
|
1
|
-
import * as redis from 'redis';
|
|
2
|
-
declare
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
1
|
+
import * as redis from 'redis';
|
|
2
|
+
export declare class RedisConfig {
|
|
3
|
+
open: boolean;
|
|
4
|
+
host: string;
|
|
5
|
+
port: number;
|
|
6
|
+
database: number;
|
|
7
|
+
password: any;
|
|
8
|
+
}
|
|
9
|
+
type RedisClientType = redis.RedisClientType<redis.RedisDefaultModules & redis.RedisModules, redis.RedisFunctions, redis.RedisScripts>;
|
|
10
|
+
export declare let GRedisMgr: RedisManager & RedisClientType;
|
|
11
|
+
export declare class RedisManager {
|
|
12
|
+
protected _redis: RedisClientType;
|
|
13
|
+
get redis(): RedisClientType;
|
|
14
|
+
protected _redisCfg: {
|
|
15
|
+
open: boolean;
|
|
16
|
+
} & redis.RedisClientOptions;
|
|
17
|
+
init(redisCfg: {
|
|
18
|
+
open: boolean;
|
|
19
|
+
} & redis.RedisClientOptions): Promise<unknown>;
|
|
20
|
+
onConnect(): void;
|
|
21
|
+
onEnd(): void;
|
|
22
|
+
onError(err: any): void;
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function AdminValidate(target: any, propertyName: string, descriptor: TypedPropertyDescriptor<Function>): void;
|
|
1
|
+
export declare function AdminValidate(target: any, propertyName: string, descriptor: TypedPropertyDescriptor<Function>): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ERoleGroup } from "../Service/ini";
|
|
2
|
-
export declare let AuthorityValidate: (rg?: ERoleGroup, ctr_name?: string) => (target: any, propertyName: string, descriptor: TypedPropertyDescriptor<Function>) => void;
|
|
1
|
+
import { ERoleGroup } from "../Service/ini";
|
|
2
|
+
export declare let AuthorityValidate: (rg?: ERoleGroup, ctr_name?: string) => (target: any, propertyName: string, descriptor: TypedPropertyDescriptor<Function>) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function CreatorValidate(target: any, propertyName: string, descriptor: TypedPropertyDescriptor<Function>): void;
|
|
1
|
+
export declare function CreatorValidate(target: any, propertyName: string, descriptor: TypedPropertyDescriptor<Function>): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function JsonAdminValidate(target: any, propertyName: string, descriptor: TypedPropertyDescriptor<Function>): void;
|
|
1
|
+
export declare function JsonAdminValidate(target: any, propertyName: string, descriptor: TypedPropertyDescriptor<Function>): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ERoleGroup } from "../Service/ini";
|
|
2
|
-
export declare let JsonAuthorityValidate: (rg?: ERoleGroup) => (target: any, propertyName: string, descriptor: TypedPropertyDescriptor<Function>) => void;
|
|
1
|
+
import { ERoleGroup } from "../Service/ini";
|
|
2
|
+
export declare let JsonAuthorityValidate: (rg?: ERoleGroup) => (target: any, propertyName: string, descriptor: TypedPropertyDescriptor<Function>) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function JsonCreatorValidate(target: any, propertyName: string, descriptor: TypedPropertyDescriptor<Function>): void;
|
|
1
|
+
export declare function JsonCreatorValidate(target: any, propertyName: string, descriptor: TypedPropertyDescriptor<Function>): void;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 异步函数变为同步函数,当前进程有效
|
|
3
|
-
* @param target
|
|
4
|
-
* @param propertyName
|
|
5
|
-
* @param descriptor
|
|
6
|
-
*/
|
|
7
|
-
export declare function SyncCall(target: any, propertyName: string, descriptor: TypedPropertyDescriptor<Function>): void;
|
|
8
|
-
/**
|
|
9
|
-
* 异步函数变为同步函数,当前进程有效
|
|
10
|
-
* @param param_index 动态参数的索引
|
|
11
|
-
*/
|
|
12
|
-
export declare function SyncCall2(param_index?: number): (target: any, propertyName: string, descriptor: TypedPropertyDescriptor<Function>) => void;
|
|
1
|
+
/**
|
|
2
|
+
* 异步函数变为同步函数,当前进程有效
|
|
3
|
+
* @param target
|
|
4
|
+
* @param propertyName
|
|
5
|
+
* @param descriptor
|
|
6
|
+
*/
|
|
7
|
+
export declare function SyncCall(target: any, propertyName: string, descriptor: TypedPropertyDescriptor<Function>): void;
|
|
8
|
+
/**
|
|
9
|
+
* 异步函数变为同步函数,当前进程有效
|
|
10
|
+
* @param param_index 动态参数的索引
|
|
11
|
+
*/
|
|
12
|
+
export declare function SyncCall2(param_index?: number): (target: any, propertyName: string, descriptor: TypedPropertyDescriptor<Function>) => void;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 异步函数变为同步函数
|
|
3
|
-
* 服务器间的异步,效率低
|
|
4
|
-
* 只支持mongo模式
|
|
5
|
-
* @returns
|
|
6
|
-
*/
|
|
7
|
-
export declare function SyncCallServer(target: any, propertyName: string, descriptor: TypedPropertyDescriptor<Function>): void;
|
|
8
|
-
/**
|
|
9
|
-
* 异步函数变为同步函数
|
|
10
|
-
* 服务器间的异步,效率低
|
|
11
|
-
* 只支持mongo模式
|
|
12
|
-
* @returns
|
|
13
|
-
*/
|
|
14
|
-
export declare let SyncCallServer2: (params_index?: number) => (target: any, propertyName: string, descriptor: TypedPropertyDescriptor<Function>) => void;
|
|
1
|
+
/**
|
|
2
|
+
* 异步函数变为同步函数
|
|
3
|
+
* 服务器间的异步,效率低
|
|
4
|
+
* 只支持mongo模式
|
|
5
|
+
* @returns
|
|
6
|
+
*/
|
|
7
|
+
export declare function SyncCallServer(target: any, propertyName: string, descriptor: TypedPropertyDescriptor<Function>): void;
|
|
8
|
+
/**
|
|
9
|
+
* 异步函数变为同步函数
|
|
10
|
+
* 服务器间的异步,效率低
|
|
11
|
+
* 只支持mongo模式
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
export declare let SyncCallServer2: (params_index?: number) => (target: any, propertyName: string, descriptor: TypedPropertyDescriptor<Function>) => void;
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
export declare let GCacheTool: CacheTool;
|
|
2
|
-
declare class CacheItem {
|
|
3
|
-
key: string;
|
|
4
|
-
value: any;
|
|
5
|
-
milliseconds: number;
|
|
6
|
-
expire_time: number;
|
|
7
|
-
}
|
|
8
|
-
declare class CacheTool {
|
|
9
|
-
protected _items: {
|
|
10
|
-
[key: string]: CacheItem;
|
|
11
|
-
};
|
|
12
|
-
constructor();
|
|
13
|
-
/**
|
|
14
|
-
* 定时清除缓存
|
|
15
|
-
*/
|
|
16
|
-
protected _refresh(): void;
|
|
17
|
-
get(key: any, refresh?: boolean): any;
|
|
18
|
-
/**
|
|
19
|
-
*
|
|
20
|
-
* @param key
|
|
21
|
-
* @param value
|
|
22
|
-
* @param time 缓存的毫秒数
|
|
23
|
-
*/
|
|
24
|
-
add(key: any, value: any, milliseconds: any): void;
|
|
25
|
-
remove(key: any): void;
|
|
26
|
-
}
|
|
27
|
-
export {};
|
|
1
|
+
export declare let GCacheTool: CacheTool;
|
|
2
|
+
declare class CacheItem {
|
|
3
|
+
key: string;
|
|
4
|
+
value: any;
|
|
5
|
+
milliseconds: number;
|
|
6
|
+
expire_time: number;
|
|
7
|
+
}
|
|
8
|
+
declare class CacheTool {
|
|
9
|
+
protected _items: {
|
|
10
|
+
[key: string]: CacheItem;
|
|
11
|
+
};
|
|
12
|
+
constructor();
|
|
13
|
+
/**
|
|
14
|
+
* 定时清除缓存
|
|
15
|
+
*/
|
|
16
|
+
protected _refresh(): void;
|
|
17
|
+
get(key: any, refresh?: boolean): any;
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @param key
|
|
21
|
+
* @param value
|
|
22
|
+
* @param time 缓存的毫秒数
|
|
23
|
+
*/
|
|
24
|
+
add(key: any, value: any, milliseconds: any): void;
|
|
25
|
+
remove(key: any): void;
|
|
26
|
+
}
|
|
27
|
+
export {};
|