q-koa 12.2.3 → 12.2.4
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.
|
@@ -71,6 +71,9 @@ exports.loadModel = async ({ app, appName }) => {
|
|
|
71
71
|
app,
|
|
72
72
|
model: result[i],
|
|
73
73
|
})
|
|
74
|
+
if (countNumber >= 100000) {
|
|
75
|
+
console.warn('数据量大,请注意', result[i], countNumber)
|
|
76
|
+
}
|
|
74
77
|
if (tableIndexList.length <= 1) {
|
|
75
78
|
console.warn(`${result[i]} count ${countNumber}没有索引`)
|
|
76
79
|
}
|
|
@@ -89,6 +89,62 @@ module.exports = class Singleton {
|
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
+
async addPrinter(machineCode, msign, nickName = '', phone = '') {
|
|
93
|
+
const app = this.config.app
|
|
94
|
+
const accessToken = await this.getAccessToken()
|
|
95
|
+
try {
|
|
96
|
+
const RpcClient = new yly.RpcClient(accessToken, this.oauthConfig)
|
|
97
|
+
const Print = new yly.Printer(RpcClient)
|
|
98
|
+
const res = await Print.addPrinter(machineCode, msign, nickName, phone)
|
|
99
|
+
|
|
100
|
+
if (res && res.error_description !== 'success') {
|
|
101
|
+
throw new Error(res.error_description)
|
|
102
|
+
}
|
|
103
|
+
} catch (e) {
|
|
104
|
+
await app.model.setting.update(
|
|
105
|
+
{
|
|
106
|
+
value: '',
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
where: {
|
|
110
|
+
code: 'print_token',
|
|
111
|
+
name: 'AccessToken',
|
|
112
|
+
},
|
|
113
|
+
}
|
|
114
|
+
)
|
|
115
|
+
throw new Error(`请重试,${e.message}`)
|
|
116
|
+
// return await this.print({ order_id, content })
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
async deletePrinter(machineCode) {
|
|
121
|
+
const app = this.config.app
|
|
122
|
+
const accessToken = await this.getAccessToken()
|
|
123
|
+
try {
|
|
124
|
+
const RpcClient = new yly.RpcClient(accessToken, this.oauthConfig)
|
|
125
|
+
const Print = new yly.Printer(RpcClient)
|
|
126
|
+
const res = await Print.deletePrinter(machineCode)
|
|
127
|
+
|
|
128
|
+
if (res && res.error_description !== 'success') {
|
|
129
|
+
throw new Error(res.error_description)
|
|
130
|
+
}
|
|
131
|
+
} catch (e) {
|
|
132
|
+
await app.model.setting.update(
|
|
133
|
+
{
|
|
134
|
+
value: '',
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
where: {
|
|
138
|
+
code: 'print_token',
|
|
139
|
+
name: 'AccessToken',
|
|
140
|
+
},
|
|
141
|
+
}
|
|
142
|
+
)
|
|
143
|
+
throw new Error(`请重试,${e.message}`)
|
|
144
|
+
// return await this.print({ order_id, content })
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
92
148
|
async cancelAll() {
|
|
93
149
|
const app = this.config.app
|
|
94
150
|
const accessToken = await this.getAccessToken()
|