Explorar el Código

🐛 fix(chat): 修复消息时间戳类型转换问题

- 使用z.coerce.number()确保timestamp字段能正确转换字符串类型的时间戳为数字
yourname hace 6 meses
padre
commit
2bfa1f2a4f
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      src/server/modules/chat/chat-message.schema.ts

+ 1 - 1
src/server/modules/chat/chat-message.schema.ts

@@ -27,7 +27,7 @@ export const ChatMessageSchema = z.object({
     example: '张三',
     example: '张三',
     description: '发送者名称'
     description: '发送者名称'
   }),
   }),
-  timestamp: z.number().int().positive().openapi({
+  timestamp: z.coerce.number().int().positive().openapi({
     example: 1704067200000,
     example: 1704067200000,
     description: '消息时间戳'
     description: '消息时间戳'
   }),
   }),