12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- package help_doc
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- type HelpDoc struct {
- Id int `orm:"column(id);pk"`
- ClassifyId int // 分类id
- ClassifyName string // 分类名称
- Title string // 标题
- Author string // 作者
- CreateTime time.Time // 创建时间
- ModifyTime time.Time // 修改时间
- Status int // 1:未发布,2:已发布
- PublishTime time.Time // 发布时间
- Content string // 内容
- AdminId int // 创建人
- AdminRealName string // 创建人姓名
- }
- func EditHelpDocClassifyId(classifyId int, classifyName string) (err error) {
- o := orm.NewOrm()
- sql := `UPDATE help_doc SET classify_name=?,modify_time=NOW() WHERE classify_id=? `
- _, err = o.Raw(sql, classifyId, classifyName).Exec()
- return
- }
- type AddHelpDocReq struct {
- ClassifyId int `description:"一级分类id"`
- ClassifyName string `description:"一级分类名称"`
- Title string `description:"标题"`
- Author string `description:"作者"`
- Status int `description:"状态:1:未发布,2:已发布"`
- Content string `description:"内容"`
- }
- func AddHelpDoc(item *HelpDoc) (lastId int64, err error) {
- o := orm.NewOrm()
- lastId, err = o.Insert(item)
- return
- }
- type EditHelpDocReq struct {
- Id int64 `description:"文章id"`
- ClassifyId int `description:"分类id"`
- ClassifyName string `description:"分类名称"`
- Title string `description:"标题"`
- Abstract string `description:"摘要"`
- Author string `description:"作者"`
- Frequency string `description:"频度"`
- State int `description:"状态:1:未发布,2:已发布"`
- Content string `description:"内容"`
- CreateTime string `description:"创建时间"`
- Overview string `description:"英文概述部分"`
- }
- //func EditHelpDoc(item *HelpDoc, reportId int64) (err error) {
- // o := orm.NewOrmUsingDB("rddp")
- // sql := `UPDATE help_doc
- // SET
- // classify_id =?,
- // classify_name_first = ?,
- // classify_id_second = ?,
- // classify_name_second = ?,
- // title = ?,
- // abstract = ?,
- // author = ?,
- // frequency = ?,
- // state = ?,
- // content = ?,
- // content_sub = ?,
- // stage =?,
- // create_time = ?,
- // modify_time = ?,
- // overview = ?
- // WHERE id = ? `
- // _, err = o.Raw(sql, item.ClassifyIdFirst, item.ClassifyNameFirst, item.ClassifyIdSecond, item.ClassifyNameSecond, item.Title,
- // item.Abstract, item.Author, item.Frequency, item.State, item.Content, item.ContentSub, item.Stage, item.CreateTime, time.Now(), item.Overview, reportId).Exec()
- // return
- //}
|