chore: update html

This commit is contained in:
deepzz0
2021-04-27 16:51:19 +08:00
parent cb091532d5
commit 63b55b2df8
13 changed files with 53 additions and 53 deletions

6
pkg/cache/cache.go vendored
View File

@@ -234,8 +234,8 @@ func (c *Cache) rebuildArticle(article *model.Article, needSort bool) {
} }
} }
// series // series
for i, series := range c.Series { for i, serie := range c.Series {
if series.ID == article.SeriesID { if serie.ID == article.SerieID {
c.Series[i].Articles = append(c.Series[i].Articles, article) c.Series[i].Articles = append(c.Series[i].Articles, article)
if needSort { if needSort {
sort.Sort(c.Series[i].Articles) sort.Sort(c.Series[i].Articles)
@@ -291,7 +291,7 @@ func (c *Cache) regeneratePages() {
case pageArchive: case pageArchive:
sort.Sort(c.Archives) sort.Sort(c.Archives)
buf := bytes.Buffer{} buf := bytes.Buffer{}
buf.WriteString(c.Blogger.ArchiveSay + "\n") buf.WriteString(c.Blogger.ArchivesSay + "\n")
var ( var (
currentYear string currentYear string
gt12Month = len(Ei.Archives) > 12 gt12Month = len(Ei.Archives) > 12

View File

@@ -25,7 +25,7 @@ const (
collectionArticle = "article" collectionArticle = "article"
collectionBlogger = "blogger" collectionBlogger = "blogger"
collectionCounter = "counter" collectionCounter = "counter"
collectionSeries = "series" collectionSerie = "serie"
counterNameSerie = "serie" counterNameSerie = "serie"
counterNameArticle = "article" counterNameArticle = "article"
@@ -69,7 +69,7 @@ func (db *mongodb) Init(source string) (Store, error) {
Keys: bson.D{bson.E{Key: "slug", Value: 1}}, Keys: bson.D{bson.E{Key: "slug", Value: 1}},
Options: options.Index().SetUnique(true).SetSparse(true), Options: options.Index().SetUnique(true).SetSparse(true),
} }
db.Database(mongoDBName).Collection(collectionSeries). db.Database(mongoDBName).Collection(collectionSerie).
Indexes(). Indexes().
CreateOne(context.Background(), indexModel) CreateOne(context.Background(), indexModel)
return db, nil return db, nil
@@ -149,29 +149,29 @@ func (db *mongodb) UpdateAccount(ctx context.Context, name string,
return err return err
} }
// InsertSeries 创建专题 // InsertSerie 创建专题
func (db *mongodb) InsertSeries(ctx context.Context, series *model.Series) error { func (db *mongodb) InsertSerie(ctx context.Context, serie *model.Serie) error {
collection := db.Database(mongoDBName).Collection(collectionSeries) collection := db.Database(mongoDBName).Collection(collectionSerie)
series.ID = db.nextValue(ctx, counterNameSerie) serie.ID = db.nextValue(ctx, counterNameSerie)
_, err := collection.InsertOne(ctx, series) _, err := collection.InsertOne(ctx, serie)
return err return err
} }
// RemoveSeries 删除专题 // RemoveSerie 删除专题
func (db *mongodb) RemoveSeries(ctx context.Context, id int) error { func (db *mongodb) RemoveSerie(ctx context.Context, id int) error {
collection := db.Database(mongoDBName).Collection(collectionSeries) collection := db.Database(mongoDBName).Collection(collectionSerie)
filter := bson.M{"id": id} filter := bson.M{"id": id}
_, err := collection.DeleteOne(ctx, filter) _, err := collection.DeleteOne(ctx, filter)
return err return err
} }
// UpdateSeries 更新专题 // UpdateSerie 更新专题
func (db *mongodb) UpdateSeries(ctx context.Context, id int, func (db *mongodb) UpdateSerie(ctx context.Context, id int,
fields map[string]interface{}) error { fields map[string]interface{}) error {
collection := db.Database(mongoDBName).Collection(collectionSeries) collection := db.Database(mongoDBName).Collection(collectionSerie)
filter := bson.M{"id": id} filter := bson.M{"id": id}
params := bson.M{} params := bson.M{}
@@ -183,9 +183,9 @@ func (db *mongodb) UpdateSeries(ctx context.Context, id int,
return err return err
} }
// LoadAllSeries 查询所有专题 // LoadAllSerie 查询所有专题
func (db *mongodb) LoadAllSeries(ctx context.Context) (model.SortedSeries, error) { func (db *mongodb) LoadAllSerie(ctx context.Context) (model.SortedSeries, error) {
collection := db.Database(mongoDBName).Collection(collectionSeries) collection := db.Database(mongoDBName).Collection(collectionSerie)
filter := bson.M{} filter := bson.M{}
cur, err := collection.Find(ctx, filter) cur, err := collection.Find(ctx, filter)
@@ -196,7 +196,7 @@ func (db *mongodb) LoadAllSeries(ctx context.Context) (model.SortedSeries, error
var series model.SortedSeries var series model.SortedSeries
for cur.Next(ctx) { for cur.Next(ctx) {
obj := model.Series{} obj := model.Serie{}
err = cur.Decode(&obj) err = cur.Decode(&obj)
if err != nil { if err != nil {
return nil, err return nil, err

View File

@@ -27,14 +27,14 @@ type Store interface {
// UpdateAccount 更新账户 // UpdateAccount 更新账户
UpdateAccount(ctx context.Context, name string, fields map[string]interface{}) error UpdateAccount(ctx context.Context, name string, fields map[string]interface{}) error
// InsertSeries 创建专题 // InsertSerie 创建专题
InsertSeries(ctx context.Context, series *model.Series) error InsertSerie(ctx context.Context, series *model.Serie) error
// RemoveSeries 删除专题 // RemoveSerie 删除专题
RemoveSeries(ctx context.Context, id int) error RemoveSerie(ctx context.Context, id int) error
// UpdateSeries 更新专题 // UpdateSerie 更新专题
UpdateSeries(ctx context.Context, id int, fields map[string]interface{}) error UpdateSerie(ctx context.Context, id int, fields map[string]interface{}) error
// LoadAllSeries 读取所有专题 // LoadAllSerie 读取所有专题
LoadAllSeries(ctx context.Context) (model.SortedSeries, error) LoadAllSerie(ctx context.Context) (model.SortedSeries, error)
// InsertArticle 创建文章 // InsertArticle 创建文章
InsertArticle(ctx context.Context, article *model.Article) error InsertArticle(ctx context.Context, article *model.Article) error

View File

@@ -101,9 +101,9 @@ func handleArticlePage(c *gin.Context) {
} else { } else {
params["Days"] = int(time.Now().Sub(article.CreatedAt).Hours()) / 24 params["Days"] = int(time.Now().Sub(article.CreatedAt).Hours()) / 24
} }
if article.SeriesID > 0 { if article.SerieID > 0 {
for _, series := range cache.Ei.Series { for _, series := range cache.Ei.Series {
if series.ID == article.SeriesID { if series.ID == article.SerieID {
params["Serie"] = series params["Serie"] = series
} }
} }

View File

@@ -7,15 +7,15 @@ import "time"
// Article 文章 // Article 文章
type Article struct { type Article struct {
ID int `gorm:"column:id;primaryKey" bson:"id"` // 自增ID ID int `gorm:"column:id;primaryKey" bson:"id"` // 自增ID
Author string `gorm:"column:author;not null" bson:"author"` // 作者名 Author string `gorm:"column:author;not null" bson:"author"` // 作者名
Slug string `gorm:"column:slug;not null;uniqueIndex" bson:"slug"` // 文章缩略名 Slug string `gorm:"column:slug;not null;uniqueIndex" bson:"slug"` // 文章缩略名
Title string `gorm:"column:title;not null" bson:"title"` // 标题 Title string `gorm:"column:title;not null" bson:"title"` // 标题
Count int `gorm:"column:count;not null" bson:"count"` // 评论数量 Count int `gorm:"column:count;not null" bson:"count"` // 评论数量
Content string `gorm:"column:content;not null" bson:"content"` // markdown内容 Content string `gorm:"column:content;not null" bson:"content"` // markdown内容
SeriesID int `gorm:"column:series_id;not null" bson:"series_id"` // 专题ID SerieID int `gorm:"column:serie_id;not null" bson:"serie_id"` // 专题ID
Tags string `gorm:"column:tags;not null" bson:"tags"` // tag,以逗号隔开 Tags string `gorm:"column:tags;not null" bson:"tags"` // tag,以逗号隔开
IsDraft bool `gorm:"column:is_draft;not null" bson:"is_draft"` // 是否是草稿 IsDraft bool `gorm:"column:is_draft;not null" bson:"is_draft"` // 是否是草稿
DeletedAt time.Time `gorm:"column:deleted_at;default:null" bson:"deleted_at"` // 删除时间 DeletedAt time.Time `gorm:"column:deleted_at;default:null" bson:"deleted_at"` // 删除时间
UpdatedAt time.Time `gorm:"column:updated_at;default:now()" bson:"updated_at"` // 更新时间 UpdatedAt time.Time `gorm:"column:updated_at;default:now()" bson:"updated_at"` // 更新时间

View File

@@ -9,6 +9,6 @@ type Blogger struct {
BTitle string `gorm:"column:b_title;not null" bson:"b_title"` // 底部title BTitle string `gorm:"column:b_title;not null" bson:"b_title"` // 底部title
Copyright string `gorm:"column:copyright;not null" bson:"copyright"` // 版权声明 Copyright string `gorm:"column:copyright;not null" bson:"copyright"` // 版权声明
SeriesSay string `gorm:"column:series_say;not null" bson:"series_say"` // 专题说明 SeriesSay string `gorm:"column:series_say;not null" bson:"series_say"` // 专题说明
ArchiveSay string `gorm:"column:archive_say;not null" bson:"archive_say"` // 归档说明 ArchivesSay string `gorm:"column:archives_say;not null" bson:"archives_say"` // 归档说明
} }

View File

@@ -3,8 +3,8 @@ package model
import "time" import "time"
// Series 专题 // Serie 专题
type Series struct { type Serie struct {
ID int `gorm:"column:id;primaryKey" bson:"id"` // 自增ID ID int `gorm:"column:id;primaryKey" bson:"id"` // 自增ID
Slug string `gorm:"column:slug;not null;uniqueIndex" bson:"slug"` // 缩略名 Slug string `gorm:"column:slug;not null;uniqueIndex" bson:"slug"` // 缩略名
Name string `gorm:"column:name;not null" bson:"name"` // 专题名 Name string `gorm:"column:name;not null" bson:"name"` // 专题名
@@ -15,7 +15,7 @@ type Series struct {
} }
// SortedSeries 排序后专题 // SortedSeries 排序后专题
type SortedSeries []*Series type SortedSeries []*Serie
// Len 长度 // Len 长度
func (s SortedSeries) Len() int { return len(s) } func (s SortedSeries) Len() int { return len(s) }

View File

@@ -50,8 +50,8 @@
<td><a href="/admin/write-post?cid={{.ID}}">{{.Title}}</a></td> <td><a href="/admin/write-post?cid={{.ID}}">{{.Title}}</a></td>
<td>{{.Author}}</td> <td>{{.Author}}</td>
<td>{{if gt .SerieID 0}}专题ID:{{.SerieID}}{{else}}--{{end}}</td> <td>{{if gt .SerieID 0}}专题ID:{{.SerieID}}{{else}}--{{end}}</td>
<td>{{dateformat .CreateTime "2006/01/02 15:04"}}</td> <td>{{dateformat .CreatedAt "2006/01/02 15:04"}}</td>
<td>{{dateformat .UpdateTime "2006/01/02 15:04"}}</td> <td>{{dateformat .UpdatedAt "2006/01/02 15:04"}}</td>
</tr> </tr>
{{end}} {{end}}
</tbody> </tbody>

View File

@@ -35,7 +35,7 @@
<section class="typecho-post-option" role="application"> <section class="typecho-post-option" role="application">
<label for="date" class="typecho-label">发布日期</label> <label for="date" class="typecho-label">发布日期</label>
<p> <p>
<input class="typecho-date w-100" type="text" name="date" id="date" {{with .Edit}}value="{{dateformat .CreateTime "2006-01-02 15:04"}}"{{end}} /> <input class="typecho-date w-100" type="text" name="date" id="date" {{with .Edit}}value="{{dateformat .CreatedAt "2006-01-02 15:04"}}"{{end}} />
</p> </p>
</section> </section>
<section class="typecho-post-option category-option"> <section class="typecho-post-option category-option">

View File

@@ -68,8 +68,8 @@
</td> </td>
<td>{{.Author}}</td> <td>{{.Author}}</td>
<td>{{if gt .SerieID 0}}专题ID:{{.SerieID}}{{else}}--{{end}}</td> <td>{{if gt .SerieID 0}}专题ID:{{.SerieID}}{{else}}--{{end}}</td>
<td>{{dateformat .CreateTime "06/01/02 15:04"}}</td> <td>{{dateformat .CreatedAt "06/01/02 15:04"}}</td>
<td>{{dateformat .UpdateTime "06/01/02 15:04"}}</td> <td>{{dateformat .UpdatedAt "06/01/02 15:04"}}</td>
</tr> </tr>
{{end}} {{end}}
</tbody> </tbody>

View File

@@ -11,7 +11,7 @@
</p> </p>
<h2>{{.BlogName}}</h2> <h2>{{.BlogName}}</h2>
<p>{{.SubTitle}}</p> <p>{{.SubTitle}}</p>
<p>最后登录: {{dateformat .LoginTime "2006/01/02 15:04"}}</p> <p>最后登录: {{dateformat .LoginAt "2006/01/02 15:04"}}</p>
</div> </div>
<div class="col-mb-12 col-tb-6 col-tb-offset-1 typecho-content-panel" role="form"> <div class="col-mb-12 col-tb-6 col-tb-offset-1 typecho-content-panel" role="form">
<section> <section>

View File

@@ -50,7 +50,7 @@
<a href="/admin/add-serie?mid={{.ID}}">{{.Name}}</a> <a href="/admin/add-serie?mid={{.ID}}">{{.Name}}</a>
<a target="_blank" href="/series.html#toc-{{.ID}}" title="浏览 {{.Name}}"><i class="i-exlink"></i></a> <a target="_blank" href="/series.html#toc-{{.ID}}" title="浏览 {{.Name}}"><i class="i-exlink"></i></a>
</td> </td>
<td>{{dateformat .CreateTime "2006/01/02 15:04"}}</td> <td>{{dateformat .CreatedAt "2006/01/02 15:04"}}</td>
<td><a class="balloon-button left size-50" href="#">{{len .Articles}}</a></td> <td><a class="balloon-button left size-50" href="#">{{len .Articles}}</a></td>
</tr> </tr>
{{end}} {{end}}

View File

@@ -51,8 +51,8 @@
<td>{{.Title}}</td> <td>{{.Title}}</td>
<td>{{.Author}}</td> <td>{{.Author}}</td>
<td>{{if gt .SerieID 0}}专题ID:{{.SerieID}}{{else}}--{{end}}</td> <td>{{if gt .SerieID 0}}专题ID:{{.SerieID}}{{else}}--{{end}}</td>
<td>{{dateformat .CreateTime "2006/01/02 15:04"}}</td> <td>{{dateformat .CreatedAt "2006/01/02 15:04"}}</td>
<td>{{dateformat .DeleteTime "2006/01/02 15:04"}}</td> <td>{{dateformat .DeletedAt "2006/01/02 15:04"}}</td>
</tr> </tr>
{{end}} {{end}}
</tbody> </tbody>