|
@@ -24,6 +24,7 @@ type YbCommunityQuestionComment struct {
|
|
|
HotTime time.Time `orm:"column(hot_time)" description:"设置精选的时间"`
|
|
|
ModifyTime time.Time `orm:"column(modify_time)" description:"修改时间"`
|
|
|
CreateTime time.Time `orm:"column(create_time)" description:"创建时间"`
|
|
|
+ Source int `orm:"column(source)" description:"来源: 1-问答社区; 2-视频社区"`
|
|
|
}
|
|
|
|
|
|
// GetQuestionCommentById 主键获取提问评论
|
|
@@ -59,7 +60,9 @@ type YbCommunityQuestionCommentAndQuestion struct {
|
|
|
HotTime time.Time `orm:"column(hot_time)" description:"设置精选的时间"`
|
|
|
ModifyTime time.Time `orm:"column(modify_time)" description:"修改时间"`
|
|
|
CreateTime time.Time `orm:"column(create_time)" description:"创建时间"`
|
|
|
+ Source int `orm:"column(source)" description:"来源:1-问答社区; 2-视频社区"`
|
|
|
QuestionContent string `description:"问题内容"`
|
|
|
+ TagName string `description:"标签名称"`
|
|
|
}
|
|
|
|
|
|
// GetCommunityQuestionCommentList 获取问答列表
|
|
@@ -67,14 +70,14 @@ func GetCommunityQuestionCommentList(condition string, pars []interface{}, start
|
|
|
o := orm.NewOrm()
|
|
|
|
|
|
//汇总数据
|
|
|
- totalSQl := `SELECT COUNT(1) total FROM yb_community_question_comment a join yb_community_question b on a.community_question_id = b.community_question_id WHERE a.enabled = 1 and b.is_deleted=0 `
|
|
|
+ totalSQl := `SELECT COUNT(1) total FROM yb_community_question_comment a join yb_community_question b on a.community_question_id = b.community_question_id WHERE a.enabled = 1 and b.is_deleted=0 AND source = 1 `
|
|
|
totalSQl += condition
|
|
|
if err = o.Raw(totalSQl, pars).QueryRow(&total); err != nil {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
// 列表数据
|
|
|
- sql := `SELECT a.*,b.question_content FROM yb_community_question_comment a join yb_community_question b on a.community_question_id = b.community_question_id WHERE a.enabled = 1 and b.is_deleted=0 `
|
|
|
+ sql := `SELECT a.*,b.question_content FROM yb_community_question_comment a join yb_community_question b on a.community_question_id = b.community_question_id WHERE a.enabled = 1 and b.is_deleted=0 AND source = 1 `
|
|
|
sql += condition
|
|
|
sql += ` ORDER BY a.create_time DESC LIMIT ?,?`
|
|
|
_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&list)
|
|
@@ -89,3 +92,29 @@ func GetCommunityQuestionCommentListByIds(CommunityQuestionCommentIds string) (l
|
|
|
_, err = o.Raw(sql).QueryRows(&list)
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+// GetCommunityVideoCommentList 获取视频评论列表
|
|
|
+func GetCommunityVideoCommentList(condition string, pars []interface{}, startSize, pageSize int) (total int, list []*YbCommunityQuestionCommentAndQuestion, err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+
|
|
|
+ //汇总数据
|
|
|
+ totalSQl := `SELECT COUNT(1) total FROM yb_community_question_comment a JOIN yb_community_video b ON a.community_question_id = b.community_video_id WHERE a.enabled = 1 AND b.is_deleted = 0 AND source = 2 `
|
|
|
+ totalSQl += condition
|
|
|
+ if err = o.Raw(totalSQl, pars).QueryRow(&total); err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 列表数据
|
|
|
+ sql := `SELECT
|
|
|
+ a.*, b.title AS question_content,
|
|
|
+ b.variety_tag_name AS tag_name
|
|
|
+ FROM
|
|
|
+ yb_community_question_comment a
|
|
|
+ JOIN yb_community_video b ON a.community_question_id = b.community_video_id
|
|
|
+ WHERE
|
|
|
+ a.enabled = 1 AND b.is_deleted = 0 AND source = 2 `
|
|
|
+ sql += condition
|
|
|
+ sql += ` ORDER BY a.create_time DESC LIMIT ?,?`
|
|
|
+ _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&list)
|
|
|
+ return
|
|
|
+}
|