q-koa 10.1.1 → 10.1.3
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,5 +1,5 @@
|
|
|
1
1
|
const md5 = require('js-md5')
|
|
2
|
-
const { getAppByCtx, getConfig, lodash } = require('q-koa')
|
|
2
|
+
const { getAppByCtx, getConfig, lodash, moment } = require('q-koa')
|
|
3
3
|
const { getAppConfig } = require('../../utils')
|
|
4
4
|
|
|
5
5
|
exports.login = async (ctx) => {
|
|
@@ -395,6 +395,16 @@ exports.checkLogin = async (ctx) => {
|
|
|
395
395
|
const token = await app.sign({
|
|
396
396
|
user: tokenResult,
|
|
397
397
|
})
|
|
398
|
+
|
|
399
|
+
if (
|
|
400
|
+
result.updated_at &&
|
|
401
|
+
moment().diff(moment(result.updated_at), 'hours') > 24
|
|
402
|
+
) {
|
|
403
|
+
app.model.user.upsert({
|
|
404
|
+
id: result.id,
|
|
405
|
+
updated_at: moment(),
|
|
406
|
+
})
|
|
407
|
+
}
|
|
398
408
|
return ctx.SUCCESS({
|
|
399
409
|
token,
|
|
400
410
|
user: app.appConfig.loginData
|
|
@@ -894,8 +894,8 @@ exports.mp_pay = async (ctx) => {
|
|
|
894
894
|
const out_trade_no = _out_trade_no
|
|
895
895
|
? _out_trade_no
|
|
896
896
|
: prefix
|
|
897
|
-
? `${key}_${prefix}-${order_id}_${type}`
|
|
898
|
-
: `${key}_${order_id}_${type}`
|
|
897
|
+
? `${key.length > 10 ? appName : key}_${prefix}-${order_id}_${type}`
|
|
898
|
+
: `${key.length > 10 ? appName : key}_${order_id}_${type}`
|
|
899
899
|
|
|
900
900
|
const notify_url = `https://${
|
|
901
901
|
site_host || 'api.kuashou.com'
|
|
@@ -928,6 +928,11 @@ exports.mp_pay = async (ctx) => {
|
|
|
928
928
|
timeStamp,
|
|
929
929
|
} = prePayResult
|
|
930
930
|
|
|
931
|
+
if (!nonce_str) {
|
|
932
|
+
console.error(`可能微信商户被暂停使用`)
|
|
933
|
+
throw new Error(`签名错误,请通知平台检查后再试`)
|
|
934
|
+
}
|
|
935
|
+
|
|
931
936
|
if (prepay_id.includes('undefined')) {
|
|
932
937
|
const model = type === 'H5-WEIXIN' ? 'h5_user' : 'mp_user'
|
|
933
938
|
const userTarget = await app.model[model].findOne({
|