q-koa 13.8.12 → 13.8.13

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/core/app.js CHANGED
@@ -531,9 +531,7 @@ class APP {
531
531
  }
532
532
 
533
533
  // const proxyConfig = _.get(this.app[appName], 'appConfig.proxy');
534
- // const taskConfig = _.get(this.app[appName], 'appConfig.task', {
535
- // is_available: false,
536
- // })
534
+
537
535
  // if (proxyConfig) {
538
536
  // this.app.use(proxy(`/${appName}`, proxyConfig));
539
537
  // }
package/core/config.js CHANGED
@@ -12,9 +12,6 @@ module.exports = {
12
12
  request: true,
13
13
  },
14
14
  blackList: [],
15
- task: {
16
- dir: 'task',
17
- },
18
15
  xmlBody: {
19
16
  limit: 1024 * 100,
20
17
  },
@@ -666,17 +666,6 @@ exports.chat = async (ctx) => {
666
666
  }
667
667
  }
668
668
 
669
- exports.task = async (ctx) => {
670
- const { app } = getAppByCtx(ctx)
671
-
672
- const { task } = ctx.request.body
673
-
674
- if (app.task && app.task[task]) {
675
- await app.task[task](app)
676
- }
677
- ctx.SUCCESS(task)
678
- }
679
-
680
669
  exports.dashboard = async (ctx) => {
681
670
  // const {
682
671
  // app,
@@ -1429,7 +1429,7 @@ exports.union_notify = async (ctx) => {
1429
1429
  } = notifyData
1430
1430
 
1431
1431
  if (trxstatus === '0000') {
1432
- if (trxcode === 'VSP501') {
1432
+ if (['VSP501', 'VSP681'].includes(trxcode)) {
1433
1433
  let prefix = ''
1434
1434
  const out_trade_no = cusorderid
1435
1435
  let order_id = out_trade_no.split('_')[1]
@@ -1459,7 +1459,7 @@ exports.union_notify = async (ctx) => {
1459
1459
  refund_type: 'union_refund',
1460
1460
  })
1461
1461
  }
1462
- } else if (trxcode === 'VSP503') {
1462
+ } else if (['VSP503', 'VSP682', 'VSP684'].includes(trxcode)) {
1463
1463
  const payRecordTarget = await app.model.pay_record.findOne({
1464
1464
  where: {
1465
1465
  transactionid: srctrxid,
@@ -359,7 +359,9 @@ const filterFunction = (target, data) => {
359
359
  return data[key] > target[key].$gt
360
360
  } else if ('$gte' in target[key]) {
361
361
  if (key.endsWith('time') || key.endsWith('_at')) {
362
- return moment(data[key]).diff(moment(target[key].$gte), 'seconds') >= 0
362
+ return (
363
+ moment(data[key]).diff(moment(target[key].$gte), 'seconds') >= 0
364
+ )
363
365
  }
364
366
  return data[key] >= target[key].$gte
365
367
  } else if ('$lt' in target[key]) {
@@ -369,7 +371,9 @@ const filterFunction = (target, data) => {
369
371
  return data[key] < target[key].$lt
370
372
  } else if ('$lte' in target[key]) {
371
373
  if (key.endsWith('time') || key.endsWith('_at')) {
372
- return moment(target[key].$lte).diff(moment(data[key]), 'seconds') <= 0
374
+ return (
375
+ moment(target[key].$lte).diff(moment(data[key]), 'seconds') <= 0
376
+ )
373
377
  }
374
378
  return data[key] <= target[key].$lte
375
379
  } else if ('$notIn' in target[key]) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "q-koa",
3
- "version": "13.8.12",
3
+ "version": "13.8.13",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,589 +0,0 @@
1
- const fsExtra = require('fs-extra');
2
- const path = require('path');
3
- const _ = require('lodash');
4
-
5
- const filterNoNeed = item => _.omit(item, ['created_at', 'updated_at']);
6
- exports.payType = async (app) => {
7
- const list = [
8
- {
9
- name: '微信',
10
- key: 'weixin',
11
- image: '/upload/562e45760a44632de6fa7219bab78cce.png',
12
- id: 1,
13
- },
14
- {
15
- name: '支付宝',
16
- key: 'alipay',
17
- image: '/upload/d7aeaeb6bfd68f71a00a83c0f5548363.png',
18
- id: 2,
19
- },
20
- {
21
- name: '余额支付',
22
- key: 'balance',
23
- image: '',
24
- id: 3,
25
- }];
26
- for (let i = 0; i < list.length; i++) {
27
- await app.model.pay_type.upsert(list[i]);
28
- }
29
-
30
- return true;
31
- };
32
-
33
- exports.setting = async (app) => {
34
- const list = [
35
- {
36
- name: '基础设置',
37
- code: 'base',
38
- type: 'input',
39
- value: '',
40
- parent_id: 0,
41
- id: 1,
42
- created_at: '2019-10-04T14:18:48.000Z',
43
- updated_at: '2019-10-04T14:18:48.000Z',
44
- },
45
- {
46
- name: '网站名',
47
- code: 'site_name',
48
- type: 'input',
49
- value: '京东商城',
50
- parent_id: 1,
51
- id: 2,
52
- created_at: '2019-10-04T14:19:09.000Z',
53
- updated_at: '2019-10-04T14:19:09.000Z',
54
- },
55
- {
56
- name: '语言包',
57
- code: 'lang',
58
- type: 'input',
59
- value: '',
60
- parent_id: 0,
61
- id: 3,
62
- created_at: '2019-10-04T14:42:01.000Z',
63
- updated_at: '2019-10-04T14:42:01.000Z',
64
- },
65
- {
66
- name: '版权说明',
67
- code: 'copyright',
68
- type: 'input',
69
- value: '@copyright by 苏晓光',
70
- parent_id: 3,
71
- id: 4,
72
- created_at: '2019-10-04T14:42:48.000Z',
73
- updated_at: '2019-10-04T14:42:48.000Z',
74
- },
75
- {
76
- name: '域名',
77
- code: 'site_host',
78
- type: 'input',
79
- value: 'www.jd.com',
80
- parent_id: 1,
81
- id: 5,
82
- created_at: '2019-10-04T14:49:39.000Z',
83
- updated_at: '2019-10-04T14:49:39.000Z',
84
- },
85
- {
86
- name: 'Logo图片',
87
- code: 'logo_img',
88
- type: 'image',
89
- value: 'https://misc.360buyimg.com/jdf/1.0.0/unit/global-header/5.0.0/i/jdlogo-201708-@1x.png',
90
- parent_id: 1,
91
- id: 6,
92
- created_at: '2019-10-04T14:54:47.000Z',
93
- updated_at: '2019-10-04T14:54:47.000Z',
94
- },
95
- {
96
- name: '短信配置',
97
- code: 'sms',
98
- type: 'input',
99
- value: '',
100
- parent_id: 0,
101
- id: 13,
102
- created_at: '2019-10-05T09:47:40.000Z',
103
- updated_at: '2019-10-05T09:47:40.000Z',
104
- },
105
- {
106
- name: '账号唯一标识',
107
- code: 'sid',
108
- type: 'input',
109
- value: 'e23cfbe4425fda035ac8afa77330deff',
110
- parent_id: 13,
111
- id: 14,
112
- created_at: '2019-10-05T09:48:02.000Z',
113
- updated_at: '2019-10-05T09:48:02.000Z',
114
- },
115
- {
116
- name: '应用ID',
117
- code: 'appid',
118
- type: 'input',
119
- value: 'f9b475e4f90e4e4ea2226206ebf9c449',
120
- parent_id: 13,
121
- id: 15,
122
- created_at: '2019-10-05T09:48:26.000Z',
123
- updated_at: '2019-10-05T09:48:26.000Z',
124
- },
125
- {
126
- name: '用户密钥',
127
- code: 'token',
128
- type: 'input',
129
- value: 'f3aebd9d70b05122c542cebde7315123',
130
- parent_id: 13,
131
- id: 16,
132
- created_at: '2019-10-05T09:48:46.000Z',
133
- updated_at: '2019-10-05T09:48:46.000Z',
134
- },
135
- {
136
- name: '模板ID',
137
- code: 'templateid',
138
- type: 'input',
139
- value: '500487',
140
- parent_id: 13,
141
- id: 17,
142
- created_at: '2019-10-05T09:49:05.000Z',
143
- updated_at: '2019-10-05T09:49:05.000Z',
144
- },
145
- {
146
- name: '小程序设置',
147
- code: 'weixin_mp',
148
- type: 'input',
149
- value: '',
150
- parent_id: 0,
151
- id: 18,
152
- created_at: '2019-11-08T12:28:22.000Z',
153
- updated_at: '2019-11-08T12:28:22.000Z',
154
- },
155
- {
156
- name: 'APP_ID',
157
- code: 'app_id',
158
- type: 'input',
159
- value: 'wxaa3a21a0ee590ff9',
160
- parent_id: 18,
161
- id: 19,
162
- created_at: '2019-11-08T12:29:07.000Z',
163
- updated_at: '2019-11-08T12:29:07.000Z',
164
- },
165
- {
166
- name: 'APP_SECRECT',
167
- code: 'app_secrect',
168
- type: 'input',
169
- value: '098e45c89c000ccd40437604499024a7',
170
- parent_id: 18,
171
- id: 20,
172
- created_at: '2019-11-08T12:29:26.000Z',
173
- updated_at: '2019-11-08T12:29:26.000Z',
174
- },
175
- {
176
- name: '微信公众号设置',
177
- code: 'weixin_h5',
178
- type: 'input',
179
- value: '',
180
- parent_id: 0,
181
- id: 21,
182
- created_at: '2019-11-09T10:36:00.000Z',
183
- updated_at: '2019-11-09T10:36:00.000Z',
184
- },
185
- {
186
- name: 'APP_ID',
187
- code: 'app_id',
188
- type: 'input',
189
- value: 'wxc87b24223b65d6fc',
190
- parent_id: 21,
191
- id: 22,
192
- created_at: '2019-11-09T10:37:19.000Z',
193
- updated_at: '2019-11-09T10:37:19.000Z',
194
- },
195
- {
196
- name: 'APP_SECRECT',
197
- code: 'app_secrect',
198
- type: 'input',
199
- value: '6934d56c7e772b5b99141f710495bb1e',
200
- parent_id: 21,
201
- id: 23,
202
- created_at: '2019-11-09T10:37:57.000Z',
203
- updated_at: '2019-11-09T10:37:57.000Z',
204
- },
205
- {
206
- name: '域名(授权用)',
207
- code: 'host_link',
208
- type: 'input',
209
- value: 'http://compserviceplat.shenzhenbenwo.com',
210
- parent_id: 21,
211
- id: 24,
212
- created_at: '2019-11-09T13:31:01.000Z',
213
- updated_at: '2019-11-09T13:31:01.000Z',
214
- },
215
- {
216
- name: '微信支付',
217
- code: 'weixin_pay',
218
- type: 'input',
219
- value: '',
220
- parent_id: 0,
221
- id: 25,
222
- created_at: '2019-11-11T16:15:36.000Z',
223
- updated_at: '2019-11-11T16:15:36.000Z',
224
- },
225
- {
226
- name: '商户号',
227
- code: 'mch_id',
228
- type: 'input',
229
- value: '1559499381',
230
- parent_id: 25,
231
- id: 26,
232
- created_at: '2019-11-11T16:16:02.000Z',
233
- updated_at: '2019-11-11T16:16:02.000Z',
234
- },
235
- {
236
- name: '密钥',
237
- code: 'key',
238
- type: 'input',
239
- value: 'lljjlljjlljjlljjlljjlljjlljjlljj',
240
- parent_id: 25,
241
- id: 27,
242
- created_at: '2019-11-11T16:16:21.000Z',
243
- updated_at: '2019-11-11T16:16:21.000Z',
244
- },
245
- {
246
- name: 'API证书',
247
- code: 'key',
248
- type: 'image',
249
- value: '',
250
- parent_id: 25,
251
- id: 28,
252
- created_at: '2019-11-11T16:23:48.000Z',
253
- updated_at: '2019-11-11T16:23:48.000Z',
254
- },
255
- {
256
- name: 'Logo图片',
257
- code: 'logo_img',
258
- type: 'file',
259
- value: '/upload/ab45df2d626306c933079dd7611f5c8e.psd',
260
- parent_id: 1,
261
- id: 29,
262
- created_at: '2019-11-12T02:24:27.000Z',
263
- updated_at: '2019-11-12T02:24:27.000Z',
264
- },
265
- {
266
- name: '快递查询',
267
- code: 'express',
268
- type: 'input',
269
- value: '',
270
- parent_id: 0,
271
- id: 30,
272
- created_at: '2019-12-13T01:05:30.000Z',
273
- updated_at: '2019-12-13T01:05:30.000Z',
274
- },
275
- {
276
- name: '分销比例',
277
- code: 'spread_rate',
278
- type: 'decimal',
279
- value: '0.15',
280
- parent_id: 32,
281
- id: 31,
282
- created_at: null,
283
- updated_at: null,
284
- },
285
- {
286
- name: '分销设置',
287
- code: 'spread',
288
- type: 'input',
289
- value: '',
290
- parent_id: 0,
291
- id: 32,
292
- created_at: null,
293
- updated_at: null,
294
- },
295
- {
296
- name: '分销开启',
297
- code: 'spread_avaiable',
298
- type: 'switch',
299
- value: '1',
300
- parent_id: 32,
301
- id: 33,
302
- created_at: null,
303
- updated_at: null,
304
- },
305
- {
306
- name: 'APP CODE',
307
- code: 'app_code',
308
- type: 'input',
309
- value: '59f7e9da22e84913a5414cb959cef1e4',
310
- parent_id: 30,
311
- id: 34,
312
- created_at: null,
313
- updated_at: null,
314
- },
315
- {
316
- name: '积分设置',
317
- code: 'integral',
318
- type: 'input',
319
- value: '',
320
- parent_id: 0,
321
- id: 35,
322
- created_at: null,
323
- updated_at: null,
324
- },
325
- {
326
- name: '赠送积分开启',
327
- code: 'integral_avaiable',
328
- type: 'switch',
329
- value: '1',
330
- parent_id: 35,
331
- id: 36,
332
- created_at: null,
333
- updated_at: null,
334
- },
335
- {
336
- name: '赠送积分比例',
337
- code: 'integral_rate',
338
- type: 'decimal',
339
- value: '1',
340
- parent_id: 35,
341
- id: 37,
342
- created_at: null,
343
- updated_at: null,
344
- },
345
- {
346
- name: '默认头像',
347
- code: 'default_avatar',
348
- type: 'image',
349
- value: '',
350
- parent_id: 1,
351
- id: 38,
352
- created_at: null,
353
- updated_at: null,
354
- },
355
- {
356
- name: '签到设置',
357
- code: 'sign',
358
- type: 'input',
359
- value: '',
360
- parent_id: 0,
361
- id: 39,
362
- created_at: '2020-01-02T03:47:34.000Z',
363
- updated_at: '2020-01-02T03:47:34.000Z',
364
- },
365
- {
366
- name: '签到积分',
367
- code: 'sign_integral',
368
- type: 'decimal',
369
- value: '10',
370
- parent_id: 39,
371
- id: 40,
372
- created_at: '2020-01-02T03:48:14.000Z',
373
- updated_at: '2020-01-02T03:48:14.000Z',
374
- },
375
- {
376
- name: '签到赠送积分开启',
377
- code: 'sign_avaiable',
378
- type: 'switch',
379
- value: '1',
380
- parent_id: 39,
381
- id: 41,
382
- created_at: '2020-01-02T08:28:20.000Z',
383
- updated_at: '2020-01-02T08:28:20.000Z',
384
- },
385
- ];
386
- const result = list.map(item => ({
387
- ...item,
388
- value: `${item.value}`,
389
- })).map(filterNoNeed);
390
- for (let i = 0; i < result.length; i++) {
391
- await app.model.setting.upsert(result[i]);
392
- }
393
-
394
- return true;
395
- };
396
-
397
-
398
- exports.language = async (app) => {
399
- const lang = [
400
- {
401
- name: '中文',
402
- key: 'cn',
403
- id: 1,
404
- created_at: '2019-11-01T14:39:40.000Z',
405
- updated_at: '2019-11-01T14:39:40.000Z',
406
- },
407
- {
408
- name: '英语',
409
- key: 'en',
410
- id: 2,
411
- created_at: '2019-11-02T02:41:29.000Z',
412
- updated_at: '2019-11-02T02:41:29.000Z',
413
- },
414
- ].map(filterNoNeed);
415
- const language = [
416
- {
417
- name: '你好',
418
- lang_id: 1,
419
- key: 'hello',
420
- value: '你好',
421
- id: 1,
422
- created_at: '2019-11-01T14:41:24.000Z',
423
- updated_at: '2019-11-01T14:41:24.000Z',
424
- },
425
- {
426
- name: '你好',
427
- lang_id: 2,
428
- key: 'hello',
429
- value: 'hello',
430
- id: 2,
431
- created_at: '2019-11-02T02:41:42.000Z',
432
- updated_at: '2019-11-02T02:41:42.000Z',
433
- },
434
- {
435
- name: '登录',
436
- lang_id: 1,
437
- key: 'login',
438
- value: '登录',
439
- id: 3,
440
- created_at: '2019-11-03T09:05:44.000Z',
441
- updated_at: '2019-11-03T09:05:44.000Z',
442
- },
443
- {
444
- name: '登录',
445
- lang_id: 2,
446
- key: 'login',
447
- value: 'login',
448
- id: 4,
449
- created_at: '2019-11-03T09:05:55.000Z',
450
- updated_at: '2019-11-03T09:05:55.000Z',
451
- },
452
- {
453
- name: '登出',
454
- lang_id: 1,
455
- key: 'logout',
456
- value: '登出',
457
- id: 5,
458
- created_at: '2019-11-03T09:06:16.000Z',
459
- updated_at: '2019-11-03T09:06:16.000Z',
460
- },
461
- {
462
- name: '登出',
463
- lang_id: 2,
464
- key: 'logout',
465
- value: 'logout',
466
- id: 6,
467
- created_at: '2019-11-03T09:06:31.000Z',
468
- updated_at: '2019-11-03T09:06:31.000Z',
469
- },
470
- {
471
- name: '注册',
472
- lang_id: 1,
473
- key: 'register',
474
- value: '注册',
475
- id: 7,
476
- created_at: '2019-11-03T09:07:56.000Z',
477
- updated_at: '2019-11-03T09:07:56.000Z',
478
- },
479
- {
480
- name: '注册',
481
- lang_id: 2,
482
- key: 'register',
483
- value: 'register',
484
- id: 8,
485
- created_at: '2019-11-03T09:08:06.000Z',
486
- updated_at: '2019-11-03T09:08:06.000Z',
487
- },
488
- {
489
- name: '我的订单',
490
- lang_id: 1,
491
- key: 'my_order',
492
- value: '我的订单',
493
- id: 9,
494
- created_at: '2019-11-03T09:44:56.000Z',
495
- updated_at: '2019-11-03T09:44:56.000Z',
496
- },
497
- {
498
- name: '我的订单',
499
- lang_id: 2,
500
- key: 'my_order',
501
- value: 'my order',
502
- id: 10,
503
- created_at: '2019-11-03T09:45:13.000Z',
504
- updated_at: '2019-11-03T09:45:13.000Z',
505
- },
506
- {
507
- name: '个人中心',
508
- lang_id: 1,
509
- key: 'person_center',
510
- value: '个人中心',
511
- id: 11,
512
- created_at: '2019-11-03T09:46:13.000Z',
513
- updated_at: '2019-11-03T09:46:13.000Z',
514
- },
515
- {
516
- name: '个人中心',
517
- lang_id: 2,
518
- key: 'person_center',
519
- value: 'person center',
520
- id: 12,
521
- created_at: '2019-11-03T09:46:37.000Z',
522
- updated_at: '2019-11-03T09:46:37.000Z',
523
- },
524
- {
525
- name: '购物车',
526
- lang_id: 1,
527
- key: 'person_cart',
528
- value: '购物车',
529
- id: 13,
530
- created_at: '2019-11-03T10:04:48.000Z',
531
- updated_at: '2019-11-03T10:04:48.000Z',
532
- },
533
- {
534
- name: '购物车',
535
- lang_id: 2,
536
- key: 'person_cart',
537
- value: 'cart',
538
- id: 14,
539
- created_at: '2019-11-03T10:05:10.000Z',
540
- updated_at: '2019-11-03T10:05:10.000Z',
541
- },
542
- ].map(filterNoNeed);
543
- for (let i = 0; i < lang.length; i++) {
544
- await app.model.lang.upsert(lang[i]);
545
- }
546
- for (let i = 0; i < language.length; i++) {
547
- await app.model.language.upsert(language[i]);
548
- }
549
- return true;
550
- };
551
-
552
-
553
- exports.orderStatus = async (app) => {
554
- const order_status = [
555
- {
556
- name: '待付款',
557
- intro: '提交订单',
558
- id: 1,
559
- created_at: '2019-11-16T03:49:38.000Z',
560
- updated_at: '2019-11-16T03:49:38.000Z',
561
- },
562
- {
563
- name: '待发货',
564
- intro: '付款成功',
565
- id: 2,
566
- created_at: '2019-11-16T03:49:38.000Z',
567
- updated_at: '2019-11-16T03:49:38.000Z',
568
- },
569
- {
570
- name: '待收货',
571
- intro: '商品出库',
572
- id: 3,
573
- created_at: '2019-11-16T03:49:38.000Z',
574
- updated_at: '2019-11-16T03:49:38.000Z',
575
- },
576
- {
577
- name: '已完成',
578
- intro: '完成',
579
- id: 4,
580
- created_at: '2019-11-16T03:49:38.000Z',
581
- updated_at: '2019-11-16T03:49:38.000Z',
582
- },
583
- ].map(filterNoNeed);
584
-
585
-
586
- for (let i = 0; i < order_status.length; i++) {
587
- await app.model.order_status.upsert(order_status[i]);
588
- }
589
- };