refactor(push): change created_at format from Unix milliseconds to ISO8601
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
package service
|
package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
@@ -153,7 +153,7 @@ func (s *pushServiceImpl) pushViaWebSocket(ctx context.Context, userID string, m
|
|||||||
"type": string(message.SystemType),
|
"type": string(message.SystemType),
|
||||||
"content": content,
|
"content": content,
|
||||||
"extra": map[string]any{},
|
"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,
|
"title": title,
|
||||||
"content": content,
|
"content": content,
|
||||||
"data": data,
|
"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)
|
s.wsHub.PublishToUser(userID, "system_notification", sysMsg)
|
||||||
return true
|
return true
|
||||||
@@ -483,7 +483,7 @@ func (s *pushServiceImpl) pushSystemNotificationViaWebSocket(ctx context.Context
|
|||||||
"title": notification.Title,
|
"title": notification.Title,
|
||||||
"content": notification.Content,
|
"content": notification.Content,
|
||||||
"extra": map[string]any{},
|
"extra": map[string]any{},
|
||||||
"created_at": notification.CreatedAt.UnixMilli(),
|
"created_at": notification.CreatedAt.Format("2006-01-02T15:04:05Z07:00"),
|
||||||
}
|
}
|
||||||
|
|
||||||
// 填充额外数据
|
// 填充额外数据
|
||||||
|
|||||||
Reference in New Issue
Block a user