|
|
@@ -57,12 +57,19 @@ export class ScanRecordService {
|
|
|
/**
|
|
|
* 获取最近N次扫描记录
|
|
|
*/
|
|
|
- async getRecentRecords(qrCode: string, limit: number = 10): Promise<ScanRecord[]> {
|
|
|
+ async getRecentRecords(qrCode: string, limit: number = 10, maintenanceCode?: string): Promise<ScanRecord[]> {
|
|
|
const qrCodeEntity = await this.qrCodeService.findByQrCode(qrCode)
|
|
|
if (!qrCodeEntity) {
|
|
|
throw new Error('二维码不存在')
|
|
|
}
|
|
|
|
|
|
+ if (maintenanceCode) {
|
|
|
+ const isValid = await this.qrCodeService.verifyMaintenanceCode(qrCode, maintenanceCode)
|
|
|
+ if (!isValid) {
|
|
|
+ throw new Error('维护码错误')
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
return this.scanRecordRepository.find({
|
|
|
where: { qrCodeId: qrCodeEntity.id },
|
|
|
order: { scanTime: 'DESC' },
|