update
This commit is contained in:
+2
-2
@@ -30,7 +30,7 @@ type Article struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *Article) GetArticleById(id string) (*Article, error) {
|
func (a *Article) GetArticleById(id string) (*Article, error) {
|
||||||
path := os.Getenv("ARTICLE_PATH") + strings.Replace(id, "-", "/", -1) + ".md"
|
path := os.Getenv("ARTICLE_PATH") + strings.Replace(id, "<-", "/", -1) + ".md"
|
||||||
|
|
||||||
return a.GetArticleByPath(path)
|
return a.GetArticleByPath(path)
|
||||||
}
|
}
|
||||||
@@ -41,7 +41,7 @@ func (a *Article) GetArticleByPath(path string) (*Article, error) {
|
|||||||
|
|
||||||
a.Id = a.Uri[:len(a.Uri)-len(filepath.Ext(a.Uri))]
|
a.Id = a.Uri[:len(a.Uri)-len(filepath.Ext(a.Uri))]
|
||||||
a.Id = strings.Replace(a.Id, "\\", "/", -1)
|
a.Id = strings.Replace(a.Id, "\\", "/", -1)
|
||||||
a.Id = strings.Replace(a.Id, "/", "-", -1)
|
a.Id = strings.Replace(a.Id, "/", "<-", -1)
|
||||||
|
|
||||||
// 读取文件内容
|
// 读取文件内容
|
||||||
fileByte, err := ioutil.ReadFile(a.Path)
|
fileByte, err := ioutil.ReadFile(a.Path)
|
||||||
|
|||||||
Reference in New Issue
Block a user