cgserver 7.13.2504 → 7.14.2504
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/debug.log
CHANGED
|
@@ -4,3 +4,5 @@
|
|
|
4
4
|
[0705/134804.446:ERROR:registration_protocol_win.cc(107)] CreateFile: ϵͳ�Ҳ���ָ�����ļ��� (0x2)
|
|
5
5
|
[0705/134805.911:ERROR:registration_protocol_win.cc(107)] CreateFile: ϵͳ�Ҳ���ָ�����ļ��� (0x2)
|
|
6
6
|
[0705/134805.944:ERROR:registration_protocol_win.cc(107)] CreateFile: ϵͳ�Ҳ���ָ�����ļ��� (0x2)
|
|
7
|
+
[0705/155200.976:ERROR:registration_protocol_win.cc(107)] CreateFile: ϵͳ�Ҳ���ָ�����ļ��� (0x2)
|
|
8
|
+
[0705/155201.034:ERROR:registration_protocol_win.cc(107)] CreateFile: ϵͳ�Ҳ���ָ�����ļ��� (0x2)
|
|
@@ -19,7 +19,10 @@ class MongoBaseService {
|
|
|
19
19
|
this._t_type = type;
|
|
20
20
|
this._table = table;
|
|
21
21
|
}
|
|
22
|
-
async getNextId() {
|
|
22
|
+
async getNextId(key) {
|
|
23
|
+
if (!key) {
|
|
24
|
+
key = this._table;
|
|
25
|
+
}
|
|
23
26
|
let id = await MongoManager_1.GMongoMgr.getAutoIds(this._table);
|
|
24
27
|
return id;
|
|
25
28
|
}
|
|
@@ -98,6 +98,11 @@ class MongoManager {
|
|
|
98
98
|
Log_1.GLog.info("mongo try reconnect");
|
|
99
99
|
this.init(this._mongocfg);
|
|
100
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* 获取自增长id
|
|
103
|
+
* @param key
|
|
104
|
+
* @returns 小于等于0为异常
|
|
105
|
+
*/
|
|
101
106
|
async getAutoIds(key) {
|
|
102
107
|
if (!this._mongo) {
|
|
103
108
|
return -1;
|
|
@@ -108,14 +113,17 @@ class MongoManager {
|
|
|
108
113
|
let where = this._convertWhere({ _id: key });
|
|
109
114
|
let rs = await Core_1.core.safeCall(col.findOneAndUpdate, col, where, { $inc: { id: 1 } }, { upsert: true });
|
|
110
115
|
if (rs.ok) {
|
|
111
|
-
|
|
116
|
+
if (rs.value) {
|
|
117
|
+
return rs.value.id + 1;
|
|
118
|
+
}
|
|
119
|
+
return 0 + 1;
|
|
112
120
|
}
|
|
113
|
-
return
|
|
121
|
+
return -1;
|
|
114
122
|
}
|
|
115
123
|
catch (e) {
|
|
116
124
|
Log_1.GLog.error(e.stack);
|
|
117
125
|
}
|
|
118
|
-
return -
|
|
126
|
+
return -2;
|
|
119
127
|
}
|
|
120
128
|
_convertWhere(where) {
|
|
121
129
|
if (!where || !where._id) {
|
|
@@ -50,6 +50,11 @@ declare class MongoManager {
|
|
|
50
50
|
onConnect(): void;
|
|
51
51
|
onEnd(): void;
|
|
52
52
|
onError(err: any): void;
|
|
53
|
+
/**
|
|
54
|
+
* 获取自增长id
|
|
55
|
+
* @param key
|
|
56
|
+
* @returns 小于等于0为异常
|
|
57
|
+
*/
|
|
53
58
|
getAutoIds(key: string): Promise<any>;
|
|
54
59
|
protected _convertWhere(where?: any): any;
|
|
55
60
|
/**
|