|
@@ -1,10 +1,8 @@
|
|
|
package yb_community_question
|
|
|
|
|
|
import (
|
|
|
- "errors"
|
|
|
"hongze/hongze_yb/global"
|
|
|
"hongze/hongze_yb/models/tables/yb_community_question_audio"
|
|
|
- "hongze/hongze_yb/utils"
|
|
|
"time"
|
|
|
)
|
|
|
|
|
@@ -74,20 +72,15 @@ func GetQuestionListCount(condition string, pars []interface{}) (list []*Questio
|
|
|
}
|
|
|
|
|
|
|
|
|
-func GetUnreadNum(where map[string]interface{}) (num int64, err error) {
|
|
|
- cond, vals, e := utils.WhereBuild(where)
|
|
|
- if e != nil {
|
|
|
- err = errors.New("系统异常,GetUnreadNum 生成查询语句失败")
|
|
|
- return
|
|
|
- }
|
|
|
- err = global.DEFAULT_MYSQL.Model(YbCommunityQuestion{}).Where(cond, vals...).Count(&num).Error
|
|
|
+func GetUnreadNum(condition string, pars []interface{}) (num int64, err error) {
|
|
|
+ err = global.DEFAULT_MYSQL.Model(YbCommunityQuestion{}).Where(condition, pars...).Count(&num).Error
|
|
|
return
|
|
|
}
|
|
|
|
|
|
|
|
|
func UpdateReplierRead(replierUserId int, questionIds []int) (err error) {
|
|
|
err = global.DEFAULT_MYSQL.Model(YbCommunityQuestion{}).
|
|
|
- Where("replier_user_id = ? AND community_question_id IN (?)", replierUserId, questionIds).
|
|
|
+ Where("replier_user_id = ? AND community_question_id IN (?) AND replier_is_read=0", replierUserId, questionIds).
|
|
|
Updates(YbCommunityQuestion{
|
|
|
ReplierIsRead: 1,
|
|
|
ModifyTime: time.Now().Local(),
|
|
@@ -98,7 +91,7 @@ func UpdateReplierRead(replierUserId int, questionIds []int) (err error) {
|
|
|
|
|
|
func UpdateUserRead(userId int, questionIds []int) (err error) {
|
|
|
err = global.DEFAULT_MYSQL.Model(YbCommunityQuestion{}).
|
|
|
- Where("user_id = ? AND community_question_id IN (?)", userId, questionIds).
|
|
|
+ Where("user_id = ? AND community_question_id IN (?) AND is_read=0", userId, questionIds).
|
|
|
Updates(YbCommunityQuestion{
|
|
|
IsRead: 1,
|
|
|
ModifyTime: time.Now().Local(),
|