q-koa 13.7.1 → 13.7.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/core/file/plugins/common/controller.js +2 -2
- package/core/file/plugins/douyin/controller.js +1 -1
- package/core/file/plugins/system/controller.js +1 -1
- package/core/file/plugins/user/controller.js +2 -2
- package/core/file/plugins/weixin/controller.js +10 -10
- package/core/file/plugins/weixin/service.js +1 -1
- package/core/file/utils/index.js +4 -4
- package/package.json +1 -1
|
@@ -467,9 +467,9 @@ const expressFn = async ({ app, express_number: _express_number, mobile }) => {
|
|
|
467
467
|
},
|
|
468
468
|
})
|
|
469
469
|
if (history) {
|
|
470
|
-
const diffNoLong = moment().diff(moment(history.updated_at), '
|
|
470
|
+
const diffNoLong = moment().diff(moment(history.updated_at), 'hours') < 1
|
|
471
471
|
const isTooLong =
|
|
472
|
-
moment().diff(moment(history.result.updateTime), '
|
|
472
|
+
moment().diff(moment(history.result.updateTime), 'days') > 30
|
|
473
473
|
|
|
474
474
|
if (diffNoLong || isTooLong) {
|
|
475
475
|
return history.result
|
|
@@ -366,7 +366,7 @@ exports.hotSearch = async (ctx) => {
|
|
|
366
366
|
|
|
367
367
|
const hotWord = await app.model.hot_search.findOne()
|
|
368
368
|
const minutes = hotWord
|
|
369
|
-
? moment().diff(moment(hotWord.created_at), '
|
|
369
|
+
? moment().diff(moment(hotWord.created_at), 'minutes')
|
|
370
370
|
: 1000
|
|
371
371
|
|
|
372
372
|
if (minutes < 30) {
|
|
@@ -229,7 +229,7 @@ exports.login = async (ctx) => {
|
|
|
229
229
|
|
|
230
230
|
if (
|
|
231
231
|
result.updated_at &&
|
|
232
|
-
moment().diff(moment(result.updated_at), '
|
|
232
|
+
moment().diff(moment(result.updated_at), 'hours') > 24
|
|
233
233
|
) {
|
|
234
234
|
app.model.user.upsert({
|
|
235
235
|
id: result.id,
|
|
@@ -481,7 +481,7 @@ exports.checkLogin = async (ctx) => {
|
|
|
481
481
|
|
|
482
482
|
if (
|
|
483
483
|
result.updated_at &&
|
|
484
|
-
moment().diff(moment(result.updated_at), '
|
|
484
|
+
moment().diff(moment(result.updated_at), 'hours') > 24
|
|
485
485
|
) {
|
|
486
486
|
app.model.user.upsert({
|
|
487
487
|
id: result.id,
|
|
@@ -551,7 +551,7 @@ exports.mp_login = async (ctx) => {
|
|
|
551
551
|
|
|
552
552
|
if (
|
|
553
553
|
result.updated_at &&
|
|
554
|
-
moment().diff(moment(result.updated_at), '
|
|
554
|
+
moment().diff(moment(result.updated_at), 'hours') > 24
|
|
555
555
|
) {
|
|
556
556
|
app.model.user.upsert({
|
|
557
557
|
id: result.id,
|
|
@@ -2392,22 +2392,22 @@ exports.getUserPortrait = async (ctx) => {
|
|
|
2392
2392
|
const diff = moment().hour() > 8 ? -1 : -2
|
|
2393
2393
|
if (type === 'day') {
|
|
2394
2394
|
obj = {
|
|
2395
|
-
begin_date: moment().add(diff, '
|
|
2396
|
-
end_date: moment().add(diff, '
|
|
2395
|
+
begin_date: moment().add(diff, 'days').format('YYYYMMDD'),
|
|
2396
|
+
end_date: moment().add(diff, 'days').format('YYYYMMDD'),
|
|
2397
2397
|
}
|
|
2398
2398
|
} else if (type === 'week') {
|
|
2399
2399
|
obj = {
|
|
2400
2400
|
begin_date: moment()
|
|
2401
|
-
.add(-6 + diff, '
|
|
2401
|
+
.add(-6 + diff, 'days')
|
|
2402
2402
|
.format('YYYYMMDD'),
|
|
2403
|
-
end_date: moment().add(diff, '
|
|
2403
|
+
end_date: moment().add(diff, 'days').format('YYYYMMDD'),
|
|
2404
2404
|
}
|
|
2405
2405
|
} else if (type === 'month') {
|
|
2406
2406
|
obj = {
|
|
2407
2407
|
begin_date: moment()
|
|
2408
|
-
.add(-29 + diff, '
|
|
2408
|
+
.add(-29 + diff, 'days')
|
|
2409
2409
|
.format('YYYYMMDD'),
|
|
2410
|
-
end_date: moment().add(diff, '
|
|
2410
|
+
end_date: moment().add(diff, 'days').format('YYYYMMDD'),
|
|
2411
2411
|
}
|
|
2412
2412
|
}
|
|
2413
2413
|
console.log('obj', obj)
|
|
@@ -2425,7 +2425,7 @@ exports.getVisitTrend = async (ctx, _data) => {
|
|
|
2425
2425
|
|
|
2426
2426
|
const diff = moment().hour() > 8 ? -1 : -2
|
|
2427
2427
|
|
|
2428
|
-
const begin_date = moment(date ? date : moment().add(diff, '
|
|
2428
|
+
const begin_date = moment(date ? date : moment().add(diff, 'days')).format(
|
|
2429
2429
|
'YYYYMMDD'
|
|
2430
2430
|
)
|
|
2431
2431
|
|
|
@@ -2448,7 +2448,7 @@ exports.getVisitTrend = async (ctx, _data) => {
|
|
|
2448
2448
|
if (type === 'day') {
|
|
2449
2449
|
obj = {
|
|
2450
2450
|
begin_date,
|
|
2451
|
-
end_date: moment(date ? date : moment().add(diff, '
|
|
2451
|
+
end_date: moment(date ? date : moment().add(diff, 'days')).format(
|
|
2452
2452
|
'YYYYMMDD'
|
|
2453
2453
|
),
|
|
2454
2454
|
}
|
|
@@ -2467,7 +2467,7 @@ exports.getVisitTrend = async (ctx, _data) => {
|
|
|
2467
2467
|
} else {
|
|
2468
2468
|
return app.controller.weixin.getVisitTrend(ctx, {
|
|
2469
2469
|
type,
|
|
2470
|
-
date: moment(date).add(-1, '
|
|
2470
|
+
date: moment(date).add(-1, 'days').format('YYYYMMDD'),
|
|
2471
2471
|
})
|
|
2472
2472
|
}
|
|
2473
2473
|
|
|
@@ -1150,7 +1150,7 @@ exports.union_downloadBill = async ({
|
|
|
1150
1150
|
})
|
|
1151
1151
|
|
|
1152
1152
|
const result = await allinpay.downloadBill({
|
|
1153
|
-
date: date || moment().add(-1, '
|
|
1153
|
+
date: date || moment().add(-1, 'days').format('YYYYMMDD'),
|
|
1154
1154
|
})
|
|
1155
1155
|
|
|
1156
1156
|
if (result && result.url) {
|
package/core/file/utils/index.js
CHANGED
|
@@ -354,22 +354,22 @@ const filterFunction = (target, data) => {
|
|
|
354
354
|
if (_.isObject(target[key])) {
|
|
355
355
|
if ('$gt' in target[key]) {
|
|
356
356
|
if (key.endsWith('time') || key.endsWith('_at')) {
|
|
357
|
-
return moment(data[key]).diff(moment(target[key].$gt), '
|
|
357
|
+
return moment(data[key]).diff(moment(target[key].$gt), 'seconds') > 0
|
|
358
358
|
}
|
|
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].$gt), '
|
|
362
|
+
return moment(data[key]).diff(moment(target[key].$gt), 'seconds') >= 0
|
|
363
363
|
}
|
|
364
364
|
return data[key] >= target[key].$gte
|
|
365
365
|
} else if ('$lt' in target[key]) {
|
|
366
366
|
if (key.endsWith('time') || key.endsWith('_at')) {
|
|
367
|
-
return moment(target[key].$lt).diff(moment(data[key]), '
|
|
367
|
+
return moment(target[key].$lt).diff(moment(data[key]), 'seconds') < 0
|
|
368
368
|
}
|
|
369
369
|
return data[key] < target[key].$lt
|
|
370
370
|
} else if ('$lte' in target[key]) {
|
|
371
371
|
if (key.endsWith('time') || key.endsWith('_at')) {
|
|
372
|
-
return moment(target[key].$lte).diff(moment(data[key]), '
|
|
372
|
+
return moment(target[key].$lte).diff(moment(data[key]), 'seconds') <= 0
|
|
373
373
|
}
|
|
374
374
|
return data[key] <= target[key].$lte
|
|
375
375
|
} else if ('$notIn' in target[key]) {
|