|
@@ -37,6 +37,7 @@ func (c *MessageCommon) SummaryMessageList() {
|
|
|
messageMap := make(map[int]message.SummaryMessage)
|
|
|
timeList := make([]int, 0)
|
|
|
var err error
|
|
|
+ commentTypes := []int{services.CompanyApprovalMessageSourceTypeByQuestionComment, services.CompanyApprovalMessageSourceTypeByVideoComment, services.CompanyApprovalMessageSourceTypeByRoadVideoComment}
|
|
|
for _, sourceType := range sourceTypeList {
|
|
|
//最近一条消息
|
|
|
tmpMessage := ``
|
|
@@ -44,7 +45,7 @@ func (c *MessageCommon) SummaryMessageList() {
|
|
|
messageInfo := new(company_approval_message.CompanyApprovalMessageList)
|
|
|
// 来源类型为6-评论时, 查询6,7,8最近的一条消息
|
|
|
if sourceType == 6 {
|
|
|
- messageInfo, err = company_approval_message.GetLastMessageBySourceTypes(sysUserId, []int{6, 7, 8})
|
|
|
+ messageInfo, err = company_approval_message.GetLastMessageBySourceTypes(sysUserId, commentTypes)
|
|
|
} else {
|
|
|
messageInfo, err = company_approval_message.GetLastMessage(sysUserId, sourceType)
|
|
|
}
|
|
@@ -68,7 +69,7 @@ func (c *MessageCommon) SummaryMessageList() {
|
|
|
|
|
|
}
|
|
|
tmpMessage = fmt.Sprint("待分配提问:", content)
|
|
|
- case 6,7,8:
|
|
|
+ case 6, 7, 8:
|
|
|
content := messageInfo.Content
|
|
|
var tmpMessageInfo services.MessageInfo
|
|
|
if messageInfo.MessageInfo != `` {
|
|
@@ -84,14 +85,26 @@ func (c *MessageCommon) SummaryMessageList() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- notReadTotal, err := company_approval_message.GetNotReadMessageTotal(sysUserId, sourceType)
|
|
|
- if err != nil {
|
|
|
- c.FailWithMessage("获取失败", "获取未读消息数失败,Err:"+err.Error())
|
|
|
- return
|
|
|
+ notReadTotal := 0
|
|
|
+ if sourceType == 6 {
|
|
|
+ cnt, e := company_approval_message.GetCommentNotReadMessageTotal(sysUserId, commentTypes)
|
|
|
+ if e != nil {
|
|
|
+ c.FailWithMessage("获取失败", "获取评论未读消息数失败,Err:"+e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ notReadTotal = int(cnt)
|
|
|
+ } else {
|
|
|
+ nt, e := company_approval_message.GetNotReadMessageTotal(sysUserId, sourceType)
|
|
|
+ if e != nil {
|
|
|
+ c.FailWithMessage("获取失败", "获取未读消息数失败,Err:"+e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ notReadTotal = int(nt)
|
|
|
}
|
|
|
+
|
|
|
companyMessage := message.SummaryMessage{
|
|
|
Message: tmpMessage,
|
|
|
- Total: int(notReadTotal),
|
|
|
+ Total: notReadTotal,
|
|
|
SourceType: sourceType,
|
|
|
}
|
|
|
|
|
@@ -171,18 +184,20 @@ func (c *MessageCommon) MessageList() {
|
|
|
return
|
|
|
}
|
|
|
// 消息类型为6-评论时, 查询6-问答评论,7-视频评论,8-路演视频
|
|
|
- sourceTypeStr := strconv.Itoa(sourceType)
|
|
|
+ typeArr := make([]int, 0)
|
|
|
if sourceType == services.CompanyApprovalMessageSourceTypeByQuestionComment {
|
|
|
- sourceTypeStr = fmt.Sprintf("%d,%d,%d", services.CompanyApprovalMessageSourceTypeByQuestionComment, services.CompanyApprovalMessageSourceTypeByVideoComment, services.CompanyApprovalMessageSourceTypeByRoadVideoComment)
|
|
|
+ typeArr = append(typeArr, services.CompanyApprovalMessageSourceTypeByQuestionComment, services.CompanyApprovalMessageSourceTypeByVideoComment, services.CompanyApprovalMessageSourceTypeByRoadVideoComment)
|
|
|
+ } else {
|
|
|
+ typeArr = append(typeArr, sourceType)
|
|
|
}
|
|
|
- list, err := company_approval_message.GetCompanyApprovalMessageList(sysUserId, startSize, pageSize, sourceTypeStr)
|
|
|
+ list, err := company_approval_message.GetCompanyApprovalMessageList(sysUserId, startSize, pageSize, typeArr)
|
|
|
if err != nil {
|
|
|
c.FailWithMessage("获取失败", "获取消息列表失败,Err:"+err.Error())
|
|
|
return
|
|
|
}
|
|
|
|
|
|
//将所有未读消息标记为已读
|
|
|
- _ = company_approval_message.ModifyAllCompanyApprovalMessageStatus(sysUserId, sourceType)
|
|
|
+ _ = company_approval_message.ModifyAllCompanyApprovalMessageStatus(sysUserId, typeArr)
|
|
|
|
|
|
switch sourceType {
|
|
|
case 5, 6:
|