q-koa 12.3.4 → 12.3.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.
@@ -145,6 +145,39 @@ module.exports = class Singleton {
145
145
  }
146
146
  }
147
147
 
148
+ async getPrintList(machineCode, pageIndex = 1, pageSize = 10) {
149
+ const app = this.config.app
150
+ const accessToken = await this.getAccessToken()
151
+ try {
152
+ const RpcClient = new yly.RpcClient(accessToken, this.oauthConfig)
153
+ const Print = new yly.Printer(RpcClient)
154
+ const res = await Print.getOrderPagingList(
155
+ machineCode,
156
+ pageIndex,
157
+ pageSize
158
+ )
159
+
160
+ if (res && res.error_description !== 'success') {
161
+ throw new Error(res.error_description)
162
+ }
163
+ return res
164
+ } catch (e) {
165
+ await app.model.setting.update(
166
+ {
167
+ value: '',
168
+ },
169
+ {
170
+ where: {
171
+ code: 'print_token',
172
+ name: 'AccessToken',
173
+ },
174
+ }
175
+ )
176
+ throw new Error(`请重试,${e.message}`)
177
+ // return await this.print({ order_id, content })
178
+ }
179
+ }
180
+
148
181
  async cancelAll() {
149
182
  const app = this.config.app
150
183
  const accessToken = await this.getAccessToken()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "q-koa",
3
- "version": "12.3.4",
3
+ "version": "12.3.5",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {