瀏覽代碼

修改分类同步修改推送消息配置

xyxie 1 周之前
父節點
當前提交
fd3fb45b6c
共有 3 個文件被更改,包括 30 次插入0 次删除
  1. 1 0
      controllers/report_ice_message.go
  2. 7 0
      models/report.go
  3. 22 0
      services/classify.go

+ 1 - 0
controllers/report_ice_message.go

@@ -384,6 +384,7 @@ func (c *ReportIceMessageController) IceMsgPush() {
 			pushRecord := &models.ReportMessageRecord{
 				ReportId: int64(req.ReportId),
 				PptId: int64(req.PptId),
+				ReportTitle: title,
 				ClassifyId: sendClassifyId,
 				ClassifyType: int8(classifyType),
 				SendAdminId: int64(sysUser.AdminId),

+ 7 - 0
models/report.go

@@ -489,6 +489,7 @@ type ReportDetail struct {
 	ReportCreateTime    string `gorm:"column:report_create_time" description:"报告时间创建时间"`
 	ReportSource        int    `gorm:"column:report_source" description:"报告来源:1-系统内;2-智力共享"`
 	OutReportId         string `gorm:"column:out_report_id" description:"外部报告ID(或编码)"`
+	MsgSendTime         string `gorm:"column:msg_send_time" description:"消息推送时间"`
 }
 
 func GetReportById(reportId int) (item *ReportDetail, err error) {
@@ -534,6 +535,12 @@ func convertReportToReportDetail(report Report) (*ReportDetail, error) {
 		reportDetail.ReportCreateTime = ``
 	}
 
+	if !report.MsgSendTime.IsZero() {
+		reportDetail.MsgSendTime = report.MsgSendTime.Format(utils.FormatDateTime)
+	} else {
+		reportDetail.MsgSendTime = ``
+	}
+
 	return reportDetail, nil
 }
 

+ 22 - 0
services/classify.go

@@ -302,6 +302,8 @@ func AddReportClassify(classifyName string, parentId int, classifyType, isRemind
 			// 	errMsg = "添加分类可见权限失败"
 			// 	return
 			// }
+			// 继承父级分类的推送消息配置
+			inheritReportClassifyMsgConfig(parentId, classify.Id)
 		}
 	}
 
@@ -868,3 +870,23 @@ func GetClassifyChildIdsTreeRecursive(list []*models.Classify, parentId int) []i
 	}
 	return res
 }
+
+// 继承父级分类的推送消息配置
+func inheritReportClassifyMsgConfig(parentClassifyId, currClassifyId int) (err error) {
+	// 获取父级分类的推送消息配置
+	configObj := new(models.ReportMessageConfig)
+	parentClassifyMsgConfig, err := configObj.GetItemByClassifyId(parentClassifyId)
+	if err == nil && parentClassifyMsgConfig != nil && parentClassifyMsgConfig.ConfigId > 0 {
+		// 变更为当前分类的推送消息配置
+		parentClassifyMsgConfig.ClassifyId = currClassifyId
+		parentClassifyMsgConfig.ModifyTime = time.Now().Local()
+		err = parentClassifyMsgConfig.Update([]string{"ClassifyId", "ModifyTime"})
+		if err != nil {
+			return
+		}
+	}else {
+		err = nil
+	}
+
+	return
+}