cgserver 12.3.5 → 13.0.0
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 +3 -1
- package/dist/lib/Framework/Config/_error_.js +33 -24
- package/dist/lib/Framework/Database/Mongo/MongoBaseService.js +151 -128
- package/dist/lib/Framework/Database/Mongo/MongoManager.js +18 -561
- package/dist/lib/Framework/Decorator/JsonAuthorityValidate.js +1 -5
- package/dist/lib/Framework/Decorator/SyncCallServer.js +2 -2
- package/dist/lib/Framework/Logic/Log.js +20 -5
- package/dist/lib/Framework/Server/WebServer/Controller/MongoBaseUserController.js +12 -30
- package/dist/lib/Framework/Server/WebServer/Controller/MysqlBaseUserController.js +0 -30
- package/dist/lib/Framework/Service/MongoAccountService.js +53 -116
- package/dist/lib/Framework/Service/MongoCacheService.js +23 -19
- package/dist/lib/Framework/Service/MongoUserService.js +39 -77
- package/dist/lib/Framework/Service/MysqlUserService.js +3 -12
- package/dist/lib/Framework/Service/ini.js +4 -10
- package/dist/lib/Framework/global.js +0 -2
- package/dist/lib/Framework/index_export_.js +2 -23
- package/dist/types/Framework/Config/_error_.d.ts +28 -92
- package/dist/types/Framework/Database/Mongo/MongoBaseService.d.ts +35 -113
- package/dist/types/Framework/Database/Mongo/MongoManager.d.ts +4 -145
- package/dist/types/Framework/Decorator/JsonAuthorityValidate.d.ts +1 -2
- package/dist/types/Framework/Logic/Log.d.ts +5 -5
- package/dist/types/Framework/Server/WebServer/Controller/MongoBaseUserController.d.ts +4 -8
- package/dist/types/Framework/Server/WebServer/Controller/MysqlBaseUserController.d.ts +0 -4
- package/dist/types/Framework/Service/MongoAccountService.d.ts +15 -17
- package/dist/types/Framework/Service/MongoCacheService.d.ts +6 -5
- package/dist/types/Framework/Service/MongoUserService.d.ts +14 -26
- package/dist/types/Framework/Service/MysqlUserService.d.ts +2 -4
- package/dist/types/Framework/Service/ini.d.ts +3 -8
- package/dist/types/Framework/global.d.ts +0 -1
- package/dist/types/Framework/index_export_.d.ts +5 -13
- package/package.json +2 -1
- package/dist/lib/Framework/Database/Mongo/MongoServiceManager.js +0 -52
- package/dist/lib/Framework/Decorator/AdminValidate.js +0 -18
- package/dist/lib/Framework/Decorator/AuthorityValidate.js +0 -22
- package/dist/lib/Framework/Decorator/CreatorValidate.js +0 -18
- package/dist/lib/Framework/Decorator/JsonCreatorValidate.js +0 -18
- package/dist/types/Framework/Database/Mongo/MongoServiceManager.d.ts +0 -13
- package/dist/types/Framework/Decorator/AdminValidate.d.ts +0 -1
- package/dist/types/Framework/Decorator/AuthorityValidate.d.ts +0 -2
- package/dist/types/Framework/Decorator/CreatorValidate.d.ts +0 -1
- package/dist/types/Framework/Decorator/JsonCreatorValidate.d.ts +0 -1
|
@@ -15,12 +15,6 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
-
};
|
|
24
18
|
var __importStar = (this && this.__importStar) || (function () {
|
|
25
19
|
var ownKeys = function(o) {
|
|
26
20
|
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
@@ -38,92 +32,60 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
38
32
|
return result;
|
|
39
33
|
};
|
|
40
34
|
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
41
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.MongoUserService =
|
|
39
|
+
exports.MongoUserService = void 0;
|
|
43
40
|
const _ = __importStar(require("underscore"));
|
|
44
41
|
const MongoBaseService_1 = require("../Database/Mongo/MongoBaseService");
|
|
45
|
-
const
|
|
42
|
+
const mongoose_1 = __importDefault(require("mongoose"));
|
|
46
43
|
const ini_1 = require("./ini");
|
|
47
|
-
const SyncCall_1 = require("../Decorator/SyncCall");
|
|
48
|
-
class MongoUserModel extends MongoManager_1.MongoBaseModel {
|
|
49
|
-
id = -1;
|
|
50
|
-
account_id = -1;
|
|
51
|
-
nickname = "";
|
|
52
|
-
sex = -1;
|
|
53
|
-
logo = "";
|
|
54
|
-
state = 0;
|
|
55
|
-
role_group = 4;
|
|
56
|
-
role = 0;
|
|
57
|
-
phone = "";
|
|
58
|
-
wechat = "";
|
|
59
|
-
qq = "";
|
|
60
|
-
email = "";
|
|
61
|
-
about = "";
|
|
62
|
-
pre_user_id = -1;
|
|
63
|
-
exp = 0;
|
|
64
|
-
level = 1; //等级
|
|
65
|
-
vip_exp = 0;
|
|
66
|
-
vip_level = 0; //等级
|
|
67
|
-
is_robot = 0;
|
|
68
|
-
create_time = 0;
|
|
69
|
-
}
|
|
70
|
-
exports.MongoUserModel = MongoUserModel;
|
|
71
44
|
//暂时不实例化,方便重写
|
|
72
45
|
class MongoUserService extends MongoBaseService_1.MongoBaseService {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
46
|
+
constructor(extuserdef) {
|
|
47
|
+
const userSchema = new mongoose_1.default.Schema({ ...{
|
|
48
|
+
_id: { type: Number },
|
|
49
|
+
account_id: { type: String, index: { unique: true } },
|
|
50
|
+
state: { type: Number, default: ini_1.EUserState.Normal },
|
|
51
|
+
is_robot: { type: Boolean, default: false },
|
|
52
|
+
create_time: { type: Date, default: Date.now },
|
|
53
|
+
login_time: { type: Date, default: Date.now },
|
|
54
|
+
create_ip: { type: String, default: "" },
|
|
55
|
+
login_ip: { type: String, default: "" },
|
|
56
|
+
nickname: { type: String, default: "noname" },
|
|
57
|
+
logo: { type: String, default: "" },
|
|
58
|
+
sex: { type: Number, default: 0 }
|
|
59
|
+
}, ...extuserdef }, { id: false });
|
|
60
|
+
userSchema.virtual('id').get(function () {
|
|
61
|
+
return this._id;
|
|
62
|
+
});
|
|
63
|
+
super('user', userSchema);
|
|
64
|
+
}
|
|
65
|
+
async add(account_id, nickname, sex, logo) {
|
|
66
|
+
let m = {};
|
|
67
|
+
m.account_id = account_id;
|
|
68
|
+
if (nickname) {
|
|
69
|
+
m.nickname = nickname;
|
|
70
|
+
}
|
|
71
|
+
if (sex !== undefined) {
|
|
72
|
+
m.sex = sex;
|
|
73
|
+
}
|
|
74
|
+
if (logo) {
|
|
75
|
+
m.logo = logo;
|
|
80
76
|
}
|
|
81
|
-
um.sex = sex || 0;
|
|
82
|
-
um.logo = logo || "";
|
|
83
|
-
um.account_id = account_id;
|
|
84
|
-
um.state = 0;
|
|
85
|
-
um.role_group = group;
|
|
86
|
-
um.role = 0;
|
|
87
|
-
um.create_time = Date.now();
|
|
88
77
|
//随机userid
|
|
89
78
|
let id = 0;
|
|
90
79
|
do {
|
|
91
|
-
id = _.random(
|
|
80
|
+
id = _.random(10000000, 99999999);
|
|
92
81
|
let p = await this.findOne({ id: id }, { id: 1 });
|
|
93
82
|
if (!p) {
|
|
94
83
|
break;
|
|
95
84
|
}
|
|
96
85
|
} while (true);
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
async add(account_id, nickname, sex, logo, group) {
|
|
101
|
-
let um = await this._createNewUser(account_id, nickname, sex, logo, group);
|
|
102
|
-
let rs = await this.insert(um);
|
|
103
|
-
if (rs.errcode || !rs.rs.insertedId) {
|
|
104
|
-
return null;
|
|
105
|
-
}
|
|
106
|
-
um._id = rs.rs.insertedId;
|
|
107
|
-
return um;
|
|
108
|
-
}
|
|
109
|
-
async getByAccountId(account_id) {
|
|
110
|
-
let pm = await this.findOne({ account_id: account_id });
|
|
111
|
-
return pm;
|
|
112
|
-
}
|
|
113
|
-
async updateBaseInfoByAccount(account_id, nickname, sex, logo) {
|
|
114
|
-
let model = {
|
|
115
|
-
nickname: nickname,
|
|
116
|
-
sex: sex,
|
|
117
|
-
logo: logo
|
|
118
|
-
};
|
|
119
|
-
let sr = await this.updateOne({ account_id: account_id }, model);
|
|
120
|
-
if (sr.errcode) {
|
|
121
|
-
return "更新失败";
|
|
122
|
-
}
|
|
123
|
-
return;
|
|
86
|
+
m._id = id;
|
|
87
|
+
let rs = await this.insert(m);
|
|
88
|
+
return rs.model;
|
|
124
89
|
}
|
|
125
90
|
}
|
|
126
91
|
exports.MongoUserService = MongoUserService;
|
|
127
|
-
__decorate([
|
|
128
|
-
SyncCall_1.SyncCall
|
|
129
|
-
], MongoUserService.prototype, "_createNewUser", null);
|
|
@@ -148,8 +148,7 @@ class MysqlUserService extends MysqlBaseService_1.MysqlBaseService {
|
|
|
148
148
|
super(type);
|
|
149
149
|
exports.GUserSer = this;
|
|
150
150
|
}
|
|
151
|
-
async _createNewUser(account_id, nickname, sex, logo
|
|
152
|
-
group = group || ini_1.ERoleGroup.Common;
|
|
151
|
+
async _createNewUser(account_id, nickname, sex, logo) {
|
|
153
152
|
let um = new this._t_type();
|
|
154
153
|
um.account_id = account_id;
|
|
155
154
|
um.nickname = nickname;
|
|
@@ -160,7 +159,6 @@ class MysqlUserService extends MysqlBaseService_1.MysqlBaseService {
|
|
|
160
159
|
um.logo = logo || "";
|
|
161
160
|
um.account_id = account_id;
|
|
162
161
|
um.state = ini_1.EUserState.Waitting;
|
|
163
|
-
um.role_group = group;
|
|
164
162
|
um.role = 0;
|
|
165
163
|
//随机userid
|
|
166
164
|
let id = 0;
|
|
@@ -181,21 +179,14 @@ class MysqlUserService extends MysqlBaseService_1.MysqlBaseService {
|
|
|
181
179
|
}
|
|
182
180
|
return;
|
|
183
181
|
}
|
|
184
|
-
async add(account_id, nickname, sex, logo
|
|
185
|
-
let um = await this._createNewUser(account_id, nickname, sex, logo
|
|
182
|
+
async add(account_id, nickname, sex, logo) {
|
|
183
|
+
let um = await this._createNewUser(account_id, nickname, sex, logo);
|
|
186
184
|
let sr = await this.insert(um);
|
|
187
185
|
if (sr.error || sr.queryResult.length <= 0) {
|
|
188
186
|
return null;
|
|
189
187
|
}
|
|
190
188
|
return um;
|
|
191
189
|
}
|
|
192
|
-
async updateRoleGroup(user_id, role_group) {
|
|
193
|
-
let sr = await this.updateProperty("role_group=?", "id=?", [role_group, user_id]);
|
|
194
|
-
if (sr.error && sr.execResult.affectedRows <= 0) {
|
|
195
|
-
return "更新失败";
|
|
196
|
-
}
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
190
|
async getByAccountId(account_id) {
|
|
200
191
|
let pm = await this.get(null, "account_id=?", [account_id]);
|
|
201
192
|
return pm;
|
|
@@ -1,25 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EAccountFrom = exports.EAccountState = exports.EUserState =
|
|
4
|
-
var ERoleGroup;
|
|
5
|
-
(function (ERoleGroup) {
|
|
6
|
-
ERoleGroup[ERoleGroup["Creator"] = 1] = "Creator";
|
|
7
|
-
ERoleGroup[ERoleGroup["Admin"] = 2] = "Admin";
|
|
8
|
-
ERoleGroup[ERoleGroup["Proxy"] = 3] = "Proxy";
|
|
9
|
-
ERoleGroup[ERoleGroup["Common"] = 4] = "Common"; //普通成员
|
|
10
|
-
})(ERoleGroup || (exports.ERoleGroup = ERoleGroup = {}));
|
|
3
|
+
exports.EAccountFrom = exports.EAccountState = exports.EUserState = void 0;
|
|
11
4
|
var EUserState;
|
|
12
5
|
(function (EUserState) {
|
|
6
|
+
EUserState[EUserState["Delete"] = -2] = "Delete";
|
|
13
7
|
EUserState[EUserState["Ban"] = -1] = "Ban";
|
|
14
8
|
EUserState[EUserState["Waitting"] = 0] = "Waitting";
|
|
15
|
-
EUserState[EUserState["
|
|
9
|
+
EUserState[EUserState["Normal"] = 1] = "Normal";
|
|
16
10
|
})(EUserState || (exports.EUserState = EUserState = {}));
|
|
17
11
|
var EAccountState;
|
|
18
12
|
(function (EAccountState) {
|
|
19
13
|
EAccountState[EAccountState["Delete"] = -2] = "Delete";
|
|
20
14
|
EAccountState[EAccountState["Ban"] = -1] = "Ban";
|
|
21
15
|
EAccountState[EAccountState["Waitting"] = 0] = "Waitting";
|
|
22
|
-
EAccountState[EAccountState["
|
|
16
|
+
EAccountState[EAccountState["Normal"] = 1] = "Normal";
|
|
23
17
|
})(EAccountState || (exports.EAccountState = EAccountState = {}));
|
|
24
18
|
var EAccountFrom;
|
|
25
19
|
(function (EAccountFrom) {
|
|
@@ -6,7 +6,6 @@ const ByteTool_1 = require("./Core/ByteTool");
|
|
|
6
6
|
const DBCache_1 = require("./Database/Decorator/DBCache");
|
|
7
7
|
const MSSqlManager_1 = require("./Database/MSSql/MSSqlManager");
|
|
8
8
|
const MongoManager_1 = require("./Database/Mongo/MongoManager");
|
|
9
|
-
const MongoServiceManager_1 = require("./Database/Mongo/MongoServiceManager");
|
|
10
9
|
const MysqlManager_1 = require("./Database/Mysql/MysqlManager");
|
|
11
10
|
const CacheTool_1 = require("./Logic/CacheTool");
|
|
12
11
|
const EventTool_1 = require("./Logic/EventTool");
|
|
@@ -31,7 +30,6 @@ const CgRankTool_1 = require("./ThirdParty/CgRankTool");
|
|
|
31
30
|
* cg引擎的,全局对象
|
|
32
31
|
*/
|
|
33
32
|
class global {
|
|
34
|
-
static gMongoServiceMgr = MongoServiceManager_1.gMongoServiceMgr;
|
|
35
33
|
static gCgServer = cgserver_1.gCgServer;
|
|
36
34
|
static gDbCache = DBCache_1.gDbCache;
|
|
37
35
|
static gTriggerMgr = TriggerMgr_1.gTriggerMgr;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.global = exports.SyncCallServer2 = exports.SyncCallServer = exports.SyncCall2 = exports.SyncCall = exports.IRpcClientWebSocket = exports.IRpcServerWebSocket = exports.RpcConfig = exports.CgMq = exports.Rpc = exports.RpcBaseMsg = exports.PacketParser = exports.SocketServerConfig = exports.ISocketServer = exports.ISocket = exports.IServerSocket = exports.IClientSocket = exports.EAccountState = exports.WebServerConfig = exports.Response = exports.Request = exports.RazorJs = exports.Engine = exports.
|
|
3
|
+
exports.IServerWebSocket = exports.JsonProtoFilter = exports.GoogleProtoFilter = exports.EProtoType = exports.RedisManager = exports.MysqlConfig = exports.MongoConfig = exports.MSSqlConfig = exports.DbConfig = exports.MongoCacheService = exports.MysqlUserModel = exports.MongoUserService = exports.MysqlUserService = exports.MongoAccountService = exports.MysqlAccountService = exports.EAccountFrom = exports.EUserState = exports.SqlReturns = exports.SqlReturn = exports.MysqlBaseService = exports.MongoExt = exports.MongoManager = 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.CgRankRankData = exports.CgRankRankItem = exports.CgRankCommandItem = exports.CgRankTool = exports.AliSmsConfig = exports.AlipaySdk = exports.EAlipayExecType = 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.PacketParser = exports.SocketServerConfig = exports.ISocketServer = exports.ISocket = exports.IServerSocket = exports.IClientSocket = exports.EAccountState = exports.WebServerConfig = exports.Response = exports.Request = exports.RazorJs = exports.Engine = exports.JsonAuthorityValidate = exports.MysqlAccountModel = exports.MongoBaseUserController = exports.BaseController = exports.IWebServer = exports.BaseMsg = exports.IWebSocket = exports.WebSocketServerConfig = exports.IWebSocketServer = exports.IClientWebSocket = void 0;
|
|
5
5
|
var AlipayTool_1 = require("./ThirdParty/AlipayTool");
|
|
6
6
|
Object.defineProperty(exports, "EAlipayExecType", { enumerable: true, get: function () { return AlipayTool_1.EAlipayExecType; } });
|
|
7
7
|
var alipay_sdk_1 = require("alipay-sdk");
|
|
@@ -13,8 +13,6 @@ Object.defineProperty(exports, "CgRankTool", { enumerable: true, get: function (
|
|
|
13
13
|
Object.defineProperty(exports, "CgRankCommandItem", { enumerable: true, get: function () { return CgRankTool_1.CgRankCommandItem; } });
|
|
14
14
|
Object.defineProperty(exports, "CgRankRankItem", { enumerable: true, get: function () { return CgRankTool_1.CgRankRankItem; } });
|
|
15
15
|
Object.defineProperty(exports, "CgRankRankData", { enumerable: true, get: function () { return CgRankTool_1.CgRankRankData; } });
|
|
16
|
-
var MongoServiceManager_1 = require("./Database/Mongo/MongoServiceManager");
|
|
17
|
-
Object.defineProperty(exports, "MongoServiceManager", { enumerable: true, get: function () { return MongoServiceManager_1.MongoServiceManager; } });
|
|
18
16
|
var AiObject_1 = require("./AI/AiObject");
|
|
19
17
|
Object.defineProperty(exports, "AiObject", { enumerable: true, get: function () { return AiObject_1.AiObject; } });
|
|
20
18
|
var Astar_1 = require("./AI/Astar");
|
|
@@ -59,7 +57,6 @@ Object.defineProperty(exports, "MongoBaseService", { enumerable: true, get: func
|
|
|
59
57
|
var MysqlBaseService_1 = require("./Database/Mysql/MysqlBaseService");
|
|
60
58
|
Object.defineProperty(exports, "MysqlBaseModel", { enumerable: true, get: function () { return MysqlBaseService_1.BaseModel; } });
|
|
61
59
|
var MongoManager_1 = require("./Database/Mongo/MongoManager");
|
|
62
|
-
Object.defineProperty(exports, "MongoBaseModel", { enumerable: true, get: function () { return MongoManager_1.MongoBaseModel; } });
|
|
63
60
|
Object.defineProperty(exports, "MongoManager", { enumerable: true, get: function () { return MongoManager_1.MongoManager; } });
|
|
64
61
|
Object.defineProperty(exports, "MongoExt", { enumerable: true, get: function () { return MongoManager_1.MongoExt; } });
|
|
65
62
|
var MysqlBaseService_2 = require("./Database/Mysql/MysqlBaseService");
|
|
@@ -68,7 +65,6 @@ var MysqlManager_1 = require("./Database/Mysql/MysqlManager");
|
|
|
68
65
|
Object.defineProperty(exports, "SqlReturn", { enumerable: true, get: function () { return MysqlManager_1.SqlReturn; } });
|
|
69
66
|
Object.defineProperty(exports, "SqlReturns", { enumerable: true, get: function () { return MysqlManager_1.SqlReturns; } });
|
|
70
67
|
var ini_1 = require("./Service/ini");
|
|
71
|
-
Object.defineProperty(exports, "ERoleGroup", { enumerable: true, get: function () { return ini_1.ERoleGroup; } });
|
|
72
68
|
Object.defineProperty(exports, "EUserState", { enumerable: true, get: function () { return ini_1.EUserState; } });
|
|
73
69
|
Object.defineProperty(exports, "EAccountFrom", { enumerable: true, get: function () { return ini_1.EAccountFrom; } });
|
|
74
70
|
var MysqlAccountService_1 = require("./Service/MysqlAccountService");
|
|
@@ -81,10 +77,7 @@ var MongoUserService_1 = require("./Service/MongoUserService");
|
|
|
81
77
|
Object.defineProperty(exports, "MongoUserService", { enumerable: true, get: function () { return MongoUserService_1.MongoUserService; } });
|
|
82
78
|
var MysqlUserService_2 = require("./Service/MysqlUserService");
|
|
83
79
|
Object.defineProperty(exports, "MysqlUserModel", { enumerable: true, get: function () { return MysqlUserService_2.MysqlUserModel; } });
|
|
84
|
-
var MongoUserService_2 = require("./Service/MongoUserService");
|
|
85
|
-
Object.defineProperty(exports, "MongoUserModel", { enumerable: true, get: function () { return MongoUserService_2.MongoUserModel; } });
|
|
86
80
|
var MongoCacheService_1 = require("./Service/MongoCacheService");
|
|
87
|
-
Object.defineProperty(exports, "MongoCacheModel", { enumerable: true, get: function () { return MongoCacheService_1.MongoCacheModel; } });
|
|
88
81
|
Object.defineProperty(exports, "MongoCacheService", { enumerable: true, get: function () { return MongoCacheService_1.MongoCacheService; } });
|
|
89
82
|
var DbConfig_1 = require("./Config/DbConfig");
|
|
90
83
|
Object.defineProperty(exports, "DbConfig", { enumerable: true, get: function () { return DbConfig_1.DbConfig; } });
|
|
@@ -116,26 +109,12 @@ var IWebServer_1 = require("./Server/WebServer/IWebServer");
|
|
|
116
109
|
Object.defineProperty(exports, "IWebServer", { enumerable: true, get: function () { return IWebServer_1.IWebServer; } });
|
|
117
110
|
var BaseController_1 = require("./Server/WebServer/Controller/BaseController");
|
|
118
111
|
Object.defineProperty(exports, "BaseController", { enumerable: true, get: function () { return BaseController_1.BaseController; } });
|
|
119
|
-
var MysqlBaseUserController_1 = require("./Server/WebServer/Controller/MysqlBaseUserController");
|
|
120
|
-
Object.defineProperty(exports, "MysqlBaseUserController", { enumerable: true, get: function () { return MysqlBaseUserController_1.MysqlBaseUserController; } });
|
|
121
112
|
var MongoBaseUserController_1 = require("./Server/WebServer/Controller/MongoBaseUserController");
|
|
122
113
|
Object.defineProperty(exports, "MongoBaseUserController", { enumerable: true, get: function () { return MongoBaseUserController_1.MongoBaseUserController; } });
|
|
123
114
|
var MysqlAccountService_2 = require("./Service/MysqlAccountService");
|
|
124
115
|
Object.defineProperty(exports, "MysqlAccountModel", { enumerable: true, get: function () { return MysqlAccountService_2.MysqlAccountModel; } });
|
|
125
|
-
var MongoAccountService_2 = require("./Service/MongoAccountService");
|
|
126
|
-
Object.defineProperty(exports, "MongoAccountModel", { enumerable: true, get: function () { return MongoAccountService_2.MongoAccountModel; } });
|
|
127
|
-
var AdminValidate_1 = require("./Decorator/AdminValidate");
|
|
128
|
-
Object.defineProperty(exports, "AdminValidate", { enumerable: true, get: function () { return AdminValidate_1.AdminValidate; } });
|
|
129
|
-
var AuthorityValidate_1 = require("./Decorator/AuthorityValidate");
|
|
130
|
-
Object.defineProperty(exports, "AuthorityValidate", { enumerable: true, get: function () { return AuthorityValidate_1.AuthorityValidate; } });
|
|
131
|
-
var CreatorValidate_1 = require("./Decorator/CreatorValidate");
|
|
132
|
-
Object.defineProperty(exports, "CreatorValidate", { enumerable: true, get: function () { return CreatorValidate_1.CreatorValidate; } });
|
|
133
|
-
var JsonAdminValidate_1 = require("./Decorator/JsonAdminValidate");
|
|
134
|
-
Object.defineProperty(exports, "JsonAdminValidate", { enumerable: true, get: function () { return JsonAdminValidate_1.JsonAdminValidate; } });
|
|
135
116
|
var JsonAuthorityValidate_1 = require("./Decorator/JsonAuthorityValidate");
|
|
136
117
|
Object.defineProperty(exports, "JsonAuthorityValidate", { enumerable: true, get: function () { return JsonAuthorityValidate_1.JsonAuthorityValidate; } });
|
|
137
|
-
var JsonCreatorValidate_1 = require("./Decorator/JsonCreatorValidate");
|
|
138
|
-
Object.defineProperty(exports, "JsonCreatorValidate", { enumerable: true, get: function () { return JsonCreatorValidate_1.JsonCreatorValidate; } });
|
|
139
118
|
var Engine_1 = require("./Server/WebServer/Engine/Engine");
|
|
140
119
|
Object.defineProperty(exports, "Engine", { enumerable: true, get: function () { return Engine_1.Engine; } });
|
|
141
120
|
var RazorJs_1 = require("./Server/WebServer/Engine/RazorJs");
|
|
@@ -1,99 +1,35 @@
|
|
|
1
1
|
export declare let EErrorCode: FrameworkErrorCode;
|
|
2
|
+
export declare class Errcode {
|
|
3
|
+
id: number;
|
|
4
|
+
des: string;
|
|
5
|
+
constructor(id: number, des: string);
|
|
6
|
+
}
|
|
2
7
|
/**
|
|
3
8
|
* 1-100
|
|
4
9
|
*/
|
|
5
10
|
export declare class FrameworkErrorCode {
|
|
6
|
-
Wrong_Params:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
};
|
|
30
|
-
Mysql_Error: {
|
|
31
|
-
id: number;
|
|
32
|
-
des: string;
|
|
33
|
-
};
|
|
34
|
-
No_Mysql: {
|
|
35
|
-
id: number;
|
|
36
|
-
des: string;
|
|
37
|
-
};
|
|
38
|
-
No_Mssql: {
|
|
39
|
-
id: number;
|
|
40
|
-
des: string;
|
|
41
|
-
};
|
|
42
|
-
No_User: {
|
|
43
|
-
id: number;
|
|
44
|
-
des: string;
|
|
45
|
-
};
|
|
46
|
-
Account_Phone_Exist: {
|
|
47
|
-
id: number;
|
|
48
|
-
des: string;
|
|
49
|
-
};
|
|
50
|
-
Account_Email_Exist: {
|
|
51
|
-
id: number;
|
|
52
|
-
des: string;
|
|
53
|
-
};
|
|
54
|
-
Account_Name_Exist: {
|
|
55
|
-
id: number;
|
|
56
|
-
des: string;
|
|
57
|
-
};
|
|
58
|
-
Account_Type_Error: {
|
|
59
|
-
id: number;
|
|
60
|
-
des: string;
|
|
61
|
-
};
|
|
62
|
-
Email_Send_Failed: {
|
|
63
|
-
id: number;
|
|
64
|
-
des: string;
|
|
65
|
-
};
|
|
66
|
-
Login_Failed: {
|
|
67
|
-
id: number;
|
|
68
|
-
des: string;
|
|
69
|
-
};
|
|
70
|
-
Password_Too_Short: {
|
|
71
|
-
id: number;
|
|
72
|
-
des: string;
|
|
73
|
-
};
|
|
74
|
-
Wrong_Phone: {
|
|
75
|
-
id: number;
|
|
76
|
-
des: string;
|
|
77
|
-
};
|
|
78
|
-
PhoneCode_Too_Quick: {
|
|
79
|
-
id: number;
|
|
80
|
-
des: string;
|
|
81
|
-
};
|
|
82
|
-
PhoneCode_GetFailed: {
|
|
83
|
-
id: number;
|
|
84
|
-
des: string;
|
|
85
|
-
};
|
|
86
|
-
Wrong_Phone_Code: {
|
|
87
|
-
id: number;
|
|
88
|
-
des: string;
|
|
89
|
-
};
|
|
90
|
-
No_Mongo: {
|
|
91
|
-
id: number;
|
|
92
|
-
des: string;
|
|
93
|
-
};
|
|
94
|
-
Mongo_Error: {
|
|
95
|
-
id: number;
|
|
96
|
-
des: string;
|
|
97
|
-
};
|
|
11
|
+
Wrong_Params: Errcode;
|
|
12
|
+
Verify_failed: Errcode;
|
|
13
|
+
Account_Create_Failed: Errcode;
|
|
14
|
+
User_Create_Failed: Errcode;
|
|
15
|
+
Server_Error: Errcode;
|
|
16
|
+
No_Account: Errcode;
|
|
17
|
+
Mysql_Error: Errcode;
|
|
18
|
+
No_Mysql: Errcode;
|
|
19
|
+
No_Mssql: Errcode;
|
|
20
|
+
No_User: Errcode;
|
|
21
|
+
Account_Phone_Exist: Errcode;
|
|
22
|
+
Account_Email_Exist: Errcode;
|
|
23
|
+
Account_Name_Exist: Errcode;
|
|
24
|
+
Account_Type_Error: Errcode;
|
|
25
|
+
Email_Send_Failed: Errcode;
|
|
26
|
+
Login_Failed: Errcode;
|
|
27
|
+
Password_Too_Short: Errcode;
|
|
28
|
+
Wrong_Phone: Errcode;
|
|
29
|
+
PhoneCode_Too_Quick: Errcode;
|
|
30
|
+
PhoneCode_GetFailed: Errcode;
|
|
31
|
+
Wrong_Phone_Code: Errcode;
|
|
32
|
+
No_Mongo: Errcode;
|
|
33
|
+
Mongo_Error: Errcode;
|
|
98
34
|
constructor();
|
|
99
35
|
}
|
|
@@ -1,119 +1,41 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
export declare class MongoBaseService<T extends
|
|
4
|
-
protected
|
|
5
|
-
|
|
6
|
-
protected
|
|
7
|
-
get
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}, dbname?: string);
|
|
18
|
-
getNextId(key?: string): Promise<number>;
|
|
19
|
-
toObjectId(id: string): mongo.BSON.ObjectId;
|
|
20
|
-
/**
|
|
21
|
-
* 没有id(非_id)的表不能使用该函数
|
|
22
|
-
* @param id
|
|
23
|
-
*/
|
|
24
|
-
getById(id: any): Promise<T>;
|
|
25
|
-
findOne(where?: {
|
|
26
|
-
[key: string]: any;
|
|
27
|
-
}, property?: {
|
|
28
|
-
[key: string]: any;
|
|
29
|
-
}): Promise<T>;
|
|
30
|
-
findOneAndUpdate(where: {
|
|
31
|
-
[key: string]: any;
|
|
32
|
-
}, update: any, options?: mongo.FindOneAndUpdateOptions): Promise<T>;
|
|
33
|
-
countDocuments(where?: {
|
|
34
|
-
[key: string]: any;
|
|
35
|
-
}, options?: mongo.CountDocumentsOptions): Promise<number>;
|
|
36
|
-
findMany(where?: {
|
|
37
|
-
[key: string]: any;
|
|
38
|
-
}, property?: any, sort?: any, skip?: number, limit?: number): Promise<T[]>;
|
|
39
|
-
getRandoms(num: number, where: {
|
|
40
|
-
[key: string]: any;
|
|
41
|
-
}, property?: {
|
|
42
|
-
[key: string]: any;
|
|
43
|
-
}): Promise<T[]>;
|
|
44
|
-
updateOne(where: {
|
|
45
|
-
[key: string]: any;
|
|
46
|
-
}, model: any, options?: mongo.UpdateOptions): Promise<{
|
|
47
|
-
errcode: {
|
|
48
|
-
id: number;
|
|
49
|
-
des: string;
|
|
50
|
-
};
|
|
51
|
-
rs: mongo.UpdateResult;
|
|
1
|
+
import mongoose, { Document, FilterQuery, UpdateQuery, Types, MongooseQueryOptions } from 'mongoose';
|
|
2
|
+
import { Errcode } from '../../Config/_error_';
|
|
3
|
+
export declare class MongoBaseService<T extends Document> {
|
|
4
|
+
protected _model: mongoose.Model<T>;
|
|
5
|
+
protected _schema: mongoose.Schema<T>;
|
|
6
|
+
protected _collection_name: string;
|
|
7
|
+
get model(): mongoose.Model<T, {}, {}, {}, mongoose.IfAny<T, any, mongoose.Document<unknown, {}, T, {}> & mongoose.Default__v<mongoose.Require_id<T>>>, any>;
|
|
8
|
+
constructor(collection_name: string, schema: mongoose.Schema<T>);
|
|
9
|
+
findOne(filter?: FilterQuery<T>, projection?: any, options?: any): Promise<T | null>;
|
|
10
|
+
find(filter?: FilterQuery<T>, projection?: mongoose.ProjectionType<T>, options?: MongooseQueryOptions): Promise<T[]>;
|
|
11
|
+
findMany(filter?: FilterQuery<T>, projection?: any, options?: any, skip?: number, limit?: number): Promise<T[]>;
|
|
12
|
+
findById(id: string | Types.ObjectId, projection?: any, options?: any): Promise<T | null>;
|
|
13
|
+
create(doc: Partial<T>): Promise<T>;
|
|
14
|
+
insert(doc: Partial<T>): Promise<{
|
|
15
|
+
errcode: Errcode;
|
|
16
|
+
model?: T;
|
|
52
17
|
}>;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
errcode: {
|
|
57
|
-
id: number;
|
|
58
|
-
des: string;
|
|
59
|
-
};
|
|
60
|
-
rs: mongo.Document | mongo.UpdateResult;
|
|
18
|
+
updateOne(filter: FilterQuery<T>, update: UpdateQuery<T>, options?: any): Promise<{
|
|
19
|
+
errcode?: Errcode;
|
|
20
|
+
rs?: mongoose.UpdateResult;
|
|
61
21
|
}>;
|
|
62
|
-
|
|
63
|
-
errcode:
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
};
|
|
67
|
-
rs: mongo.InsertOneResult<any>;
|
|
22
|
+
updateMany(filter: FilterQuery<T>, update: UpdateQuery<T>, options?: any): Promise<{
|
|
23
|
+
errcode: null;
|
|
24
|
+
} | {
|
|
25
|
+
errcode: any;
|
|
68
26
|
}>;
|
|
69
|
-
deleteOne(
|
|
70
|
-
errcode:
|
|
71
|
-
|
|
72
|
-
des: string;
|
|
73
|
-
};
|
|
74
|
-
count: number;
|
|
27
|
+
deleteOne(filter: FilterQuery<T>): Promise<{
|
|
28
|
+
errcode: Errcode;
|
|
29
|
+
rs?: mongoose.DeleteResult;
|
|
75
30
|
}>;
|
|
76
|
-
deleteMany(
|
|
77
|
-
errcode:
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
};
|
|
81
|
-
count: number;
|
|
31
|
+
deleteMany(filter: FilterQuery<T>): Promise<{
|
|
32
|
+
errcode: null;
|
|
33
|
+
} | {
|
|
34
|
+
errcode: any;
|
|
82
35
|
}>;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
rs: string;
|
|
89
|
-
}>;
|
|
90
|
-
aggregate(pipeline?: Document[], options?: mongo.AggregateOptions): mongo.AggregationCursor<mongo.BSON.Document>;
|
|
91
|
-
/**
|
|
92
|
-
* 仅仅支持一级
|
|
93
|
-
* @param array 数据名称 比如 items
|
|
94
|
-
* @param where 数组内赛选条件 比如 "items.id":1
|
|
95
|
-
* @param pre_match 数组上一级赛选条件 比如 "user_id":1
|
|
96
|
-
*/
|
|
97
|
-
getsInArray<T>(array: string, where?: {
|
|
98
|
-
[key: string]: any;
|
|
99
|
-
}, pre_match?: any): Promise<T[]>;
|
|
100
|
-
/**
|
|
101
|
-
* 仅仅支持一级
|
|
102
|
-
* @param array 数据名称 比如 items
|
|
103
|
-
* @param where 数组内赛选条件 比如 "items.id":1
|
|
104
|
-
* @param pre_match 数组上一级赛选条件 比如 "user_id":1
|
|
105
|
-
*/
|
|
106
|
-
getInArray<T>(array: string, where?: {
|
|
107
|
-
[key: string]: any;
|
|
108
|
-
}, pre_match?: any): Promise<T>;
|
|
109
|
-
distinct(key: string | number, where?: {
|
|
110
|
-
[key: string]: any;
|
|
111
|
-
}): Promise<{
|
|
112
|
-
errcode: {
|
|
113
|
-
id: number;
|
|
114
|
-
des: string;
|
|
115
|
-
};
|
|
116
|
-
lst: any;
|
|
117
|
-
}>;
|
|
118
|
-
bulkWrite(operations: mongo.AnyBulkWriteOperation<mongo.BSON.Document>[], options?: mongo.BulkWriteOptions): Promise<mongo.BulkWriteResult>;
|
|
36
|
+
exists(filter: FilterQuery<T>): Promise<boolean>;
|
|
37
|
+
aggregate(pipeline?: any[]): mongoose.Aggregate<any[]>;
|
|
38
|
+
findOneAndUpdate(filter: FilterQuery<T>, update: UpdateQuery<T>, options?: any): Promise<T | null>;
|
|
39
|
+
countDocuments(filter?: FilterQuery<T>): Promise<number>;
|
|
40
|
+
getAutoIds(): Promise<number>;
|
|
119
41
|
}
|