mirror of
https://github.com/mindoc-org/mindoc.git
synced 2026-02-27 17:03:57 +08:00
1、实现删除项目
2、实现生成访问令牌 3、实现添加评论
This commit is contained in:
@@ -3,6 +3,7 @@ package models
|
||||
import (
|
||||
"time"
|
||||
"github.com/lifei6671/godoc/conf"
|
||||
"github.com/astaxie/beego/orm"
|
||||
)
|
||||
|
||||
// Document struct.
|
||||
@@ -44,7 +45,20 @@ func NewDocument() *Document {
|
||||
return &Document{}
|
||||
}
|
||||
|
||||
|
||||
func (m *Document) Find(id int) error {
|
||||
if id <= 0 {
|
||||
return ErrInvalidParameter
|
||||
}
|
||||
o := orm.NewOrm()
|
||||
|
||||
|
||||
err := o.Read(m)
|
||||
|
||||
if err == orm.ErrNoRows{
|
||||
return ErrDataNotExist
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user