package models import ( "github.com/beego/beego/v2/client/orm" "time" ) type CygxInterviewApply struct { InterviewApplyId int `orm:"column(interview_apply_id);pk"` UserId int `description:"用户id"` CompanyId int `description:"客户id"` Status string `description:"'待邀请','待访谈','已完成','已取消'"` InterviewTime time.Time `description:"访谈时间"` ArticleId int `description:"纪要id"` Sort int `description:"排序"` ArticleTitle string `description:"纪要标题"` CreateTime time.Time `description:"创建时间"` ModifyTime time.Time `description:"修改时间"` ArticleIdMd5 string `description:"纪要id"` } //添加申请访谈信息 func AddCygxInterviewApply(item *CygxInterviewApply) (lastId int64, err error) { o := orm.NewOrm() lastId, err = o.Insert(item) return } type ArticleInterviewApplyReq struct { ArticleId int `description:"报告id"` } type ArticleInterviewApplyResp struct { Status int `description:"1:申请成功,2:取消申请"` } func RemoveArticleInterviewApply(userId, articleId int) (err error) { o := orm.NewOrm() sql := `DELETE FROM cygx_interview_apply WHERE user_id=? AND article_id=? AND status<>'已取消' ` _, err = o.Raw(sql, userId, articleId).Exec() return } func GetArticleInterviewApplyUsersCount(articleId int) (count int, err error) { sql := `SELECT COUNT(user_id) AS count FROM cygx_interview_apply WHERE article_id=? ` err = orm.NewOrm().Raw(sql, articleId).QueryRow(&count) return } func GetArticleInterviewApply(userId, articleId int) (item *CygxInterviewApply, err error) { sql := `SELECT * FROM cygx_interview_apply WHERE user_id=? AND article_id=? AND status<>'已取消' ` err = orm.NewOrm().Raw(sql, userId, articleId).QueryRow(&item) return } func GetArticleInterviewApplyCount(userId, articleId int) (count int, err error) { sql := `SELECT COUNT(1) AS count FROM cygx_interview_apply WHERE user_id=? AND article_id=? AND status<>'已取消' ` err = orm.NewOrm().Raw(sql, userId, articleId).QueryRow(&count) return } type ArticleInterviewApplyList struct { Id int `orm:"column(id);pk"` ArticleId int UserId int CreateTime string Title string `description:"标题"` TitleEn string `description:"英文标题 "` UpdateFrequency string `description:"更新周期"` CreateDate string `description:"创建时间"` PublishDate string `description:"发布时间"` Body string `description:"内容"` Abstract string `description:"摘要"` CategoryName string `description:"一级分类"` SubCategoryName string `description:"二级分类"` Status string `description:"'待邀请','待访谈','已完成','已取消'"` InterviewTime string `description:"访谈时间"` ExpertBackground string `description:"专家背景"` ExpertNumber string `description:"专家编号"` }