From 61e03c5eec0d59e2b395afb26452e2d1e3745552 Mon Sep 17 00:00:00 2001 From: dengbiao Date: Mon, 2 Dec 2024 21:24:53 +0800 Subject: [PATCH] update --- md/es.go | 30 ++++++++++++++++++++++++++---- svc/svc_es.go | 21 +++++++++++++++++++++ 2 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 svc/svc_es.go diff --git a/md/es.go b/md/es.go index 0c0cabe..2b4fd93 100644 --- a/md/es.go +++ b/md/es.go @@ -138,6 +138,9 @@ const EggFriendCircleEsMapping = ` }, "state":{ "type": "short" + }, + "is_praise":{ + "type": "short" }, "is_top_up":{ "type": "short" @@ -163,14 +166,15 @@ type EggFriendCircleEs struct { LikesNums int `json:"likes_nums" label:"点赞数"` ShareNums int `json:"share_nums" label:"分享数"` CommentNums int `json:"comment_nums" label:"评论数"` - Sate int32 `json:"state" label:"状态(1:正常 2:隐藏)"` + State int32 `json:"state" label:"状态(1:正常 2:隐藏)"` IsTopUp int32 `json:"is_top_up" label:"是否置顶(1:是 2:否)"` + IsPraise int32 `json:"is_praise" label:"是否被表扬(1:是 2:否)"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` } const EggFriendCircleCommentEsAlias = "egg_friend_circle_comment" -const EggFriendCircleCommentEsIndex = "egg_friend_circle_comment_1" +const EggFriendCircleCommentEsIndex = "egg_friend_circle_comment_" const EggFriendCircleCommentEsMapping = ` { "settings" : { @@ -188,11 +192,17 @@ const EggFriendCircleCommentEsMapping = ` "circle_id":{ "type": "integer" }, + "comment_id":{ + "type": "integer" + }, "content":{ - "type": "keyword", + "type": "keyword" }, "kind":{ - "type": "short", + "type": "short" + }, + "is_praise":{ + "type": "short" }, "state":{ "type": "short" @@ -208,3 +218,15 @@ const EggFriendCircleCommentEsMapping = ` } } }` + +type EggFriendCircleCommentEs struct { + Uid int64 `json:"uid" label:"uid"` + Kind int32 `json:"kind" label:"类型(1:普通 2:官方)"` + CircleId int64 `json:"circle_id" label:"朋友圈id"` + CommentId int64 `json:"comment_id" label:"评论id"` + Content string `json:"content" label:"文本内容"` + State int32 `json:"state" label:"状态(1:正常 2:隐藏)"` + IsPraise int32 `json:"is_praise" label:"是否被表扬(1:是 2:否)"` + CreatedAt string `json:"created_at"` + UpdatedAt string `json:"updated_at"` +} diff --git a/svc/svc_es.go b/svc/svc_es.go new file mode 100644 index 0000000..7f2296c --- /dev/null +++ b/svc/svc_es.go @@ -0,0 +1,21 @@ +package svc + +import ( + "code.fnuoos.com/EggPlanet/egg_system_rules.git/md" + egg_system_rules "code.fnuoos.com/EggPlanet/egg_system_rules.git/utils" + "strconv" + "time" +) + +func GetEggFriendCircleCommentEsIndex(userId int64) string { + return md.EggFriendCircleCommentEsIndex + GetUserIdSuffix(userId) +} +func GetEggFriendCircleCommentEsIndexId(userId int64, circleId string) string { + return circleId + "_" + strconv.FormatInt(userId, 10) + "_" + egg_system_rules.Int64ToStr(time.Now().Unix()) +} + +func GetUserIdSuffix(userId int64) string { + numberStr := strconv.FormatInt(userId, 10) // 将数字转换为字符串 + lastChar := numberStr[len(numberStr)-1] // 获取最后一个字符 + return strconv.Itoa(int(lastChar)) +}