|
|
@@ -21,6 +21,13 @@ export class PersonInfoController {
|
|
|
try {
|
|
|
const { qrCode, ...data } = request.body
|
|
|
|
|
|
+ if (data.photoUrl) {
|
|
|
+ try {
|
|
|
+ const urlObj = new URL(data.photoUrl)
|
|
|
+ data.photoUrl = urlObj.pathname.substring(1)
|
|
|
+ } catch (error) {}
|
|
|
+ }
|
|
|
+
|
|
|
const personInfo = await this.personInfoService.create(qrCode, data)
|
|
|
|
|
|
return reply.code(201).send({
|
|
|
@@ -37,6 +44,13 @@ export class PersonInfoController {
|
|
|
try {
|
|
|
const { qrCode, maintenanceCode, ...data } = request.body
|
|
|
|
|
|
+ if (data.photoUrl) {
|
|
|
+ try {
|
|
|
+ const urlObj = new URL(data.photoUrl)
|
|
|
+ data.photoUrl = urlObj.pathname.substring(1)
|
|
|
+ } catch (error) {}
|
|
|
+ }
|
|
|
+
|
|
|
const personInfo = await this.personInfoService.update(qrCode, maintenanceCode, data)
|
|
|
|
|
|
return reply.send({
|
|
|
@@ -78,6 +92,13 @@ export class PersonInfoController {
|
|
|
return reply.code(400).send({ message: '请提供二维码ID' })
|
|
|
}
|
|
|
|
|
|
+ if (data.photoUrl) {
|
|
|
+ try {
|
|
|
+ const urlObj = new URL(data.photoUrl)
|
|
|
+ data.photoUrl = urlObj.pathname.substring(1)
|
|
|
+ } catch (error) {}
|
|
|
+ }
|
|
|
+
|
|
|
const personInfo = await this.personInfoService.adminUpdate(qrCodeId, data)
|
|
|
|
|
|
return reply.send({
|