package logic import ( "app.yhyue.com/moapp/jybase/common" "app.yhyue.com/moapp/jybase/encrypt" "context" "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/internal/svc" "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/messagecenter" "github.com/zeromicro/go-zero/core/logx" ) type ChatGroupListLogic struct { ctx context.Context svcCtx *svc.ServiceContext logx.Logger } func NewChatGroupListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ChatGroupListLogic { return &ChatGroupListLogic{ ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx), } } // 群组列表查询 func (l *ChatGroupListLogic) ChatGroupList(in *messagecenter.ChatGroupListReq) (*messagecenter.ChatGroupListResp, error) { // todo: add your logic here and delete this line data := ChatGroup.ChatGroupList(in.EntId, in.PositionId, in.UserName, in.GroupName, in.AppId) chatGroupList := []*messagecenter.ChatGroupList{} if len(data) > 0 { for _, v := range data { chatGroupId := encrypt.SE.Encode2Hex(common.InterfaceToStr(v["chatGroupId"])) chatGroup := messagecenter.ChatGroupList{ GroupName: common.ObjToString(v["name"]), PersonCount: common.Int64All(v["count"]), ChatGroupId: chatGroupId, } chatGroupList = append(chatGroupList, &chatGroup) } } return &messagecenter.ChatGroupListResp{ ErrorCode: 0, Data: chatGroupList, }, nil }