Răsfoiți Sursa

Merge branch 'hotfix/message_num_1223' into debug

hsun 1 zi în urmă
părinte
comite
ab7b9b2117
1 a modificat fișierele cu 28 adăugiri și 13 ștergeri
  1. 28 13
      controllers/message.go

+ 28 - 13
controllers/message.go

@@ -5,7 +5,6 @@ import (
 	biapprove "eta_gn/eta_api/models/bi_approve"
 	"eta_gn/eta_api/models/data_manage/data_manage_permission"
 	"eta_gn/eta_api/models/knowledge_approve"
-	"eta_gn/eta_api/models/report_approve"
 	"fmt"
 )
 
@@ -39,24 +38,40 @@ func (c *MessageController) UnReadMessageNum() {
 
 	var unReadReportNum, unReadDataPermissionNum, unReadBiNum, unReadKnowledgeNum int
 
-	// 获取报告审批消息
-	{
-		cond := fmt.Sprintf(` AND %s = ?`, report_approve.ReportApproveMessageCols.ReceiveUserId)
-		pars := make([]interface{}, 0)
-		pars = append(pars, sysUser.AdminId)
-
-		messageOb := new(report_approve.ReportApproveMessage)
+	// 获取报告审批消息(废弃)
+	//{
+	//	cond := fmt.Sprintf(` AND %s = ?`, report_approve.ReportApproveMessageCols.ReceiveUserId)
+	//	pars := make([]interface{}, 0)
+	//	pars = append(pars, sysUser.AdminId)
+	//
+	//	messageOb := new(report_approve.ReportApproveMessage)
+	//
+	//	// 未读消息数
+	//	cond += fmt.Sprintf(` AND %s = ?`, report_approve.ReportApproveMessageCols.IsRead)
+	//	pars = append(pars, 0)
+	//	unreadTotal, e := messageOb.GetCountByCondition(cond, pars)
+	//	if e != nil {
+	//		br.Msg = "获取失败"
+	//		br.ErrMsg = "获取审批消息列表总数失败, Err: " + e.Error()
+	//		return
+	//	}
+	//	unReadReportNum = unreadTotal
+	//}
 
+	// 报告通知消息
+	{
 		// 未读消息数
-		cond += fmt.Sprintf(` AND %s = ?`, report_approve.ReportApproveMessageCols.IsRead)
-		pars = append(pars, 0)
-		unreadTotal, e := messageOb.GetCountByCondition(cond, pars)
+		messageOb := new(models.ReportMessage)
+		cond := fmt.Sprintf(` AND %s = ? AND %s = ?`, models.ReportMessageCols.ReceiveUserId, models.ReportMessageCols.IsRead)
+		pars := make([]interface{}, 0)
+		pars = append(pars, sysUser.AdminId, 0)
+		total, e := messageOb.GetCountByCondition(cond, pars)
 		if e != nil {
 			br.Msg = "获取失败"
-			br.ErrMsg = "获取审批消息列表总数失败, Err: " + e.Error()
+			br.ErrMsg = "获取报告通知列表总数失败, Err: " + e.Error()
 			return
 		}
-		unReadReportNum = unreadTotal
+		unReadReportNum = total
 	}
 
 	// 获取资产消息