🎨 优化定时任务,优化定时发布文章功能

This commit is contained in:
2025-09-13 00:44:52 +08:00
parent f9b37fb1aa
commit a9b6816064
6 changed files with 85 additions and 4 deletions

View File

@@ -10,6 +10,7 @@ import (
"git.echol.cn/loser/lckt/model/user"
"go.uber.org/zap"
"strings"
"time"
)
type ArticleService struct{}
@@ -217,6 +218,10 @@ func (s ArticleService) BulkUpload(p request.BulkUpload) (err error) {
}
content := "<p><img src=" + a + " alt=\"" + a + "\" data-href=\"\" style=\"width: 100%;height: auto;\"/></p>"
// 将 p.PublishTime转为time.time类型
loc, _ := time.LoadLocation("Asia/Shanghai")
publishTime, _ := time.ParseInLocation("2006-01-02 15:04:05", p.PublishTime, loc)
articles = append(articles, article.Article{
Title: p.Title,
Desc: p.Desc,
@@ -227,6 +232,7 @@ func (s ArticleService) BulkUpload(p request.BulkUpload) (err error) {
Content: content,
IsFree: p.IsFree,
Price: int64(p.Price),
PublishTime: &publishTime,
})
}