123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- package models
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- type CygxArticleComment struct {
- Id int `orm:"column(id);pk" description:"留言id"`
- UserId int `description:"用户id"`
- RealName string `description:"用户姓名"`
- ArticleId int `description:"文章id"`
- ActivityId int `description:"活动id"`
- VideoId int `description:"视频id"`
- ActivityVoiceId int `description:"活动音频ID"`
- AskserieVideoId int `description:" 系列问答视频ID askserie_video_id"`
- IndustryId int `description:"产业id"`
- CreateTime time.Time `description:"创建时间"`
- Mobile string `description:"手机号"`
- Email string `description:"邮箱"`
- CompanyId int `description:"公司id"`
- CompanyName string `description:"公司名称"`
- Content string `description:"内容"`
- Title string `description:"标题"`
- }
- // 添加留言
- func AddArticleComment(item *CygxArticleComment) (lastId int64, err error) {
- o := orm.NewOrm()
- lastId, err = o.Insert(item)
- return
- }
- type AddCygxArticleCommentReq struct {
- ArticleId int `description:"文章id"`
- Content string `description:"内容"`
- }
- // 我的留言列表
- func GetCommentList(userId int) (items []*CygxArticleComment, err error) {
- o := orm.NewOrm()
- sql := `SELECT
- c.*
- FROM
- cygx_article_comment AS c
- INNER JOIN cygx_article as a ON c.article_id = a.article_id
- WHERE
- user_id = ? AND a.article_type_id > 0 ORDER BY c.create_time DESC`
- _, err = o.Raw(sql, userId).QueryRows(&items)
- return
- }
- type CygxArticleCommentResp struct {
- Id int `orm:"column(id);pk" description:"留言id"`
- UserId int `description:"用户id"`
- ArticleId int `description:"文章id"`
- IndustryId int `description:"产业id"`
- ActivityId int `description:"活动id"`
- CreateTime time.Time `description:"创建时间"`
- Mobile string `description:"手机号"`
- Email string `description:"邮箱"`
- CompanyId int `description:"公司id"`
- CompanyName string `description:"公司名称"`
- Content string `description:"内容"`
- Title string `description:"标题"`
- RedirectType int `description:"跳转类型 1文章 2活动 3产业资源包"`
- IsCollect bool `description:"是否收藏:true,已收藏,false:未收藏"`
- IsRoadShow bool `description:"是否是路演精华"`
- }
- type CygxCommentListResp struct {
- List []*CygxArticleCommentResp
- }
- // 通过ID获取详情
- func GetArticleCommentById(id int) (item *CygxArticleCommentResp, err error) {
- sql := `SELECT * FROM cygx_article_comment WHERE id=? `
- err = orm.NewOrm().Raw(sql, id).QueryRow(&item)
- return
- }
- type CygxArticleCommentWxResp struct {
- Content string `description:"内容"`
- SourceId int `description:"跳转ID"`
- RedirectType int `description:"跳转类型 1文章 2活动 3产业资源包"`
- }
|