q-koa 8.9.1 → 8.9.5
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.
|
@@ -26,6 +26,31 @@ exports.initData = async ({ includes, excludes, app, ctx }) => {
|
|
|
26
26
|
excludeInclude,
|
|
27
27
|
autoInclude = true,
|
|
28
28
|
} = route
|
|
29
|
+
|
|
30
|
+
if (url.includes('http')) {
|
|
31
|
+
return axios
|
|
32
|
+
.post(url, {
|
|
33
|
+
...data,
|
|
34
|
+
limit,
|
|
35
|
+
order,
|
|
36
|
+
})
|
|
37
|
+
.then((res) => {
|
|
38
|
+
if (res.data.code !== 200) {
|
|
39
|
+
console.log(`${item}请求失败,${res.data.message}`)
|
|
40
|
+
} else {
|
|
41
|
+
return {
|
|
42
|
+
[item]: res.data.data,
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
.catch((e) => {
|
|
47
|
+
console.log(`${item}请求失败,${e.message}`)
|
|
48
|
+
return {
|
|
49
|
+
[item]: [],
|
|
50
|
+
}
|
|
51
|
+
})
|
|
52
|
+
}
|
|
53
|
+
|
|
29
54
|
const [model, fn] = url.split('/')
|
|
30
55
|
|
|
31
56
|
let myInclude
|
|
@@ -67,7 +67,11 @@ module.exports = class Singleton {
|
|
|
67
67
|
try {
|
|
68
68
|
const RpcClient = new yly.RpcClient(accessToken, this.oauthConfig)
|
|
69
69
|
const Print = new yly.Print(RpcClient)
|
|
70
|
-
|
|
70
|
+
const res = await Print.index(this.config.machine_code, order_id, content)
|
|
71
|
+
|
|
72
|
+
if (res.code !== '0') {
|
|
73
|
+
throw new Error(res.error_description)
|
|
74
|
+
}
|
|
71
75
|
} catch (e) {
|
|
72
76
|
throw new Error(`请重试,${e.message}`)
|
|
73
77
|
await app.model.setting.update(
|
|
@@ -100,7 +100,14 @@ module.exports = class Singleton {
|
|
|
100
100
|
return cache.get(appid)
|
|
101
101
|
}
|
|
102
102
|
const url = util.format(getAccessTokenUrl, grant_type, appid, secrect)
|
|
103
|
-
|
|
103
|
+
|
|
104
|
+
const result = await axios.get(url).then((res) => res.data)
|
|
105
|
+
const { errcode, errmsg, access_token } = result
|
|
106
|
+
|
|
107
|
+
if (errcode) {
|
|
108
|
+
throw new Error(errmsg)
|
|
109
|
+
}
|
|
110
|
+
|
|
104
111
|
cache.set(appid, access_token)
|
|
105
112
|
return access_token
|
|
106
113
|
}
|