cgserver 6.1.9 → 6.2.2

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.
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.core = void 0;
4
- let Md5 = require("md5");
5
4
  let os = require('os');
6
5
  let request = require('request');
7
6
  const _ = require("underscore");
7
+ const crypto = require("crypto");
8
8
  /**
9
9
  * 常用的工具函数类
10
10
  */
@@ -321,13 +321,14 @@ class core {
321
321
  newStr += last;
322
322
  return newStr;
323
323
  }
324
- static md5 = function (data) {
325
- let str = data;
326
- if (!core.isString(data)) {
327
- str = JSON.stringify(data);
328
- }
329
- return Md5(str);
330
- };
324
+ static md5(str) {
325
+ let md5_str = crypto.createHash('md5').update(str).digest('hex');
326
+ return md5_str;
327
+ }
328
+ static sha1(str) {
329
+ let sha1_str = crypto.createHash('sha1').update(str).digest('hex');
330
+ return sha1_str;
331
+ }
331
332
  static getLocalIP = function () {
332
333
  let iptable = {};
333
334
  let ifaces = os.networkInterfaces();
@@ -72,7 +72,7 @@ class BaseService {
72
72
  return rs;
73
73
  }
74
74
  aggregate(pipeline, options) {
75
- let ret = MongoManager_1.GMongoMgr.aggregate(this._table);
75
+ let ret = MongoManager_1.GMongoMgr.aggregate(this._table, pipeline, options);
76
76
  return ret;
77
77
  }
78
78
  }
@@ -299,7 +299,7 @@ class MongoManager {
299
299
  money = true;
300
300
  }
301
301
  }
302
- if (money) {
302
+ if (!money) {
303
303
  updatemodel = { "$set": model };
304
304
  }
305
305
  else {
@@ -38,7 +38,8 @@ export declare class core {
38
38
  * @param str
39
39
  */
40
40
  static fuzzy(str: string): string;
41
- static md5: (data: any) => any;
41
+ static md5(str: string): string;
42
+ static sha1(str: string): string;
42
43
  static getLocalIP: () => any;
43
44
  static getIP: () => Promise<string>;
44
45
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cgserver",
3
- "version": "6.1.9",
3
+ "version": "6.2.2",
4
4
  "author": "trojan",
5
5
  "type": "commonjs",
6
6
  "description": "free for all.Websocket or Http",
@@ -35,7 +35,6 @@
35
35
  "@types/cors": "^2.8.12",
36
36
  "@types/express": "^4.17.13",
37
37
  "@types/formidable": "^2.0.0",
38
- "@types/md5": "^2.3.1",
39
38
  "@types/mime": "^2.0.3",
40
39
  "@types/mssql": "^7.1.5",
41
40
  "@types/mysql": "^2.15.19",
@@ -61,7 +60,6 @@
61
60
  "https": "^1.0.0",
62
61
  "jsonc": "^2.0.0",
63
62
  "log4js": "^6.3.0",
64
- "md5": "^2.3.0",
65
63
  "mime": "^3.0.0",
66
64
  "mongodb": "^4.2.1",
67
65
  "mssql": "^8.0.2",
@@ -80,7 +78,5 @@
80
78
  "webpack": "^5.73.0",
81
79
  "webpack-node-externals": "^3.0.0",
82
80
  "websocket": "^1.0.34"
83
- },
84
- "devDependencies": {
85
81
  }
86
82
  }