123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- package crm
- import (
- "eta/eta_docs/global"
- "time"
- )
- type HelpDoc struct {
- Id int `gorm:"column:id;primary_key;AUTO_INCREMENT" json:"id"`
- ClassifyId int `gorm:"column:classify_id;default:0" json:"classify_id"` // 分类id
- ClassifyName string `gorm:"column:classify_name" json:"classify_name"` // 分类名称
- Title string `gorm:"column:title" json:"title"` // 标题
- Author string `gorm:"column:author" json:"author"` // 作者
- CreateTime time.Time `gorm:"column:create_time;default:CURRENT_TIMESTAMP" json:"create_time"` // 创建时间
- ModifyTime time.Time `gorm:"column:modify_time;default:CURRENT_TIMESTAMP" json:"modify_time"` // 修改时间
- Status int `gorm:"column:status;default:1" json:"status"` // 1:未发布,2:已发布
- PublishTime time.Time `gorm:"column:publish_time" json:"publish_time"` // 发布时间
- Content string `gorm:"column:content" json:"content"` // 内容
- AdminId int `gorm:"column:admin_id;default:0;NOT NULL" json:"admin_id"` // 创建人
- AdminRealName string `gorm:"column:admin_real_name" json:"admin_real_name"` // 创建人姓名
- Anchor string `gorm:"column:anchor" json:"anchor"` // 锚点
- Recommend string `gorm:"column:recommend" json:"recommend"` // 推荐
- }
- func (m *HelpDoc) TableName() string {
- return "`help_doc`"
- }
- // GetItemByCondition 获取
- func (m *HelpDoc) GetItemByCondition(condition string, pars []interface{}, orderRule string) (item *HelpDoc, err error) {
- if orderRule == "" {
- orderRule = "create_time DESC"
- }
- err = global.MYSQL["hz_crm"].Where(condition, pars...).Order(orderRule).First(&item).Error
- return
- }
- type HelpDocResp struct {
- Id int `orm:"column(id);pk"`
- ClassifyId int // 分类id
- Title string // 标题
- Author string // 作者
- CreateTime string // 创建时间
- ModifyTime string // 修改时间
- Status int // 1:未发布,2:已发布
- PublishTime string // 发布时间
- Content string // 内容
- AdminId int // 创建人
- AdminRealName string // 创建人姓名
- Anchor []AnchorList // 锚点
- Recommend []RecommendList // 推荐
- }
- type AnchorList struct {
- AnchorId string
- Anchor string
- AnchorName string
- Child []AnchorList
- }
- type RecommendList struct {
- Name string
- Url string
- }
|