Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
Daniel 2025-11-29 00:01:30 +08:00
parent 9f0eaa6a0b
commit a65f46c922
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
2 changed files with 38 additions and 6 deletions

View file

@ -1074,6 +1074,8 @@ func CreateWithMarkdown(tags, boxID, hPath, md, parentID, id string, withMath bo
return
}
const DailyNoteAttrPrefix = "custom-dailynote-"
func CreateDailyNote(boxID string) (p string, existed bool, err error) {
createDocLock.Lock()
defer createDocLock.Unlock()
@ -1110,8 +1112,8 @@ func CreateDailyNote(boxID string) (p string, existed bool, err error) {
}
p = tree.Path
date := time.Now().Format("20060102")
if tree.Root.IALAttr("custom-dailynote-"+date) == "" {
tree.Root.SetIALAttr("custom-dailynote-"+date, date)
if tree.Root.IALAttr(DailyNoteAttrPrefix+date) == "" {
tree.Root.SetIALAttr(DailyNoteAttrPrefix+date, date)
if err = indexWriteTreeUpsertQueue(tree); err != nil {
return
}
@ -1179,7 +1181,7 @@ func CreateDailyNote(boxID string) (p string, existed bool, err error) {
}
p = tree.Path
date := time.Now().Format("20060102")
tree.Root.SetIALAttr("custom-dailynote-"+date, date)
tree.Root.SetIALAttr(DailyNoteAttrPrefix+date, date)
if err = indexWriteTreeUpsertQueue(tree); err != nil {
return
}