cgserver 9.2.0 → 9.2.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/README.md
CHANGED
|
@@ -148,8 +148,8 @@ class MysqlBaseService {
|
|
|
148
148
|
sql += " limit 1";
|
|
149
149
|
let tm = null;
|
|
150
150
|
let sr = await MysqlManager_1.GMysqlMgr.query(sql, args);
|
|
151
|
-
if (sr.
|
|
152
|
-
tm = sr.
|
|
151
|
+
if (sr.queryResult && sr.queryResult.length > 0) {
|
|
152
|
+
tm = sr.queryResult[0];
|
|
153
153
|
}
|
|
154
154
|
return tm;
|
|
155
155
|
}
|
|
@@ -162,8 +162,8 @@ class MysqlBaseService {
|
|
|
162
162
|
}
|
|
163
163
|
let total = 0;
|
|
164
164
|
let sr = await MysqlManager_1.GMysqlMgr.query(sql, args);
|
|
165
|
-
if (sr.
|
|
166
|
-
total = sr.
|
|
165
|
+
if (sr.queryResult && sr.queryResult.length > 0) {
|
|
166
|
+
total = sr.queryResult[0].num || 0;
|
|
167
167
|
}
|
|
168
168
|
return total;
|
|
169
169
|
}
|
|
@@ -176,7 +176,7 @@ class MysqlBaseService {
|
|
|
176
176
|
}
|
|
177
177
|
let tms = null;
|
|
178
178
|
let sr = await MysqlManager_1.GMysqlMgr.query(sql, args);
|
|
179
|
-
tms = sr.
|
|
179
|
+
tms = sr.queryResult;
|
|
180
180
|
return tms;
|
|
181
181
|
}
|
|
182
182
|
async getCount(where, args) {
|
|
@@ -203,7 +203,7 @@ class MysqlBaseService {
|
|
|
203
203
|
args.push(num);
|
|
204
204
|
let tms = null;
|
|
205
205
|
let sr = await MysqlManager_1.GMysqlMgr.query(sql, args);
|
|
206
|
-
tms = sr.
|
|
206
|
+
tms = sr.queryResult;
|
|
207
207
|
return tms;
|
|
208
208
|
}
|
|
209
209
|
async updateProperty(set, where, args, limit) {
|
|
@@ -14,7 +14,6 @@ class SqlReturn {
|
|
|
14
14
|
error = null;
|
|
15
15
|
result = null;
|
|
16
16
|
fields = null;
|
|
17
|
-
list = null;
|
|
18
17
|
get queryResult() {
|
|
19
18
|
return this.result;
|
|
20
19
|
}
|
|
@@ -67,13 +66,6 @@ class MysqlManager {
|
|
|
67
66
|
try {
|
|
68
67
|
const [result, fields] = await this._pool.query(sqlStr, values);
|
|
69
68
|
sr.result = result;
|
|
70
|
-
let rs = result;
|
|
71
|
-
if (rs && rs.length) {
|
|
72
|
-
sr.list = [];
|
|
73
|
-
for (let i = 0; i < rs.length; ++i) {
|
|
74
|
-
sr.list.push(rs[i]);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
69
|
sr.fields = fields;
|
|
78
70
|
}
|
|
79
71
|
catch (error) {
|
|
@@ -98,12 +98,13 @@ class Engine {
|
|
|
98
98
|
let time_str = (Date.now() - time) + "ms";
|
|
99
99
|
Log_1.GLog.info("[" + time_str + "] " + req.method + " " + req.url);
|
|
100
100
|
}
|
|
101
|
-
}).catch(() => {
|
|
101
|
+
}).catch((err) => {
|
|
102
102
|
res.sendStatus(500);
|
|
103
103
|
let exreq = new Request_1.Request(req, this._cfg);
|
|
104
104
|
let info = exreq.getDebugInfo();
|
|
105
105
|
info["tip"] = "server error";
|
|
106
106
|
Log_1.GLog.error(info);
|
|
107
|
+
Log_1.GLog.error(err);
|
|
107
108
|
});
|
|
108
109
|
});
|
|
109
110
|
}
|
|
@@ -8,7 +8,6 @@ export declare class SqlReturn {
|
|
|
8
8
|
error: any;
|
|
9
9
|
result: mysql2.QueryResult;
|
|
10
10
|
fields: any;
|
|
11
|
-
list: Array<any>;
|
|
12
11
|
get queryResult(): mysql2.RowDataPacket[];
|
|
13
12
|
get execResult(): mysql2.ResultSetHeader;
|
|
14
13
|
}
|
|
@@ -24,7 +23,7 @@ declare class MysqlManager {
|
|
|
24
23
|
constructor();
|
|
25
24
|
init(cfg: MysqlConfig): Promise<void>;
|
|
26
25
|
registerInitCb(cb: Function): void;
|
|
27
|
-
query(sqlStr:
|
|
26
|
+
query(sqlStr: string, values?: any): Promise<SqlReturn>;
|
|
28
27
|
transaction(sqls: any[]): Promise<SqlReturns>;
|
|
29
28
|
}
|
|
30
29
|
export {};
|