Procházet zdrojové kódy

移动端指标替换

xyxie před 9 měsíci
rodič
revize
fdb2149c00

+ 22 - 0
cache/replace_edb_info.go

@@ -0,0 +1,22 @@
+package cache
+
+import (
+	"eta/eta_mobile/models/data_manage"
+	"eta/eta_mobile/utils"
+	"fmt"
+)
+
+// 将替换指标操作加入到队列中
+func AddReplaceEdbInfo(oldEdbInfo, newEdbInfo *data_manage.EdbInfo) bool {
+	record := new(data_manage.ReplaceEdbInfoItem)
+	record.OldEdbInfo = oldEdbInfo
+	record.NewEdbInfo = newEdbInfo
+	if utils.Re == nil {
+		err := utils.Rc.LPush(utils.CACHE_KEY_REPLACE_EDB, record)
+		if err != nil {
+			fmt.Println("AddReplaceEdbInfo LPush Err:" + err.Error())
+		}
+		return true
+	}
+	return false
+}

+ 3 - 0
controllers/data_manage/edb_info.go

@@ -2,6 +2,7 @@ package data_manage
 
 import (
 	"encoding/json"
+	"eta/eta_mobile/cache"
 	"eta/eta_mobile/controllers"
 	"eta/eta_mobile/models"
 	"eta/eta_mobile/models/company"
@@ -3843,6 +3844,8 @@ func (this *ChartInfoController) EdbInfoReplace() {
 	} else {
 		//msgContent = oldEdbInfo.EdbName + "指标替换" + newEdbInfo.EdbName + "指标,全部替换成功,涉及" + strconv.Itoa(replaceChartTotal) + "张图表,\n\n" + strconv.Itoa(replaceCalculateTotal) + "个计算指标"
 		isFail = false
+		//加入到缓存队列中处理
+		go cache.AddReplaceEdbInfo(oldEdbInfo, newEdbInfo)
 	}
 
 	// 添加站内信息

+ 5 - 0
models/data_manage/edb_info.go

@@ -1651,3 +1651,8 @@ func getAllDataByMongo(edbInfoId, source, subSource int, startDataTime string) (
 
 	return
 }
+
+type ReplaceEdbInfoItem struct {
+	OldEdbInfo *EdbInfo
+	NewEdbInfo *EdbInfo
+}

+ 1 - 0
utils/constants.go

@@ -214,6 +214,7 @@ const (
 	CACHE_EN_PPT_EDITING              = "eta:en_ppt:editing:"               // 英文PPT用户编辑中
 	CACHE_SMART_REPORT_EDITING        = "eta:smart_report:editing:"         // 智能研报用户编辑中
 	CACHE_SMART_REPORT_SEND_MSG       = "eta:smart_report:sending:"         // 智能研报用户报告推送
+	CACHE_KEY_REPLACE_EDB             = "eta:replace_edb"                   //系统用户操作日志队列
 )
 
 // 模板消息推送类型