|
|
@@ -23,13 +23,18 @@ export class ScanRecordService {
|
|
|
address?: string,
|
|
|
ipAddress?: string,
|
|
|
userAgent?: string
|
|
|
- ): Promise<ScanRecord> {
|
|
|
+ ): Promise<ScanRecord | null> {
|
|
|
// 获取二维码实体
|
|
|
const qrCodeEntity = await this.qrCodeService.findByQrCode(qrCode)
|
|
|
if (!qrCodeEntity) {
|
|
|
throw new Error('二维码不存在')
|
|
|
}
|
|
|
|
|
|
+ // 只有激活的二维码才记录扫描信息
|
|
|
+ if (!qrCodeEntity.isActivated) {
|
|
|
+ return null
|
|
|
+ }
|
|
|
+
|
|
|
// 创建扫描记录
|
|
|
const scanRecord = this.scanRecordRepository.create({
|
|
|
qrCodeId: qrCodeEntity.id,
|