Skip to content

Commit 456b634

Browse files
committed
移除标签展示功能
1 parent 1a49b87 commit 456b634

File tree

8 files changed

+0
-98
lines changed

8 files changed

+0
-98
lines changed

service/main.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import (
1818
"github.com/movsb/taoblog/modules/utils"
1919
"github.com/movsb/taoblog/modules/version"
2020
"github.com/movsb/taoblog/protocols/go/proto"
21-
"github.com/movsb/taoblog/service/models"
2221
"github.com/movsb/taoblog/service/modules/cache"
2322
commentgeo "github.com/movsb/taoblog/service/modules/comment_geo"
2423
"github.com/movsb/taoblog/service/modules/comment_notify"
@@ -40,7 +39,6 @@ type ToBeImplementedByRpc interface {
4039
GetLink(ID int64) string
4140
GetPlainLink(ID int64) string
4241
Config() *config.Config
43-
ListTagsWithCount() []*models.TagWithCount
4442
IncrementPostPageView(id int64)
4543
ThemeChangedAt() time.Time
4644
GetCommentEmailById(id int) string

service/models/tag.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,3 @@ type ObjectTag struct {
2323
func (ObjectTag) TableName() string {
2424
return `post_tags`
2525
}
26-
27-
// TagWithCount is a tag with associated post count.
28-
type TagWithCount struct {
29-
// taorm yet doesn't support embedded field scanning.
30-
Name string
31-
Count int64
32-
}

service/tag.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,6 @@ func (s *Service) GetTagByName(name string) *models.Tag {
2424
return &tag
2525
}
2626

27-
func (s *Service) ListTagsWithCount() []*models.TagWithCount {
28-
var tags []*models.TagWithCount
29-
s.tdb.Raw(`
30-
SELECT tags.name AS name, count(tags.id) AS count
31-
FROM tags INNER JOIN post_tags ON tags.id = post_tags.tag_id
32-
GROUP BY tags.id
33-
ORDER BY count desc
34-
`).MustFind(&tags)
35-
return tags
36-
}
37-
3827
func (s *Service) getObjectTagIDs(postID int64, alias bool) (ids []int64) {
3928
sql := `SELECT tag_id FROM post_tags WHERE post_id=?`
4029
rows, err := s.tdb.Query(sql, postID)

theme/blog/templates/tags.html

Lines changed: 0 additions & 37 deletions
This file was deleted.

theme/data/data.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ type Data struct {
4343
// If it is the Posts.
4444
Posts *PostsData
4545

46-
// If it is the Tags.
47-
Tags *TagsData
48-
4946
// If it is the tag.
5047
Tag *TagData
5148

theme/data/tags.go

Lines changed: 0 additions & 30 deletions
This file was deleted.

theme/main.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ func New(devMode bool, cfg *config.Config, service proto.TaoBlogServer, impl ser
9898
m.HandleFunc(`GET /search`, t.querySearch)
9999
m.Handle(`GET /posts`, t.LastPostTime304HandlerFunc(t.queryPosts))
100100
m.Handle(`GET /tweets`, t.LastPostTime304HandlerFunc(t.queryTweets))
101-
m.Handle(`GET /tags`, t.LastPostTime304HandlerFunc(t.queryTags))
102101

103102
t.loadTemplates()
104103

@@ -302,11 +301,6 @@ func (t *Theme) queryTweets(w http.ResponseWriter, r *http.Request) {
302301
t.executeTemplate(`tweets.html`, w, d)
303302
}
304303

305-
func (t *Theme) queryTags(w http.ResponseWriter, r *http.Request) {
306-
d := data.NewDataForTags(r.Context(), t.cfg, t.service, t.impl)
307-
t.executeTemplate(`tags.html`, w, d)
308-
}
309-
310304
func (t *Theme) QueryByID(w http.ResponseWriter, r *http.Request, id int64) {
311305
p, err := t.service.GetPost(r.Context(),
312306
&proto.GetPostRequest{

theme/modules/canonical/constant.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,4 @@ var nonCategoryNames = map[string]bool{
1414
"/admin/": true,
1515
"/scripts/": true,
1616
"/images/": true,
17-
"/tags/": true,
18-
"/plugins/": true,
1917
}

0 commit comments

Comments
 (0)