BillionMail gives you open-source MailServer, NewsLetter, Email Marketing — fully self-hosted, dev-friendly, and free from monthly fees. Join the discord: https://discord.gg/asfXzBUhZr
Add group name to the tags list
lotka4938e53d4da
diff --git a/core/internal/controller/tags/tags_v1_tag_list.go b/core/internal/controller/tags/tags_v1_tag_list.goindex c300d018..354f345d 100644--- a/core/internal/controller/tags/tags_v1_tag_list.go+++ b/core/internal/controller/tags/tags_v1_tag_list.go@@ -3,6 +3,7 @@ package tagsimport ("billionmail-core/api/tags/v1""billionmail-core/internal/model/entity"+ "billionmail-core/internal/service/contact""billionmail-core/internal/service/public""context""github.com/gogf/gf/v2/frame/g"@@ -34,6 +35,19 @@ func (c *ControllerV1) TagList(ctx context.Context, req *v1.TagListReq) (res *v1return nil, err}+ for _, tag := range tagList {++ // check if group exists+ GroupInfo, err := contact.GetGroup(ctx, tag.GroupId)++ if err != nil || GroupInfo == nil {+ tag.GroupName = "Unknown"+ } else {+ tag.GroupName = GroupInfo.Name+ }++ }+res.Data.Total = totalres.Data.List = tagListres.SetSuccess(public.LangCtx(ctx, "Get tag list successfully"))diff --git a/core/internal/model/entity/batch_mail.go b/core/internal/model/entity/batch_mail.goindex a146eda6..1d2ea05c 100644--- a/core/internal/model/entity/batch_mail.go+++ b/core/internal/model/entity/batch_mail.go@@ -181,6 +181,7 @@ type ApiMailLogs struct {type Tag struct {Id int `json:"id" dc:"Tag ID"`GroupId int `json:"group_id" dc:"Group ID"`+ GroupName string `json:"group_name" dc:"Group Name"`Name string `json:"name" dc:"Tag Name"`CreateTime int `json:"create_time" dc:"Create Time"`}