Jelajahi Sumber

添加二维码服务以支持绑定状态的返回,更新相关逻辑以查询用户二维码绑定信息。

wuyi 2 minggu lalu
induk
melakukan
7c5c49007f
1 mengubah file dengan 6 tambahan dan 0 penghapusan
  1. 6 0
      src/services/qr-code.service.ts

+ 6 - 0
src/services/qr-code.service.ts

@@ -184,6 +184,11 @@ export class QrCodeService {
       }
     }
 
+    const bindRecord = await this.userQrCodeRepository.findOne({
+      where: { qrCodeId: entity.id, isDeleted: false }
+    })
+    const isBind = !!bindRecord
+
     return {
       id: entity.id,
       qrCode: entity.qrCode,
@@ -197,6 +202,7 @@ export class QrCodeService {
       }),
       isActivated: entity.isActivated,
       isVisible,
+      isBind,
       info
     }
   }