@qingfu/core-env 0.4.0 → 0.4.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.
package/lib/helper.js CHANGED
@@ -96,6 +96,15 @@ helper.parseLike = ( ...fields ) => {
96
96
  };
97
97
  };
98
98
 
99
+ helper.ip2geo = async ( ctx, next ) => {
100
+ try {
101
+ ctx.state.geo = await brokers( 'core' ).call( 'chunzhen.geo', { ip: ctx.ip });
102
+ } catch ( err ) {
103
+ ( global.logger || global.console ).warn( err );
104
+ }
105
+ return await next();
106
+ };
107
+
99
108
  helper.wmpTestGet = async ctx => {
100
109
  let { signature, timestamp, nonce, echostr } = ctx.query;
101
110
  let platform = await brokers( 'core' ).call( 'platform.findOne', { appID: ctx.params.appID });
package/lib/queue.js CHANGED
@@ -38,6 +38,11 @@ if ( process.env.BULLMQ_URI ) {
38
38
  let queue = new Queue( name, { connection, prefix: DEFAULT_PREFIX, ...options });
39
39
  queue.add = _.wrap( queue.add, function( func, ...args ) {
40
40
  if ( !_.isString( args[ 0 ])) args = [ DEFAULT_NAME, ...args ];
41
+ let cron = _.get( _.last( args ), 'repeat.cron' );
42
+ if ( cron ) {
43
+ _.set( _.last( args ), 'repeat.pattern', cron );
44
+ _.set( _.last( args ), 'repeat.cron', null );
45
+ }
41
46
  return func.apply( this, args );
42
47
  });
43
48
  queue.addBulk = _.wrap( queue.addBulk, function( func, ...args ) {
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@qingfu/core-env",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "readmeFilename": "README.md",
5
5
  "dependencies": {
6
6
  "@koa/cors": "5.0.0",
7
7
  "@koa/router": "12.0.1",
8
8
  "base-x": "4.0.0",
9
- "bull": "4.15.1",
10
- "bullmq": "5.10.3",
9
+ "bull": "4.16.0",
10
+ "bullmq": "5.12.10",
11
11
  "busboy": "1.6.0",
12
12
  "cookie": "0.6.0",
13
13
  "dotenv-extended": "2.9.0",
@@ -22,12 +22,12 @@
22
22
  "koa-methodoverride": "2.0.0",
23
23
  "koa-qs": "3.0.0",
24
24
  "lodash": "4.17.21",
25
- "moleculer": "0.14.33",
26
- "mongoose": "7.6.7",
25
+ "moleculer": "0.14.34",
26
+ "mongoose": "7.8.1",
27
27
  "mongoose-cast-aggregation": "0.3.1",
28
28
  "mongoose-geojson-schema": "2.2.5",
29
29
  "mongoose-lean-defaults": "2.2.1",
30
- "mongoose-lean-getters": "2.1.0",
30
+ "mongoose-lean-getters": "2.1.1",
31
31
  "mongoose-lean-virtuals": "0.9.1",
32
32
  "ms": "2.1.3",
33
33
  "notepack.io": "3.0.1",
@@ -37,7 +37,7 @@
37
37
  "qr-image": "3.2.0",
38
38
  "superagent": "8.1.2",
39
39
  "wechat-encrypt": "1.1.1",
40
- "winston": "3.13.1",
40
+ "winston": "3.14.2",
41
41
  "winston-mongodb": "5.1.1",
42
42
  "xlsx": "0.18.5",
43
43
  "xml2js": "0.4.23"