瀏覽代碼

Merge branch 'cygx_need_913' of http://8.136.199.33:3000/hongze/hongze_open_api into debug

xingzai 1 年之前
父節點
當前提交
60f0d358c2
共有 3 個文件被更改,包括 34 次插入0 次删除
  1. 24 0
      controllers/report.go
  2. 6 0
      models/tables/cygx/article/cygx_article_celue_push.go
  3. 4 0
      utils/constants.go

+ 24 - 0
controllers/report.go

@@ -2,6 +2,7 @@ package controllers
 
 import (
 	"encoding/json"
+	"fmt"
 	"github.com/rdlucklib/rdluck_tools/common"
 	"hongze/hongze_open_api/logic"
 	"hongze/hongze_open_api/models/request/article"
@@ -10,6 +11,7 @@ import (
 	"hongze/hongze_open_api/models/tables/rddp/classify"
 	tables "hongze/hongze_open_api/models/tables/report"
 	"hongze/hongze_open_api/models/tables/wx_user"
+	"hongze/hongze_open_api/services/alarm_msg"
 	"hongze/hongze_open_api/utils"
 	"net/url"
 	"strconv"
@@ -303,9 +305,31 @@ func (c *ReportController) ArticleChange() {
 		c.OkWithMessage("创建失败")
 		return
 	}
+
+	if action == "edit" || action == "move" {
+		log := &celuePushTable.CygxArticleCeluePushRedis{ArticleId: articleId, Action: action, CreateTime: time.Now()}
+		if utils.Re == nil {
+			err := utils.Rc.LPush(utils.CYGX_ARTICLE_UPDATE_KEY, log)
+			if err != nil {
+				go alarm_msg.SendAlarmMsg(fmt.Sprint("CygxArticleCeluePushRedis LPush Err:", err.Error(), "文章ID", articleId), 3)
+			}
+		}
+	}
 	c.OkWithMessage("创建成功")
 }
 
+//func init() {
+//	articleId := 10187
+//	action := "edit"
+//	log := &celuePushTable.CygxArticleCeluePushRedis{ArticleId: articleId, Action: action, CreateTime: time.Now()}
+//	if utils.Re == nil {
+//		err := utils.Rc.LPush(utils.CYGX_ARTICLE_UPDATE_KEY, log)
+//		if err != nil {
+//			go alarm_msg.SendAlarmMsg(fmt.Sprint("CygxArticleCeluePushRedis LPush Err:", err.Error(), "文章ID", articleId), 3)
+//		}
+//	}
+//}
+
 // ClassifyList
 // @Title 获取报告分类列表接口
 // @Description 获取报告分类列表接口

+ 6 - 0
models/tables/cygx/article/cygx_article_celue_push.go

@@ -20,3 +20,9 @@ func AddCygxArticleCeluePush(item *CygxArticleCeluePush) (err error) {
 	_, err = o.Insert(item)
 	return
 }
+
+type CygxArticleCeluePushRedis struct {
+	ArticleId  int       `description:"文章ID"`
+	Action     string    `description:"日志类型:add,edit,move"`
+	CreateTime time.Time `description:"创建时间"`
+}

+ 4 - 0
utils/constants.go

@@ -105,6 +105,10 @@ const (
 	CACHE_KEY_DAYNEW_TRANSLATE = "admin:day_new:translate" //每日资讯中翻英
 )
 
+// 查研缓存key
+const (
+	CYGX_ARTICLE_UPDATE_KEY = "CYGX_ARTICLE_UPDATE_KEY" //策略平台更新文章key
+)
 const ALIYUN_YBIMG_HOST = "https://hzstatic.hzinsights.com/static/yb_wx/"
 const HZ_DEFAULT_AVATAR = "https://hzstatic.hzinsights.com/static/yb_wx/hz_default_avatar.png"