|
@@ -8,6 +8,7 @@ import * as bip39 from 'bip39'
|
|
|
import { HttpStatusCode } from 'axios'
|
|
import { HttpStatusCode } from 'axios'
|
|
|
import { HttpException } from '@adonisjs/http-server/build/src/Exceptions/HttpException'
|
|
import { HttpException } from '@adonisjs/http-server/build/src/Exceptions/HttpException'
|
|
|
import FilesService from 'App/Services/FilesService'
|
|
import FilesService from 'App/Services/FilesService'
|
|
|
|
|
+import * as console from 'node:console'
|
|
|
|
|
|
|
|
export default class OcrRecordController {
|
|
export default class OcrRecordController {
|
|
|
private paginationService = new PaginationService(OcrRecord)
|
|
private paginationService = new PaginationService(OcrRecord)
|
|
@@ -27,15 +28,19 @@ export default class OcrRecordController {
|
|
|
record.content = ''
|
|
record.content = ''
|
|
|
record.record = ''
|
|
record.record = ''
|
|
|
record.img = ''
|
|
record.img = ''
|
|
|
|
|
+ record.thumbnail = ''
|
|
|
})
|
|
})
|
|
|
} else {
|
|
} else {
|
|
|
await Promise.all(
|
|
await Promise.all(
|
|
|
res.map(async (record) => {
|
|
res.map(async (record) => {
|
|
|
if (record.img && record.img !== '-') {
|
|
if (record.img && record.img !== '-') {
|
|
|
const url = new URL(record.img)
|
|
const url = new URL(record.img)
|
|
|
- record.img = await Drive.getSignedUrl(url.pathname.replace(/^\//, ''))
|
|
|
|
|
|
|
+ const filePath = url.pathname.replace(/^\//, '')
|
|
|
|
|
+ record.img = await Drive.getSignedUrl(filePath)
|
|
|
|
|
+ record.thumbnail = await FilesService.generateThumbnailUrl(filePath)
|
|
|
} else {
|
|
} else {
|
|
|
record.img = ''
|
|
record.img = ''
|
|
|
|
|
+ record.thumbnail = ''
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
)
|
|
)
|