1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- package models
- import (
- "github.com/beego/beego/v2/client/orm"
- "github.com/rdlucklib/rdluck_tools/paging"
- "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, startSize, pageSize int) (items []*CygxArticleComment, err error) {
- o := orm.NewOrm()
- sql := `SELECT
- *
- FROM
- cygx_article_comment AS c
- WHERE
- user_id = ? ORDER BY c.create_time DESC LIMIT ?,? `
- _, err = o.Raw(sql, userId, startSize, pageSize).QueryRows(&items)
- return
- }
- // 我的留言列表
- func GetCommentListCount(userId int) (count int, err error) {
- o := orm.NewOrm()
- sql := `SELECT
- COUNT( 1 ) as count
- FROM
- cygx_article_comment AS c
- WHERE
- user_id = ? ORDER BY c.create_time DESC `
- err = o.Raw(sql, userId).QueryRow(&count)
- 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"`
- ChartPermissionId int `description:"权限id"`
- VideoId int `description:"视频id"`
- CreateTime string `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产业视频 4活动视频"`
- }
- type CygxCommentListResp struct {
- List []*CygxArticleCommentResp
- Paging *paging.PagingItem
- }
|