Procházet zdrojové kódy

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

- 使用z.coerce.number()确保timestamp字段能正确转换字符串类型的时间戳为数字
yourname před 8 měsíci
rodič
revize
2bfa1f2a4f
1 změnil soubory, kde provedl 1 přidání a 1 odebrání
  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: '张三',
     description: '发送者名称'
   }),
-  timestamp: z.number().int().positive().openapi({
+  timestamp: z.coerce.number().int().positive().openapi({
     example: 1704067200000,
     description: '消息时间戳'
   }),