help_doc.go 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. package crm
  2. import (
  3. "eta/eta_docs/global"
  4. "time"
  5. )
  6. type HelpDoc struct {
  7. Id int `gorm:"column:id;primary_key;AUTO_INCREMENT" json:"id"`
  8. ClassifyId int `gorm:"column:classify_id;default:0" json:"classify_id"` // 分类id
  9. ClassifyName string `gorm:"column:classify_name" json:"classify_name"` // 分类名称
  10. Title string `gorm:"column:title" json:"title"` // 标题
  11. Author string `gorm:"column:author" json:"author"` // 作者
  12. CreateTime time.Time `gorm:"column:create_time;default:CURRENT_TIMESTAMP" json:"create_time"` // 创建时间
  13. ModifyTime time.Time `gorm:"column:modify_time;default:CURRENT_TIMESTAMP" json:"modify_time"` // 修改时间
  14. Status int `gorm:"column:status;default:1" json:"status"` // 1:未发布,2:已发布
  15. PublishTime time.Time `gorm:"column:publish_time" json:"publish_time"` // 发布时间
  16. Content string `gorm:"column:content" json:"content"` // 内容
  17. AdminId int `gorm:"column:admin_id;default:0;NOT NULL" json:"admin_id"` // 创建人
  18. AdminRealName string `gorm:"column:admin_real_name" json:"admin_real_name"` // 创建人姓名
  19. Anchor string `gorm:"column:anchor" json:"anchor"` // 锚点
  20. Recommend string `gorm:"column:recommend" json:"recommend"` // 推荐
  21. }
  22. func (m *HelpDoc) TableName() string {
  23. return "`help_doc`"
  24. }
  25. // GetItemByCondition 获取
  26. func (m *HelpDoc) GetItemByCondition(condition string, pars []interface{}, orderRule string) (item *HelpDoc, err error) {
  27. if orderRule == "" {
  28. orderRule = "create_time DESC"
  29. }
  30. err = global.MYSQL["hz_crm"].Where(condition, pars...).Order(orderRule).First(&item).Error
  31. return
  32. }
  33. type HelpDocResp struct {
  34. Id int `orm:"column(id);pk"`
  35. ClassifyId int // 分类id
  36. Title string // 标题
  37. Author string // 作者
  38. CreateTime string // 创建时间
  39. ModifyTime string // 修改时间
  40. Status int // 1:未发布,2:已发布
  41. PublishTime string // 发布时间
  42. Content string // 内容
  43. AdminId int // 创建人
  44. AdminRealName string // 创建人姓名
  45. Anchor []AnchorList // 锚点
  46. Recommend []RecommendList // 推荐
  47. }
  48. type AnchorList struct {
  49. AnchorId string
  50. Anchor string
  51. AnchorName string
  52. Child []AnchorList
  53. }
  54. type RecommendList struct {
  55. Name string
  56. Url string
  57. }