feat: add IM admin management
This commit is contained in:
@@ -0,0 +1,151 @@
|
||||
// Package sys
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2026 HotGo
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/imgroup"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
ImGroup = cImGroup{}
|
||||
)
|
||||
|
||||
type cImGroup struct{}
|
||||
|
||||
// List 查看IM群组列表
|
||||
func (c *cImGroup) List(ctx context.Context, req *imgroup.ListReq) (res *imgroup.ListRes, err error) {
|
||||
list, totalCount, err := service.SysImGroup().List(ctx, &req.ImGroupListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if list == nil {
|
||||
list = []*sysin.ImGroupListModel{}
|
||||
}
|
||||
|
||||
res = new(imgroup.ListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定IM群组信息
|
||||
func (c *cImGroup) View(ctx context.Context, req *imgroup.ViewReq) (res *imgroup.ViewRes, err error) {
|
||||
data, err := service.SysImGroup().View(ctx, &req.ImGroupViewInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(imgroup.ViewRes)
|
||||
res.ImGroupViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// MemberList 查看IM群成员列表
|
||||
func (c *cImGroup) MemberList(ctx context.Context, req *imgroup.MemberListReq) (res *imgroup.MemberListRes, err error) {
|
||||
list, totalCount, err := service.SysImGroup().MemberList(ctx, &req.ImGroupMemberListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if list == nil {
|
||||
list = []*sysin.ImGroupMemberListModel{}
|
||||
}
|
||||
|
||||
res = new(imgroup.MemberListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// Governance 获取IM群治理配置
|
||||
func (c *cImGroup) Governance(ctx context.Context, req *imgroup.GovernanceReq) (res *imgroup.GovernanceRes, err error) {
|
||||
data, err := service.SysImGroup().Governance(ctx, &req.ImGroupTopicInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
res = new(imgroup.GovernanceRes)
|
||||
res.ImGroupGovernanceModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// JoinRequestList 查看IM入群申请列表
|
||||
func (c *cImGroup) JoinRequestList(ctx context.Context, req *imgroup.JoinRequestListReq) (res *imgroup.JoinRequestListRes, err error) {
|
||||
list, totalCount, err := service.SysImGroup().JoinRequestList(ctx, &req.ImGroupJoinRequestListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if list == nil {
|
||||
list = []*sysin.ImGroupJoinRequestListModel{}
|
||||
}
|
||||
res = new(imgroup.JoinRequestListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// InvitationList 查看IM群邀请列表
|
||||
func (c *cImGroup) InvitationList(ctx context.Context, req *imgroup.InvitationListReq) (res *imgroup.InvitationListRes, err error) {
|
||||
list, totalCount, err := service.SysImGroup().InvitationList(ctx, &req.ImGroupInvitationListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if list == nil {
|
||||
list = []*sysin.ImGroupInvitationListModel{}
|
||||
}
|
||||
res = new(imgroup.InvitationListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// AnnouncementList 查看IM群公告列表
|
||||
func (c *cImGroup) AnnouncementList(ctx context.Context, req *imgroup.AnnouncementListReq) (res *imgroup.AnnouncementListRes, err error) {
|
||||
list, totalCount, err := service.SysImGroup().AnnouncementList(ctx, &req.ImGroupAnnouncementListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if list == nil {
|
||||
list = []*sysin.ImGroupAnnouncementListModel{}
|
||||
}
|
||||
res = new(imgroup.AnnouncementListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// MuteList 查看IM群禁言列表
|
||||
func (c *cImGroup) MuteList(ctx context.Context, req *imgroup.MuteListReq) (res *imgroup.MuteListRes, err error) {
|
||||
list, totalCount, err := service.SysImGroup().MuteList(ctx, &req.ImGroupMuteListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if list == nil {
|
||||
list = []*sysin.ImGroupMuteListModel{}
|
||||
}
|
||||
res = new(imgroup.MuteListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
|
||||
// AdminLogList 查看IM群管理日志列表
|
||||
func (c *cImGroup) AdminLogList(ctx context.Context, req *imgroup.AdminLogListReq) (res *imgroup.AdminLogListRes, err error) {
|
||||
list, totalCount, err := service.SysImGroup().AdminLogList(ctx, &req.ImGroupAdminLogListInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if list == nil {
|
||||
list = []*sysin.ImGroupAdminLogListModel{}
|
||||
}
|
||||
res = new(imgroup.AdminLogListRes)
|
||||
res.List = list
|
||||
res.PageRes.Pack(req, totalCount)
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user