cgserver 6.0.0 → 6.0.1
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/dist/cgserver.js +1037 -0
- package/dist/types/AI/AiObject.d.ts +5 -0
- package/dist/types/AI/Astar.d.ts +38 -0
- package/dist/types/AI/BehaviorAI.d.ts +24 -0
- package/dist/types/AI/Entity.d.ts +12 -0
- package/dist/types/AI/Point.d.ts +17 -0
- package/dist/types/AI/TriggerMgr.d.ts +52 -0
- package/dist/types/Config/Config.d.ts +7 -0
- package/dist/types/Config/FrameworkConfig.d.ts +229 -0
- package/dist/types/Config/ServerConfig.d.ts +9 -0
- package/dist/types/Config/_error_.d.ts +99 -0
- package/dist/types/Core/Core.d.ts +101 -0
- package/dist/types/Core/Timer.d.ts +16 -0
- package/dist/types/Database/BaseMongoService.d.ts +67 -0
- package/dist/types/Database/BaseService.d.ts +34 -0
- package/dist/types/Database/Decorator/AutoIncrement.d.ts +1 -0
- package/dist/types/Database/Decorator/DBCache.d.ts +21 -0
- package/dist/types/Database/Decorator/NotNull.d.ts +1 -0
- package/dist/types/Database/Decorator/PrimaryKey.d.ts +1 -0
- package/dist/types/Database/Decorator/Property.d.ts +55 -0
- package/dist/types/Database/Decorator/Table.d.ts +1 -0
- package/dist/types/Database/Decorator/Type.d.ts +1 -0
- package/dist/types/Database/MSSqlManager.d.ts +17 -0
- package/dist/types/Database/MongoManager.d.ts +135 -0
- package/dist/types/Database/MysqlManager.d.ts +41 -0
- package/dist/types/Database/RedisManager.d.ts +64 -0
- package/dist/types/Index.d.ts +65 -0
- package/dist/types/Logic/CacheTool.d.ts +25 -0
- package/dist/types/Logic/HttpTool.d.ts +14 -0
- package/dist/types/Logic/Log.d.ts +15 -0
- package/dist/types/Service/AccountService.d.ts +77 -0
- package/dist/types/Service/MongoAccountService.d.ts +78 -0
- package/dist/types/Service/MongoCacheService.d.ts +13 -0
- package/dist/types/Service/MongoUserService.d.ts +36 -0
- package/dist/types/Service/UserService.d.ts +36 -0
- package/dist/types/Service/ini.d.ts +28 -0
- package/dist/types/SocketServer/IClientWebSocket.d.ts +24 -0
- package/dist/types/SocketServer/IServerWebSocket.d.ts +13 -0
- package/dist/types/SocketServer/ISocketServer.d.ts +36 -0
- package/dist/types/SocketServer/IWebSocket.d.ts +44 -0
- package/dist/types/SocketServer/ProtoFilter/GoogleProtoFilter.d.ts +9 -0
- package/dist/types/SocketServer/ProtoFilter/IProtoFilter.d.ts +9 -0
- package/dist/types/SocketServer/ProtoFilter/JsonProtoFilter.d.ts +6 -0
- package/dist/types/SocketServer/ProtoFilter/ProtoFactory.d.ts +8 -0
- package/dist/types/ThirdParty/AlipayTool.d.ts +40 -0
- package/dist/types/ThirdParty/Alisms.d.ts +14 -0
- package/dist/types/ThirdParty/AppleTool.d.ts +131 -0
- package/dist/types/ThirdParty/EmailTool.d.ts +5 -0
- package/dist/types/ThirdParty/OpenSocial.d.ts +7 -0
- package/dist/types/ThirdParty/QQTool.d.ts +41 -0
- package/dist/types/ThirdParty/QiniuTool.d.ts +6 -0
- package/dist/types/ThirdParty/WechatOATool.d.ts +13 -0
- package/dist/types/ThirdParty/WechatTool.d.ts +20 -0
- package/dist/types/WebServer/Controller/BaseController.d.ts +33 -0
- package/dist/types/WebServer/Controller/BaseUserController.d.ts +26 -0
- package/dist/types/WebServer/Controller/MongoBaseUserController.d.ts +26 -0
- package/dist/types/WebServer/Decorator/AdminValidate.d.ts +1 -0
- package/dist/types/WebServer/Decorator/AuthorityValidate.d.ts +2 -0
- package/dist/types/WebServer/Decorator/CreatorValidate.d.ts +1 -0
- package/dist/types/WebServer/Decorator/JsonAdminValidate.d.ts +1 -0
- package/dist/types/WebServer/Decorator/JsonAuthorityValidate.d.ts +2 -0
- package/dist/types/WebServer/Decorator/JsonCreatorValidate.d.ts +1 -0
- package/dist/types/WebServer/Engine/ControllerManager.d.ts +21 -0
- package/dist/types/WebServer/Engine/Engine.d.ts +21 -0
- package/dist/types/WebServer/Engine/RazorJs.d.ts +21 -0
- package/dist/types/WebServer/Engine/Request.d.ts +35 -0
- package/dist/types/WebServer/Engine/Response.d.ts +28 -0
- package/dist/types/WebServer/IWebServer.d.ts +20 -0
- package/package.json +3 -2
- package/out/AI/AiObject.js +0 -11
- package/out/AI/AiObject.js.map +0 -1
- package/out/AI/Astar.js +0 -134
- package/out/AI/Astar.js.map +0 -1
- package/out/AI/BehaviorAI.js +0 -308
- package/out/AI/BehaviorAI.js.map +0 -1
- package/out/AI/Entity.js +0 -34
- package/out/AI/Entity.js.map +0 -1
- package/out/AI/Point.js +0 -69
- package/out/AI/Point.js.map +0 -1
- package/out/AI/TriggerMgr.js +0 -202
- package/out/AI/TriggerMgr.js.map +0 -1
- package/out/Config/Config.js +0 -38
- package/out/Config/Config.js.map +0 -1
- package/out/Config/FrameworkConfig.js +0 -235
- package/out/Config/FrameworkConfig.js.map +0 -1
- package/out/Config/ServerConfig.js +0 -19
- package/out/Config/ServerConfig.js.map +0 -1
- package/out/Config/_error_.js +0 -36
- package/out/Config/_error_.js.map +0 -1
- package/out/Core/Core.js +0 -562
- package/out/Core/Core.js.map +0 -1
- package/out/Core/Timer.js +0 -117
- package/out/Core/Timer.js.map +0 -1
- package/out/Database/BaseMongoService.js +0 -80
- package/out/Database/BaseMongoService.js.map +0 -1
- package/out/Database/BaseService.js +0 -282
- package/out/Database/BaseService.js.map +0 -1
- package/out/Database/Decorator/AutoIncrement.js +0 -12
- package/out/Database/Decorator/AutoIncrement.js.map +0 -1
- package/out/Database/Decorator/DBCache.js +0 -65
- package/out/Database/Decorator/DBCache.js.map +0 -1
- package/out/Database/Decorator/NotNull.js +0 -12
- package/out/Database/Decorator/NotNull.js.map +0 -1
- package/out/Database/Decorator/PrimaryKey.js +0 -12
- package/out/Database/Decorator/PrimaryKey.js.map +0 -1
- package/out/Database/Decorator/Property.js +0 -62
- package/out/Database/Decorator/Property.js.map +0 -1
- package/out/Database/Decorator/Table.js +0 -16
- package/out/Database/Decorator/Table.js.map +0 -1
- package/out/Database/Decorator/Type.js +0 -21
- package/out/Database/Decorator/Type.js.map +0 -1
- package/out/Database/MSSqlManager.js +0 -44
- package/out/Database/MSSqlManager.js.map +0 -1
- package/out/Database/MongoManager.js +0 -402
- package/out/Database/MongoManager.js.map +0 -1
- package/out/Database/MysqlManager.js +0 -181
- package/out/Database/MysqlManager.js.map +0 -1
- package/out/Database/RedisManager.js +0 -409
- package/out/Database/RedisManager.js.map +0 -1
- package/out/Index.js +0 -134
- package/out/Index.js.map +0 -1
- package/out/Logic/CacheTool.js +0 -74
- package/out/Logic/CacheTool.js.map +0 -1
- package/out/Logic/HttpTool.js +0 -59
- package/out/Logic/HttpTool.js.map +0 -1
- package/out/Logic/Log.js +0 -78
- package/out/Logic/Log.js.map +0 -1
- package/out/Service/AccountService.js +0 -474
- package/out/Service/AccountService.js.map +0 -1
- package/out/Service/MongoAccountService.js +0 -397
- package/out/Service/MongoAccountService.js.map +0 -1
- package/out/Service/MongoCacheService.js +0 -28
- package/out/Service/MongoCacheService.js.map +0 -1
- package/out/Service/MongoUserService.js +0 -94
- package/out/Service/MongoUserService.js.map +0 -1
- package/out/Service/UserService.js +0 -185
- package/out/Service/UserService.js.map +0 -1
- package/out/Service/ini.js +0 -36
- package/out/Service/ini.js.map +0 -1
- package/out/SocketServer/IClientWebSocket.js +0 -72
- package/out/SocketServer/IClientWebSocket.js.map +0 -1
- package/out/SocketServer/IServerWebSocket.js +0 -42
- package/out/SocketServer/IServerWebSocket.js.map +0 -1
- package/out/SocketServer/ISocketServer.js +0 -191
- package/out/SocketServer/ISocketServer.js.map +0 -1
- package/out/SocketServer/IWebSocket.js +0 -224
- package/out/SocketServer/IWebSocket.js.map +0 -1
- package/out/SocketServer/ProtoFilter/GoogleProtoFilter.js +0 -58
- package/out/SocketServer/ProtoFilter/GoogleProtoFilter.js.map +0 -1
- package/out/SocketServer/ProtoFilter/IProtoFilter.js +0 -9
- package/out/SocketServer/ProtoFilter/IProtoFilter.js.map +0 -1
- package/out/SocketServer/ProtoFilter/JsonProtoFilter.js +0 -30
- package/out/SocketServer/ProtoFilter/JsonProtoFilter.js.map +0 -1
- package/out/SocketServer/ProtoFilter/ProtoFactory.js +0 -32
- package/out/SocketServer/ProtoFilter/ProtoFactory.js.map +0 -1
- package/out/ThirdParty/AlipayTool.js +0 -123
- package/out/ThirdParty/AlipayTool.js.map +0 -1
- package/out/ThirdParty/Alisms.js +0 -47
- package/out/ThirdParty/Alisms.js.map +0 -1
- package/out/ThirdParty/AppleTool.js +0 -235
- package/out/ThirdParty/AppleTool.js.map +0 -1
- package/out/ThirdParty/EmailTool.js +0 -34
- package/out/ThirdParty/EmailTool.js.map +0 -1
- package/out/ThirdParty/OpenSocial.js +0 -33
- package/out/ThirdParty/OpenSocial.js.map +0 -1
- package/out/ThirdParty/QQTool.js +0 -116
- package/out/ThirdParty/QQTool.js.map +0 -1
- package/out/ThirdParty/QiniuTool.js +0 -22
- package/out/ThirdParty/QiniuTool.js.map +0 -1
- package/out/ThirdParty/WechatOATool.js +0 -62
- package/out/ThirdParty/WechatOATool.js.map +0 -1
- package/out/ThirdParty/WechatTool.js +0 -75
- package/out/ThirdParty/WechatTool.js.map +0 -1
- package/out/WebServer/Controller/BaseController.js +0 -113
- package/out/WebServer/Controller/BaseController.js.map +0 -1
- package/out/WebServer/Controller/BaseUserController.js +0 -169
- package/out/WebServer/Controller/BaseUserController.js.map +0 -1
- package/out/WebServer/Controller/MongoBaseUserController.js +0 -169
- package/out/WebServer/Controller/MongoBaseUserController.js.map +0 -1
- package/out/WebServer/Decorator/AdminValidate.js +0 -20
- package/out/WebServer/Decorator/AdminValidate.js.map +0 -1
- package/out/WebServer/Decorator/AuthorityValidate.js +0 -23
- package/out/WebServer/Decorator/AuthorityValidate.js.map +0 -1
- package/out/WebServer/Decorator/CreatorValidate.js +0 -20
- package/out/WebServer/Decorator/CreatorValidate.js.map +0 -1
- package/out/WebServer/Decorator/JsonAdminValidate.js +0 -16
- package/out/WebServer/Decorator/JsonAdminValidate.js.map +0 -1
- package/out/WebServer/Decorator/JsonAuthorityValidate.js +0 -21
- package/out/WebServer/Decorator/JsonAuthorityValidate.js.map +0 -1
- package/out/WebServer/Decorator/JsonCreatorValidate.js +0 -20
- package/out/WebServer/Decorator/JsonCreatorValidate.js.map +0 -1
- package/out/WebServer/Engine/ControllerManager.js +0 -113
- package/out/WebServer/Engine/ControllerManager.js.map +0 -1
- package/out/WebServer/Engine/Engine.js +0 -136
- package/out/WebServer/Engine/Engine.js.map +0 -1
- package/out/WebServer/Engine/RazorJs.js +0 -545
- package/out/WebServer/Engine/RazorJs.js.map +0 -1
- package/out/WebServer/Engine/Request.js +0 -215
- package/out/WebServer/Engine/Request.js.map +0 -1
- package/out/WebServer/Engine/Response.js +0 -95
- package/out/WebServer/Engine/Response.js.map +0 -1
- package/out/WebServer/IWebServer.js +0 -50
- package/out/WebServer/IWebServer.js.map +0 -1
- package/tsconfig.json +0 -25
- package/webpack.config.js +0 -14
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare class BaseModel {
|
|
2
|
+
}
|
|
3
|
+
export declare class BaseService<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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function AutoIncrement(target: any, propertyName: string): void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare class VersionModel {
|
|
2
|
+
table: string;
|
|
3
|
+
version: number;
|
|
4
|
+
/**
|
|
5
|
+
* 创建时间
|
|
6
|
+
*/
|
|
7
|
+
create_time: number;
|
|
8
|
+
/**
|
|
9
|
+
* 创建时间
|
|
10
|
+
*/
|
|
11
|
+
update_time: number;
|
|
12
|
+
}
|
|
13
|
+
export declare let GDBCache: DBCache;
|
|
14
|
+
declare class DBCache {
|
|
15
|
+
protected _versions: Map<String, VersionModel>;
|
|
16
|
+
protected _path: string;
|
|
17
|
+
init(): Promise<void>;
|
|
18
|
+
setVersion(table: string, version: number): Promise<void>;
|
|
19
|
+
getVersion(table: string): number;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function NotNull(target: any, propertyName: string): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function PrimaryKey(target: any, propertyName: string): void;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export declare class EPropertyType {
|
|
2
|
+
static Char: string;
|
|
3
|
+
static NVarchar: string;
|
|
4
|
+
static Varchar: string;
|
|
5
|
+
static BigInt: string;
|
|
6
|
+
static Decimal: string;
|
|
7
|
+
static Double: string;
|
|
8
|
+
static Float: string;
|
|
9
|
+
static Int: string;
|
|
10
|
+
static MediumInt: string;
|
|
11
|
+
static Real: string;
|
|
12
|
+
static SmallInt: string;
|
|
13
|
+
static TinyInt: string;
|
|
14
|
+
static LongText: string;
|
|
15
|
+
static MediumText: string;
|
|
16
|
+
static Text: string;
|
|
17
|
+
static TinyText: string;
|
|
18
|
+
static defs: {
|
|
19
|
+
char: string;
|
|
20
|
+
nvarchar: string;
|
|
21
|
+
varchar: string;
|
|
22
|
+
bigint: number;
|
|
23
|
+
decimal: number;
|
|
24
|
+
double: number;
|
|
25
|
+
float: number;
|
|
26
|
+
int: number;
|
|
27
|
+
Mediumint: number;
|
|
28
|
+
real: number;
|
|
29
|
+
smallint: number;
|
|
30
|
+
tinyint: number;
|
|
31
|
+
longtext: string;
|
|
32
|
+
mediumtext: string;
|
|
33
|
+
text: any;
|
|
34
|
+
tinytext: string;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export declare class Property {
|
|
38
|
+
is_primary: boolean;
|
|
39
|
+
is_notnull: boolean;
|
|
40
|
+
auto_increment: boolean;
|
|
41
|
+
auto_start: number;
|
|
42
|
+
type: string;
|
|
43
|
+
type_len: number;
|
|
44
|
+
default: any;
|
|
45
|
+
}
|
|
46
|
+
export declare class TableProperty {
|
|
47
|
+
static key: string;
|
|
48
|
+
table: string;
|
|
49
|
+
version: number;
|
|
50
|
+
engine: string;
|
|
51
|
+
auto_increment: number;
|
|
52
|
+
charset: string;
|
|
53
|
+
comment: string;
|
|
54
|
+
items: Map<string, Property>;
|
|
55
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function Table(table_name: string, version: number, comment?: string, charset?: string, auto_increment?: number): (constructor: Function) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function Type(type: string, def?: any, len?: number): (target: any, propertyName: string) => void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as mssql from "mssql";
|
|
2
|
+
export declare class MssqlReturn {
|
|
3
|
+
error: any;
|
|
4
|
+
fields: any;
|
|
5
|
+
list: Array<any>;
|
|
6
|
+
}
|
|
7
|
+
export declare let GMSSqlMgr: MSSqlManager;
|
|
8
|
+
declare class MSSqlManager {
|
|
9
|
+
protected _init_cbs: any[];
|
|
10
|
+
protected _pool: mssql.ConnectionPool;
|
|
11
|
+
get pool(): mssql.ConnectionPool;
|
|
12
|
+
get isValid(): boolean;
|
|
13
|
+
constructor();
|
|
14
|
+
init(): Promise<void>;
|
|
15
|
+
registerInitCb(cb: Function): void;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import * as mongo from 'mongodb';
|
|
2
|
+
export declare class MongoBaseModel {
|
|
3
|
+
_id: any;
|
|
4
|
+
}
|
|
5
|
+
export declare class MrResult {
|
|
6
|
+
/**
|
|
7
|
+
* select 的数据量
|
|
8
|
+
*/
|
|
9
|
+
length: number;
|
|
10
|
+
/**
|
|
11
|
+
* 插入数据的自增id
|
|
12
|
+
*/
|
|
13
|
+
insertId: number;
|
|
14
|
+
insertIds: {
|
|
15
|
+
[key: number]: number;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* update 更新数据的影响条数
|
|
19
|
+
*/
|
|
20
|
+
changedRows: number;
|
|
21
|
+
/**
|
|
22
|
+
* 插入或删除数据的影响条数
|
|
23
|
+
*/
|
|
24
|
+
affectedRows: number;
|
|
25
|
+
}
|
|
26
|
+
export declare class MgReturn {
|
|
27
|
+
error: any;
|
|
28
|
+
result: MrResult;
|
|
29
|
+
list: any[];
|
|
30
|
+
}
|
|
31
|
+
export declare let GMongoMgr: MongoManager;
|
|
32
|
+
declare class MongoManager {
|
|
33
|
+
protected _init_cbs: any[];
|
|
34
|
+
protected _mongo: mongo.Db;
|
|
35
|
+
get mongo(): mongo.Db;
|
|
36
|
+
protected _mongo_init_succ: boolean;
|
|
37
|
+
protected _inited: boolean;
|
|
38
|
+
get isValid(): boolean;
|
|
39
|
+
constructor();
|
|
40
|
+
init(): Promise<boolean>;
|
|
41
|
+
registerInitCb(cb: Function): void;
|
|
42
|
+
onConnect(): void;
|
|
43
|
+
onEnd(): void;
|
|
44
|
+
onError(err: any): void;
|
|
45
|
+
getAutoIds(key: string): Promise<any>;
|
|
46
|
+
protected _convertWhere(where?: any): any;
|
|
47
|
+
/**
|
|
48
|
+
* 获取单条消息
|
|
49
|
+
* @param collection
|
|
50
|
+
*/
|
|
51
|
+
findOne(collection: string, property?: {}, where?: {}, sort?: {}): Promise<{
|
|
52
|
+
errcode: {
|
|
53
|
+
id: number;
|
|
54
|
+
des: string;
|
|
55
|
+
};
|
|
56
|
+
one: any;
|
|
57
|
+
}>;
|
|
58
|
+
findMany(collection: string, property?: {}, where?: {}, sort?: {}, skip?: number, limit?: number): Promise<{
|
|
59
|
+
errcode: {
|
|
60
|
+
id: number;
|
|
61
|
+
des: string;
|
|
62
|
+
};
|
|
63
|
+
list: any[];
|
|
64
|
+
}>;
|
|
65
|
+
findCount(collection: string, property?: {}, where?: {}): Promise<{
|
|
66
|
+
errcode: {
|
|
67
|
+
id: number;
|
|
68
|
+
des: string;
|
|
69
|
+
};
|
|
70
|
+
count: number;
|
|
71
|
+
}>;
|
|
72
|
+
deleteOne(collection: any, where: any): Promise<{
|
|
73
|
+
errcode: {
|
|
74
|
+
id: number;
|
|
75
|
+
des: string;
|
|
76
|
+
};
|
|
77
|
+
count: number;
|
|
78
|
+
}>;
|
|
79
|
+
deleteMany(collection: any, where: any): Promise<{
|
|
80
|
+
errcode: {
|
|
81
|
+
id: number;
|
|
82
|
+
des: string;
|
|
83
|
+
};
|
|
84
|
+
count: number;
|
|
85
|
+
}>;
|
|
86
|
+
/**
|
|
87
|
+
* 插入数据
|
|
88
|
+
* @param collection
|
|
89
|
+
* @param data
|
|
90
|
+
*/
|
|
91
|
+
insertOne(collection: string, data: any): Promise<{
|
|
92
|
+
errcode: {
|
|
93
|
+
id: number;
|
|
94
|
+
des: string;
|
|
95
|
+
};
|
|
96
|
+
rs: mongo.InsertOneResult<any>;
|
|
97
|
+
}>;
|
|
98
|
+
insertManay(collection: string, data: []): Promise<{
|
|
99
|
+
errcode: {
|
|
100
|
+
id: number;
|
|
101
|
+
des: string;
|
|
102
|
+
};
|
|
103
|
+
rs: mongo.InsertManyResult<any>;
|
|
104
|
+
}>;
|
|
105
|
+
updateOne(collection: string, model?: {}, where?: {}, upsert?: boolean): Promise<{
|
|
106
|
+
errcode: {
|
|
107
|
+
id: number;
|
|
108
|
+
des: string;
|
|
109
|
+
};
|
|
110
|
+
rs: mongo.UpdateResult;
|
|
111
|
+
}>;
|
|
112
|
+
updateMany(collection: string, model: any, where?: {}, upsert?: boolean): Promise<{
|
|
113
|
+
errcode: {
|
|
114
|
+
id: number;
|
|
115
|
+
des: string;
|
|
116
|
+
};
|
|
117
|
+
rs: mongo.Document | mongo.UpdateResult;
|
|
118
|
+
}>;
|
|
119
|
+
createIndex(collection: string, index: any, callback?: mongo.CreateIndexesOptions): Promise<{
|
|
120
|
+
errcode: {
|
|
121
|
+
id: number;
|
|
122
|
+
des: string;
|
|
123
|
+
};
|
|
124
|
+
rs: string;
|
|
125
|
+
}>;
|
|
126
|
+
simpleAggregate(collection: string, property?: {}, where?: {}, size?: number, random_size?: number): Promise<{
|
|
127
|
+
errcode: {
|
|
128
|
+
id: number;
|
|
129
|
+
des: string;
|
|
130
|
+
};
|
|
131
|
+
list: any[];
|
|
132
|
+
}>;
|
|
133
|
+
aggregate(collection: string, pipeline?: Document[], options?: mongo.AggregateOptions): mongo.AggregationCursor<mongo.Document>;
|
|
134
|
+
}
|
|
135
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as mysql from 'mysql';
|
|
2
|
+
export declare class SqlResult {
|
|
3
|
+
/**
|
|
4
|
+
* select 的数据量
|
|
5
|
+
*/
|
|
6
|
+
length: number;
|
|
7
|
+
/**
|
|
8
|
+
* 插入数据的自增id
|
|
9
|
+
*/
|
|
10
|
+
insertId: number;
|
|
11
|
+
/**
|
|
12
|
+
* update 更新数据的影响条数
|
|
13
|
+
*/
|
|
14
|
+
changedRows: number;
|
|
15
|
+
/**
|
|
16
|
+
* 插入或删除数据的影响条数
|
|
17
|
+
*/
|
|
18
|
+
affectedRows: number;
|
|
19
|
+
}
|
|
20
|
+
export declare class SqlReturn {
|
|
21
|
+
error: any;
|
|
22
|
+
results: SqlResult;
|
|
23
|
+
fields: any;
|
|
24
|
+
list: Array<any>;
|
|
25
|
+
}
|
|
26
|
+
export declare class SqlReturns {
|
|
27
|
+
error: any;
|
|
28
|
+
srs: Array<SqlResult>;
|
|
29
|
+
}
|
|
30
|
+
export declare let GMysqlMgr: MysqlManager;
|
|
31
|
+
declare class MysqlManager {
|
|
32
|
+
protected _init_cbs: any[];
|
|
33
|
+
protected _pool: mysql.Pool;
|
|
34
|
+
get isValid(): boolean;
|
|
35
|
+
constructor();
|
|
36
|
+
init(): Promise<unknown>;
|
|
37
|
+
registerInitCb(cb: Function): void;
|
|
38
|
+
query(sqlStr: any, values?: any, no_err_log?: boolean): Promise<SqlReturn>;
|
|
39
|
+
transaction(sqls: any): Promise<SqlReturns>;
|
|
40
|
+
}
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import * as redis from 'redis';
|
|
2
|
+
export declare let GRedisMgr: RedisManager;
|
|
3
|
+
export declare class RedisManager {
|
|
4
|
+
protected _redis: redis.RedisClient;
|
|
5
|
+
get redis(): redis.RedisClient;
|
|
6
|
+
protected _resis_init_succ: boolean;
|
|
7
|
+
protected _redisCfg: {
|
|
8
|
+
open: boolean;
|
|
9
|
+
host: string;
|
|
10
|
+
port: number;
|
|
11
|
+
database: number;
|
|
12
|
+
password: string;
|
|
13
|
+
};
|
|
14
|
+
constructor();
|
|
15
|
+
init(redisCfg: {
|
|
16
|
+
open: boolean;
|
|
17
|
+
host: string;
|
|
18
|
+
port: number;
|
|
19
|
+
database: number;
|
|
20
|
+
password: string;
|
|
21
|
+
}): Promise<unknown>;
|
|
22
|
+
onConnect(): void;
|
|
23
|
+
onEnd(): void;
|
|
24
|
+
onError(err: any): void;
|
|
25
|
+
expire(key: any, seconds: any): Promise<unknown>;
|
|
26
|
+
incr(key: any): Promise<number>;
|
|
27
|
+
set(key: any, value: any): Promise<unknown>;
|
|
28
|
+
get(key: any): Promise<string>;
|
|
29
|
+
/**
|
|
30
|
+
*
|
|
31
|
+
* @param key
|
|
32
|
+
* @param cb 有表示异步
|
|
33
|
+
*/
|
|
34
|
+
del(key: any, cb?: any): Promise<unknown>;
|
|
35
|
+
hset(h: any, key: any, value: any): Promise<unknown>;
|
|
36
|
+
hget(h: any, key: any): Promise<unknown>;
|
|
37
|
+
hdel(key: any, sub_key: any): Promise<unknown>;
|
|
38
|
+
/**
|
|
39
|
+
* hash值,能转换位整数的就自动转换为整数
|
|
40
|
+
* @param h key
|
|
41
|
+
*/
|
|
42
|
+
hgetall(h: any): Promise<{
|
|
43
|
+
[key: string]: any;
|
|
44
|
+
}>;
|
|
45
|
+
/**
|
|
46
|
+
*
|
|
47
|
+
* @param h
|
|
48
|
+
* @param array
|
|
49
|
+
*/
|
|
50
|
+
hmset(h: any, array: any): Promise<unknown>;
|
|
51
|
+
lpush(key: any, array: any): Promise<unknown>;
|
|
52
|
+
lrange(key: string, start?: number, end?: number): Promise<unknown>;
|
|
53
|
+
ltrim(key: string, start: number, end?: number): Promise<unknown>;
|
|
54
|
+
sadd(key: any, array: any): Promise<unknown>;
|
|
55
|
+
smembers(key: any): Promise<unknown>;
|
|
56
|
+
srem(key: any, array: any): Promise<unknown>;
|
|
57
|
+
keys(key: any): Promise<unknown>;
|
|
58
|
+
multi(): redis.Multi;
|
|
59
|
+
exists(key: string): Promise<unknown>;
|
|
60
|
+
exec(multi: redis.Multi): Promise<Array<any>>;
|
|
61
|
+
publish(channel: string, value: string): Promise<unknown>;
|
|
62
|
+
subscribe(channel: string): Promise<unknown>;
|
|
63
|
+
on(message: string, cb: any): void;
|
|
64
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export { GProtoFactory } from './SocketServer/ProtoFilter/ProtoFactory';
|
|
2
|
+
export { GDBCache } from './Database/Decorator/DBCache';
|
|
3
|
+
export { AiObject } from "./AI/AiObject";
|
|
4
|
+
export { AStar } from "./AI/Astar";
|
|
5
|
+
export { BehaviorAI } from "./AI/BehaviorAI";
|
|
6
|
+
export { Entity } from "./AI/Entity";
|
|
7
|
+
export { Point } from "./AI/Point";
|
|
8
|
+
export { Trigger, GTriggerMgr } from "./AI/TriggerMgr";
|
|
9
|
+
export { FrameworkErrorCode } from "./Config/_error_";
|
|
10
|
+
export { Config } from "./Config/Config";
|
|
11
|
+
export { FrameworkConfig } from "./Config/FrameworkConfig";
|
|
12
|
+
export { ServerConfig } from "./Config/ServerConfig";
|
|
13
|
+
export { core } from "./Core/Core";
|
|
14
|
+
export { Timer } from "./Core/Timer";
|
|
15
|
+
export { AutoIncrement } from "./Database/Decorator/AutoIncrement";
|
|
16
|
+
export { NotNull } from './Database/Decorator/NotNull';
|
|
17
|
+
export { PrimaryKey } from './Database/Decorator/PrimaryKey';
|
|
18
|
+
export { Property } from './Database/Decorator/Property';
|
|
19
|
+
export { Table } from './Database/Decorator/Table';
|
|
20
|
+
export { Type } from './Database/Decorator/Type';
|
|
21
|
+
export { BaseService as MongoBaseService } from './Database/BaseMongoService';
|
|
22
|
+
export { MongoBaseModel } from './Database/MongoManager';
|
|
23
|
+
export { GMongoMgr } from './Database/MongoManager';
|
|
24
|
+
export { GMSSqlMgr } from './Database/MSSqlManager';
|
|
25
|
+
export { BaseService as MysqlBaseService } from './Database/BaseService';
|
|
26
|
+
export { GMysqlMgr } from './Database/MysqlManager';
|
|
27
|
+
export { GRedisMgr } from './Database/RedisManager';
|
|
28
|
+
export { GCacheTool } from './Logic/CacheTool';
|
|
29
|
+
export { GHttpTool } from './Logic/HttpTool';
|
|
30
|
+
export { GLog } from './Logic/Log';
|
|
31
|
+
export { AccountService as MysqlAccountService } from './Service/AccountService';
|
|
32
|
+
export { AccountService as MongoAccountService } from './Service/MongoAccountService';
|
|
33
|
+
export { UserService as MysqlUserService } from './Service/UserService';
|
|
34
|
+
export { UserService as MongoUserService } from './Service/MongoUserService';
|
|
35
|
+
export { GoogleProtoFilter } from './SocketServer/ProtoFilter/GoogleProtoFilter';
|
|
36
|
+
export { IProtoFilter } from './SocketServer/ProtoFilter/IProtoFilter';
|
|
37
|
+
export { JsonProtoFilter } from './SocketServer/ProtoFilter/JsonProtoFilter';
|
|
38
|
+
export { IClientWebSocket } from './SocketServer/IClientWebSocket';
|
|
39
|
+
export { IServerWebSocket } from './SocketServer/IServerWebSocket';
|
|
40
|
+
export { ISocketServer } from './SocketServer/ISocketServer';
|
|
41
|
+
export { IWebSocket } from './SocketServer/IWebSocket';
|
|
42
|
+
export { GAlipayTool } from './ThirdParty/AlipayTool';
|
|
43
|
+
export { GSmsTool } from './ThirdParty/Alisms';
|
|
44
|
+
export { GAppleTool } from './ThirdParty/AppleTool';
|
|
45
|
+
export { GEmailTool } from './ThirdParty/EmailTool';
|
|
46
|
+
export { GOpenSocial } from './ThirdParty/OpenSocial';
|
|
47
|
+
export { GQiniuTool } from './ThirdParty/QiniuTool';
|
|
48
|
+
export { GQQTool } from './ThirdParty/QQTool';
|
|
49
|
+
export { GWechatOATool } from './ThirdParty/WechatOATool';
|
|
50
|
+
export { GWechatTool } from './ThirdParty/WechatTool';
|
|
51
|
+
export { IWebServer } from './WebServer/IWebServer';
|
|
52
|
+
export { BaseController } from './WebServer/Controller/BaseController';
|
|
53
|
+
export { BaseUserController } from './WebServer/Controller/BaseUserController';
|
|
54
|
+
export { MongoBaseUserController } from './WebServer/Controller/MongoBaseUserController';
|
|
55
|
+
export { AdminValidate } from './WebServer/Decorator/AdminValidate';
|
|
56
|
+
export { AuthorityValidate } from './WebServer/Decorator/AuthorityValidate';
|
|
57
|
+
export { CreatorValidate } from './WebServer/Decorator/CreatorValidate';
|
|
58
|
+
export { JsonAdminValidate } from './WebServer/Decorator/JsonAdminValidate';
|
|
59
|
+
export { JsonAuthorityValidate } from './WebServer/Decorator/JsonAuthorityValidate';
|
|
60
|
+
export { JsonCreatorValidate } from './WebServer/Decorator/JsonCreatorValidate';
|
|
61
|
+
export { GCtrMgr } from './WebServer/Engine/ControllerManager';
|
|
62
|
+
export { Engine } from './WebServer/Engine/Engine';
|
|
63
|
+
export { RazorJs } from './WebServer/Engine/RazorJs';
|
|
64
|
+
export { Request } from './WebServer/Engine/Request';
|
|
65
|
+
export { Response } from './WebServer/Engine/Response';
|
|
@@ -0,0 +1,25 @@
|
|
|
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: Map<string, CacheItem>;
|
|
10
|
+
constructor();
|
|
11
|
+
/**
|
|
12
|
+
* 定时清除缓存
|
|
13
|
+
*/
|
|
14
|
+
protected _refresh(): void;
|
|
15
|
+
get(key: any, refresh?: boolean): any;
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* @param key
|
|
19
|
+
* @param value
|
|
20
|
+
* @param time 缓存的毫秒数
|
|
21
|
+
*/
|
|
22
|
+
add(key: any, value: any, milliseconds: any): void;
|
|
23
|
+
remove(key: any): void;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare let GHttpTool: HttpTool;
|
|
2
|
+
declare class HttpTool {
|
|
3
|
+
httpRequest(url: string, noParse?: boolean): Promise<{
|
|
4
|
+
error: any;
|
|
5
|
+
response: any;
|
|
6
|
+
body: any;
|
|
7
|
+
}>;
|
|
8
|
+
httpPost(url: any, form: any): Promise<{
|
|
9
|
+
error: any;
|
|
10
|
+
response: any;
|
|
11
|
+
body: any;
|
|
12
|
+
}>;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as log4js from "log4js";
|
|
2
|
+
export declare let GLog: Log;
|
|
3
|
+
declare class Log {
|
|
4
|
+
protected _logger: log4js.Logger;
|
|
5
|
+
protected _client_logger: log4js.Logger;
|
|
6
|
+
protected _errorLogger: log4js.Logger;
|
|
7
|
+
protected _inited: boolean;
|
|
8
|
+
init(cfg: log4js.Configuration): void;
|
|
9
|
+
error(message?: any, ...optionalParams: any[]): void;
|
|
10
|
+
info(message: any, to_console?: any): void;
|
|
11
|
+
warn(message?: any, ...optionalParams: any[]): void;
|
|
12
|
+
record(message?: any, ...optionalParams: any[]): void;
|
|
13
|
+
clientLog(message?: any, ...optionalParams: any[]): void;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { BaseModel, BaseService } from './../Database/BaseService';
|
|
2
|
+
import { UserModel } from './UserService';
|
|
3
|
+
import { EAccountFrom } from './ini';
|
|
4
|
+
export declare class AccountModel extends BaseModel {
|
|
5
|
+
id: number;
|
|
6
|
+
phone: string;
|
|
7
|
+
email: string;
|
|
8
|
+
name: string;
|
|
9
|
+
password: string;
|
|
10
|
+
unionid: string;
|
|
11
|
+
openid: string;
|
|
12
|
+
create_time: number;
|
|
13
|
+
create_ip: string;
|
|
14
|
+
login_time: number;
|
|
15
|
+
login_ip: string;
|
|
16
|
+
from: number;
|
|
17
|
+
state: number;
|
|
18
|
+
}
|
|
19
|
+
export declare let GAccountSer: AccountService;
|
|
20
|
+
export declare class AccountService extends BaseService<AccountModel> {
|
|
21
|
+
protected _account_cache_key_pre: string;
|
|
22
|
+
protected _account_cache_time_sec: number;
|
|
23
|
+
constructor();
|
|
24
|
+
protected _getNewModel(): AccountModel;
|
|
25
|
+
/**
|
|
26
|
+
* 注册新账号
|
|
27
|
+
* @param unionid
|
|
28
|
+
* @param openid
|
|
29
|
+
* @param ip
|
|
30
|
+
* @param from
|
|
31
|
+
*/
|
|
32
|
+
add(unionid: string, openid: string, ip: string, from: EAccountFrom): Promise<AccountModel>;
|
|
33
|
+
/**
|
|
34
|
+
* 通过第三方信息获取账号
|
|
35
|
+
* @param unionid
|
|
36
|
+
* @param openid
|
|
37
|
+
*/
|
|
38
|
+
getByThird(unionid: string, openid: string): Promise<AccountModel>;
|
|
39
|
+
/**
|
|
40
|
+
* 通过第三方信息获取账号
|
|
41
|
+
* @param unionid
|
|
42
|
+
*/
|
|
43
|
+
getByUnionid(unionid: string): Promise<AccountModel>;
|
|
44
|
+
getByPhone(phone: string): Promise<AccountModel>;
|
|
45
|
+
/**
|
|
46
|
+
* 登陆接口
|
|
47
|
+
* @param unionid
|
|
48
|
+
* @param openid
|
|
49
|
+
* @param ip
|
|
50
|
+
* @param from
|
|
51
|
+
* @param access_token qq、wechat使用
|
|
52
|
+
*/
|
|
53
|
+
login(unionid: string, openid: string, ip: string, from: EAccountFrom, access_token?: string, extra?: {
|
|
54
|
+
nickname: string;
|
|
55
|
+
sex: number;
|
|
56
|
+
logo: string;
|
|
57
|
+
}): Promise<{
|
|
58
|
+
errcode: any;
|
|
59
|
+
account: AccountModel;
|
|
60
|
+
is_new: boolean;
|
|
61
|
+
}>;
|
|
62
|
+
protected _login(unionid: string, openid: string, from: EAccountFrom): Promise<{
|
|
63
|
+
errcode: any;
|
|
64
|
+
account: AccountModel;
|
|
65
|
+
}>;
|
|
66
|
+
/**
|
|
67
|
+
* 修改密码
|
|
68
|
+
* @param unionid
|
|
69
|
+
* @param openid
|
|
70
|
+
* @param new_pwd
|
|
71
|
+
*/
|
|
72
|
+
updatePwd(unionid: string, openid: string, new_pwd: string): Promise<any>;
|
|
73
|
+
register(type: EAccountFrom, key: string, password: string, ip: string, extra?: any): Promise<{
|
|
74
|
+
user: UserModel;
|
|
75
|
+
errcode: any;
|
|
76
|
+
}>;
|
|
77
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { BaseService } from '../Database/BaseMongoService';
|
|
2
|
+
import { MongoBaseModel } from '../Database/MongoManager';
|
|
3
|
+
import { EAccountFrom } from './ini';
|
|
4
|
+
import { UserModel } from './MongoUserService';
|
|
5
|
+
export declare class AccountModel extends MongoBaseModel {
|
|
6
|
+
id: number;
|
|
7
|
+
phone: string;
|
|
8
|
+
email: string;
|
|
9
|
+
name: string;
|
|
10
|
+
password: string;
|
|
11
|
+
unionid: string;
|
|
12
|
+
openid: string;
|
|
13
|
+
create_time: number;
|
|
14
|
+
create_ip: string;
|
|
15
|
+
login_time: number;
|
|
16
|
+
login_ip: string;
|
|
17
|
+
from: number;
|
|
18
|
+
state: number;
|
|
19
|
+
}
|
|
20
|
+
export declare let GAccountSer: AccountService;
|
|
21
|
+
export declare class AccountService extends BaseService<AccountModel> {
|
|
22
|
+
protected _account_cache_key_pre: string;
|
|
23
|
+
protected _account_cache_time_sec: number;
|
|
24
|
+
constructor();
|
|
25
|
+
protected _getNewModel(): AccountModel;
|
|
26
|
+
/**
|
|
27
|
+
* 注册新账号
|
|
28
|
+
* @param unionid
|
|
29
|
+
* @param openid
|
|
30
|
+
* @param ip
|
|
31
|
+
* @param from
|
|
32
|
+
*/
|
|
33
|
+
add(unionid: string, openid: string, ip: string, from: EAccountFrom): Promise<AccountModel>;
|
|
34
|
+
/**
|
|
35
|
+
* 通过第三方信息获取账号
|
|
36
|
+
* @param unionid
|
|
37
|
+
* @param openid
|
|
38
|
+
*/
|
|
39
|
+
getByThird(unionid: string, openid: string): Promise<AccountModel>;
|
|
40
|
+
/**
|
|
41
|
+
* 通过第三方信息获取账号
|
|
42
|
+
* @param unionid
|
|
43
|
+
*/
|
|
44
|
+
getByUnionid(unionid: string): Promise<AccountModel>;
|
|
45
|
+
getByPhone(phone: string): Promise<AccountModel>;
|
|
46
|
+
/**
|
|
47
|
+
* 登陆接口
|
|
48
|
+
* @param unionid
|
|
49
|
+
* @param openid
|
|
50
|
+
* @param ip
|
|
51
|
+
* @param from
|
|
52
|
+
* @param access_token qq、wechat使用
|
|
53
|
+
*/
|
|
54
|
+
login(unionid: string, openid: string, ip: string, from: EAccountFrom, access_token?: string, extra?: {
|
|
55
|
+
nickname: string;
|
|
56
|
+
sex: number;
|
|
57
|
+
logo: string;
|
|
58
|
+
}): Promise<{
|
|
59
|
+
errcode: any;
|
|
60
|
+
account: AccountModel;
|
|
61
|
+
is_new: boolean;
|
|
62
|
+
}>;
|
|
63
|
+
protected _login(unionid: string, openid: string, from: EAccountFrom): Promise<{
|
|
64
|
+
errcode: any;
|
|
65
|
+
account: AccountModel;
|
|
66
|
+
}>;
|
|
67
|
+
/**
|
|
68
|
+
* 修改密码
|
|
69
|
+
* @param unionid
|
|
70
|
+
* @param openid
|
|
71
|
+
* @param new_pwd
|
|
72
|
+
*/
|
|
73
|
+
updatePwd(unionid: string, openid: string, new_pwd: string): Promise<any>;
|
|
74
|
+
register(type: EAccountFrom, key: string, password: string, ip: string, extra?: any): Promise<{
|
|
75
|
+
user: UserModel;
|
|
76
|
+
errcode: any;
|
|
77
|
+
}>;
|
|
78
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseService } from "../Database/BaseMongoService";
|
|
2
|
+
import { MongoBaseModel } from "../Database/MongoManager";
|
|
3
|
+
export declare class MongoCacheModel extends MongoBaseModel {
|
|
4
|
+
key: string;
|
|
5
|
+
data: any;
|
|
6
|
+
expireAt: number;
|
|
7
|
+
}
|
|
8
|
+
export declare let GMongoCacheSer: MongoCacheService;
|
|
9
|
+
declare class MongoCacheService extends BaseService<MongoCacheModel> {
|
|
10
|
+
constructor();
|
|
11
|
+
getData(key: string): Promise<any>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|