Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion service/impl/post_tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (p *postTagServiceImpl) PagePost(ctx context.Context, postQuery param.PostQ
postDo = postDo.Where(postDAL.Status.In(statuesValue...))
}
if postQuery.TagID != nil {
postDo.Join(&entity.PostTag{}, postDAL.ID.EqCol(postTagDAL.PostID)).Where(postTagDAL.ID.Eq(*postQuery.TagID))
postDo.Join(&entity.PostTag{}, postDAL.ID.EqCol(postTagDAL.PostID)).Where(postTagDAL.TagID.Eq(*postQuery.TagID))
}
posts, totalCount, err := postDo.FindByPage(postQuery.PageNum*postQuery.PageSize, postQuery.PageSize)
if err != nil {
Expand Down
14 changes: 7 additions & 7 deletions template/extension/pagination.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (p *paginationExtension) addArchivesPagination() {
if err != nil {
return nil, err
}
return p.getPagination(ctx, page, total, display, prefix, suffix)
return p.getPagination(ctx, page, total, display, "/"+prefix, suffix)
}
p.Template.AddFunc("archivesPagination", archivesPagination)
}
Expand Down Expand Up @@ -81,7 +81,7 @@ func (p *paginationExtension) addTagPostsPagination() {
if err != nil {
return nil, err
}
return p.getPagination(ctx, page, total, display, tagPrefix.(string)+"/"+slug, suffix)
return p.getPagination(ctx, page, total, display, "/"+tagPrefix.(string)+"/"+slug, suffix)
}
p.Template.AddFunc("tagPostsPagination", tagPostsPagination)
}
Expand All @@ -97,7 +97,7 @@ func (p *paginationExtension) addCategoryPostsPagination() {
if err != nil {
return nil, err
}
return p.getPagination(ctx, page, total, display, categoryPrefix.(string)+"/"+slug, suffix)
return p.getPagination(ctx, page, total, display, "/"+categoryPrefix.(string)+"/"+slug, suffix)
}
p.Template.AddFunc("categoryPostsPagination", categoryPostsPagination)
}
Expand All @@ -113,7 +113,7 @@ func (p *paginationExtension) addPhotosPagination() {
if err != nil {
return nil, err
}
return p.getPagination(ctx, page, total, display, prefix, suffix)
return p.getPagination(ctx, page, total, display, "/"+prefix, suffix)
}
p.Template.AddFunc("photosPagination", photosPagination)
}
Expand All @@ -129,7 +129,7 @@ func (p *paginationExtension) addJournalsPagination() {
if err != nil {
return nil, err
}
return p.getPagination(ctx, page, total, display, prefix, suffix)
return p.getPagination(ctx, page, total, display, "/"+prefix, suffix)
}
p.Template.AddFunc("journalsPagination", journalsPagination)
}
Expand All @@ -154,12 +154,12 @@ func (p *paginationExtension) getPagination(ctx context.Context, page, total, di

rainbow := util.RainbowPage(page+1, total, display)

rainbowPages := make([]vo.RainbowPage, len(rainbow), len(rainbow))
rainbowPages := make([]vo.RainbowPage, len(rainbow))

nextPageFullPath += prefix + "/page/" + strconv.Itoa(page+2) + suffix

if page == 1 {
prevPageFullPath += "/"
prevPageFullPath += prefix + "/"
} else {
prevPageFullPath += prefix + "/page/" + strconv.Itoa(page) + suffix
}
Expand Down