From 0cdea2faa4d75f4a0ad441eacc5008191e439f72 Mon Sep 17 00:00:00 2001 From: shenjiachi Date: Fri, 27 Dec 2024 17:45:40 +0800 Subject: [PATCH] feat: publish record to mq when user comment --- app/hdl/friend_circle/hdl_comment.go | 11 +++++++++++ go.mod | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/hdl/friend_circle/hdl_comment.go b/app/hdl/friend_circle/hdl_comment.go index 87fed14..fd77222 100644 --- a/app/hdl/friend_circle/hdl_comment.go +++ b/app/hdl/friend_circle/hdl_comment.go @@ -7,8 +7,10 @@ import ( svc2 "applet/app/svc/friend_circle" "applet/app/utils/cache" "code.fnuoos.com/EggPlanet/egg_system_rules.git/md" + md2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy/md" svc3 "code.fnuoos.com/EggPlanet/egg_system_rules.git/svc" "code.fnuoos.com/go_rely_warehouse/zyos_go_es.git/es" + "code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git/rabbit" "context" "encoding/json" "fmt" @@ -164,6 +166,15 @@ func Comment(c *gin.Context) { } } + // 推到 es 更新评论次数 + ch, err := rabbit.Cfg.Pool.GetChannel() + if err != nil { + return + } + defer ch.Release() + + ch.Publish(md2.EggAppExchange, md2.EggCommentData{Uid: user.Id}, md2.EggRoutKeyForComment) + e.OutSuc(c, "success", nil) } diff --git a/go.mod b/go.mod index 34fc3a9..8a9361f 100644 --- a/go.mod +++ b/go.mod @@ -34,7 +34,7 @@ require ( require ( code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241225092233-b22661930965 - code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241226083724-d7b4eb9ea3b5 + code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241227092843-802cf07ae61c code.fnuoos.com/go_rely_warehouse/zyos_go_es.git v1.0.1-0.20241118083738-0f22da9ba0be code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5 github.com/aliyun/aliyun-oss-go-sdk v3.0.2+incompatible