fix:修复命名错误

This commit is contained in:
Amnesia
2026-03-14 19:56:31 +08:00
parent 9eed15efd5
commit 05c846c295
4 changed files with 9 additions and 9 deletions

View File

@@ -539,7 +539,7 @@ func (f *FeedService) buildFeedVideos(ctx context.Context, videos []*video.Video
func buildOrderedResult(orderedIDs []uint, dataMap map[uint]*video.Video) []*video.Video {
res := make([]*video.Video, 0, len(orderedIDs))
for _, id := range orderedIDs {
if v, exit := dataMap[id]; exit && v != nil {
if v, exits := dataMap[id]; exits && v != nil {
res = append(res, v)
}
}

View File

@@ -23,15 +23,15 @@ func NewRabbitMQ(cfg *config.RabbitMQConfig) (*RabbitMQ, error) {
return nil, errors.New("rabbitmq config is nil")
}
url := "amqp://" + cfg.Username + ":" + cfg.Password + "@" + cfg.Host + ":" + strconv.Itoa(cfg.Port) + "/"
Conn, err := amqp.Dial(url)
conn, err := amqp.Dial(url)
if err != nil {
return nil, err
}
Ch, err := Conn.Channel()
ch, err := conn.Channel()
if err != nil {
return nil, err
}
return &RabbitMQ{Conn: Conn, Ch: Ch}, nil
return &RabbitMQ{Conn: conn, Ch: ch}, nil
}
func (r *RabbitMQ) Close() error {

View File

@@ -19,7 +19,7 @@ const (
type TimelineEvent struct {
EventID string `json:"event_id"`
ViedoID uint `json:"video_id"`
VideoID uint `json:"video_id"`
CreateTime int64 `json:"create_time"`
OccurredAt time.Time `json:"occurred_at"`
}
@@ -36,7 +36,7 @@ func NewTimelineMQ(base *RabbitMQ) (*TimelineMQ, error) {
func (t *TimelineMQ) PublishVideo(ctx context.Context, videoID uint, createTime time.Time) error {
if t == nil || t.RabbitMQ == nil {
return errors.New("timelike mq is not initialized")
return errors.New("timeline mq is not initialized")
}
if videoID == 0 {
return errors.New("videoID are required")
@@ -47,7 +47,7 @@ func (t *TimelineMQ) PublishVideo(ctx context.Context, videoID uint, createTime
}
timeline := TimelineEvent{
EventID: id,
ViedoID: videoID,
VideoID: videoID,
CreateTime: createTime.UnixMilli(),
OccurredAt: time.Now(),
}

View File

@@ -50,14 +50,14 @@ func (vs *VideoService) Publish(ctx context.Context, video *Video) error {
return err
}
Msg := OutboxMsg{
msg := OutboxMsg{
VideoID: video.ID,
EventType: "video_published",
Status: "pending",
CreateTime: video.CreateTime,
}
if err := tx.Create(Msg).Error; err != nil {
if err := tx.Create(&msg).Error; err != nil {
return err
}
return nil