From 323f872aa99d9f2629bf0a713ae4ef10eb152ea1 Mon Sep 17 00:00:00 2001 From: lafay <2021211506@stu.hit.edu.cn> Date: Sat, 25 Apr 2026 00:40:00 +0800 Subject: [PATCH] refactor(push): change created_at format from Unix milliseconds to ISO8601 --- internal/service/push_service.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/push_service.go b/internal/service/push_service.go index 795a155..ee4d459 100644 --- a/internal/service/push_service.go +++ b/internal/service/push_service.go @@ -1,4 +1,4 @@ -package service +package service import ( "context" @@ -153,7 +153,7 @@ func (s *pushServiceImpl) pushViaWebSocket(ctx context.Context, userID string, m "type": string(message.SystemType), "content": content, "extra": map[string]any{}, - "created_at": message.CreatedAt.UnixMilli(), + "created_at": message.CreatedAt.Format("2006-01-02T15:04:05Z07:00"), } // 填充额外数据 @@ -454,7 +454,7 @@ func (s *pushServiceImpl) pushSystemViaWebSocket(ctx context.Context, userID str "title": title, "content": content, "data": data, - "created_at": time.Now().UnixMilli(), + "created_at": time.Now().Format("2006-01-02T15:04:05Z07:00"), } s.wsHub.PublishToUser(userID, "system_notification", sysMsg) return true @@ -483,7 +483,7 @@ func (s *pushServiceImpl) pushSystemNotificationViaWebSocket(ctx context.Context "title": notification.Title, "content": notification.Content, "extra": map[string]any{}, - "created_at": notification.CreatedAt.UnixMilli(), + "created_at": notification.CreatedAt.Format("2006-01-02T15:04:05Z07:00"), } // 填充额外数据