From 2b03b57b5cd1e53be23356a3a6513ebe2da9bd06 Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Fri, 1 Apr 2022 15:59:49 +0800 Subject: [PATCH] tag and set private tips --- internal/api/office/tag.go | 12 ++++++++++-- internal/rpc/office/office.go | 6 ++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/internal/api/office/tag.go b/internal/api/office/tag.go index a1229ed83..2471ddd87 100644 --- a/internal/api/office/tag.go +++ b/internal/api/office/tag.go @@ -46,7 +46,11 @@ func GetUserTags(c *gin.Context) { if err := utils.CopyStructFields(&resp.CommResp, respPb.CommonResp); err != nil { log.NewError(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error()) } - resp.Data.Tags = respPb.Tags + if respPb.Tags != nil { + resp.Data.Tags = respPb.Tags + } else { + resp.Data.Tags = []*pbOffice.Tag{} + } c.JSON(http.StatusOK, resp) } @@ -229,7 +233,11 @@ func GetTagSendLogs(c *gin.Context) { if err := utils.CopyStructFields(&resp.CommResp, respPb.CommonResp); err != nil { log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error()) } - resp.Data.Logs = respPb.TagSendLogs + if respPb.TagSendLogs != nil { + resp.Data.Logs = respPb.TagSendLogs + } else { + resp.Data.Logs = []*pbOffice.TagSendLog{} + } resp.Data.ShowNumber = respPb.Pagination.ShowNumber resp.Data.CurrentPage = respPb.Pagination.CurrentPage c.JSON(http.StatusOK, resp) diff --git a/internal/rpc/office/office.go b/internal/rpc/office/office.go index bab3ff924..b390b99bc 100644 --- a/internal/rpc/office/office.go +++ b/internal/rpc/office/office.go @@ -70,9 +70,8 @@ func (s *officeServer) GetUserTags(_ context.Context, req *pbOffice.GetUserTagsR log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req ", req.String()) resp = &pbOffice.GetUserTagsResp{ CommonResp: &pbOffice.CommonResp{}, - //Tags: []*pbOffice.Tag{}, + Tags: []*pbOffice.Tag{}, } - resp.Tags = make([]*pbOffice.Tag, 0) tags, err := db.DB.GetUserTags(req.UserID) if err != nil { log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetUserTags failed", err.Error()) @@ -217,9 +216,8 @@ func (s *officeServer) GetTagSendLogs(_ context.Context, req *pbOffice.GetTagSen CurrentPage: req.Pagination.PageNumber, ShowNumber: req.Pagination.ShowNumber, }, - //TagSendLogs: []*pbOffice.TagSendLog{}, + TagSendLogs: []*pbOffice.TagSendLog{}, } - resp.TagSendLogs = make([]*pbOffice.TagSendLog, 0) tagSendLogs, err := db.DB.GetTagSendLogs(req.UserID, req.Pagination.ShowNumber, req.Pagination.PageNumber) if err != nil { log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetTagSendLogs", err.Error())