feat: add tenant-aware IM management console

This commit is contained in:
richjohnrambo
2026-08-19 00:31:09 +08:00
parent 642b7ec5da
commit 89ba6bcff8
126 changed files with 11941 additions and 339 deletions
@@ -7,7 +7,6 @@ package common
import (
"context"
"github.com/gogf/gf/v2/i18n/gi18n"
"hotgo/api/admin/common"
"hotgo/internal/consts"
"hotgo/internal/library/captcha"
@@ -93,7 +92,7 @@ func (c *cSite) LoginConfig(ctx context.Context, _ *common.SiteLoginConfigReq) (
res.LoginConfig = login
res.I18nSwitch = g.Cfg().MustGet(ctx, "system.i18n.switch", true).Bool()
res.DefaultLanguage = g.Cfg().MustGet(ctx, "system.i18n.defaultLanguage", consts.SysDefaultLanguage).String()
res.ProjectName = gi18n.T(ctx, "HotGo管理系统")
res.ProjectName = "IM办公管理系统"
return
}
@@ -0,0 +1,43 @@
// 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/imauditlog"
"hotgo/internal/model/input/sysin"
"hotgo/internal/service"
)
var ImAuditLog = cImAuditLog{}
type cImAuditLog struct{}
// List 查看IM审计日志列表
func (c *cImAuditLog) List(ctx context.Context, req *imauditlog.ListReq) (res *imauditlog.ListRes, err error) {
list, totalCount, err := service.SysImAuditLog().List(ctx, &req.ImAuditLogListInp)
if err != nil {
return
}
if list == nil {
list = []*sysin.ImAuditLogListModel{}
}
res = new(imauditlog.ListRes)
res.List = list
res.PageRes.Pack(req, totalCount)
return
}
// View 获取指定IM审计日志信息
func (c *cImAuditLog) View(ctx context.Context, req *imauditlog.ViewReq) (res *imauditlog.ViewRes, err error) {
data, err := service.SysImAuditLog().View(ctx, &req.ImAuditLogViewInp)
if err != nil {
return
}
res = new(imauditlog.ViewRes)
res.ImAuditLogViewModel = data
return
}
@@ -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
}
@@ -0,0 +1,76 @@
package sys
import (
"context"
"hotgo/api/admin/iminvite"
"hotgo/internal/model/input/sysin"
"hotgo/internal/service"
)
var ImInvite = cImInvite{}
type cImInvite struct{}
func (c *cImInvite) List(ctx context.Context, req *iminvite.ListReq) (res *iminvite.ListRes, err error) {
list, totalCount, err := service.SysImInvite().List(ctx, &req.ImInviteListInp)
if err != nil {
return
}
if list == nil {
list = []*sysin.ImInviteCodeModel{}
}
res = new(iminvite.ListRes)
res.List = list
res.PageRes.Pack(req, totalCount)
return
}
func (c *cImInvite) Create(ctx context.Context, req *iminvite.CreateReq) (res *iminvite.CreateRes, err error) {
data, err := service.SysImInvite().Create(ctx, &req.ImInviteCreateInp)
if err != nil {
return
}
res = new(iminvite.CreateRes)
res.ImInviteCodeModel = data
return
}
func (c *cImInvite) BatchCreate(ctx context.Context, req *iminvite.BatchCreateReq) (res *iminvite.BatchCreateRes, err error) {
data, err := service.SysImInvite().BatchCreate(ctx, &req.ImInviteBatchCreateInp)
if err != nil {
return
}
res = new(iminvite.BatchCreateRes)
res.ImInviteBatchModel = data
return
}
func (c *cImInvite) BatchView(ctx context.Context, req *iminvite.BatchViewReq) (res *iminvite.BatchViewRes, err error) {
data, err := service.SysImInvite().BatchView(ctx, &req.ImInviteBatchViewInp)
if err != nil {
return
}
res = new(iminvite.BatchViewRes)
res.ImInviteBatchDetailModel = data
return
}
func (c *cImInvite) Revoke(ctx context.Context, req *iminvite.RevokeReq) (res *iminvite.RevokeRes, err error) {
err = service.SysImInvite().Revoke(ctx, &req.ImInviteRevokeInp)
return
}
func (c *cImInvite) BatchRevoke(ctx context.Context, req *iminvite.BatchRevokeReq) (res *iminvite.BatchRevokeRes, err error) {
data, err := service.SysImInvite().BatchRevoke(ctx, &req.ImInviteBatchRevokeInp)
if err != nil {
return
}
res = new(iminvite.BatchRevokeRes)
res.ImInviteBatchModel = data
return
}
func (c *cImInvite) Export(ctx context.Context, req *iminvite.ExportReq) (res *iminvite.ExportRes, err error) {
err = service.SysImInvite().Export(ctx, &req.ImInviteListInp)
return
}
@@ -0,0 +1,53 @@
// 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/imrealname"
"hotgo/internal/model/input/sysin"
"hotgo/internal/service"
)
var (
ImRealname = cImRealname{}
)
type cImRealname struct{}
// List 查看IM实名审核列表
func (c *cImRealname) List(ctx context.Context, req *imrealname.ListReq) (res *imrealname.ListRes, err error) {
list, totalCount, err := service.SysImRealname().List(ctx, &req.ImRealnameListInp)
if err != nil {
return
}
if list == nil {
list = []*sysin.ImRealnameListModel{}
}
res = new(imrealname.ListRes)
res.List = list
res.PageRes.Pack(req, totalCount)
return
}
// View 获取指定IM实名审核信息
func (c *cImRealname) View(ctx context.Context, req *imrealname.ViewReq) (res *imrealname.ViewRes, err error) {
data, err := service.SysImRealname().View(ctx, &req.ImRealnameViewInp)
if err != nil {
return
}
res = new(imrealname.ViewRes)
res.ImRealnameViewModel = data
return
}
// Review 审核IM实名
func (c *cImRealname) Review(ctx context.Context, req *imrealname.ReviewReq) (res *imrealname.ReviewRes, err error) {
err = service.SysImRealname().Review(ctx, &req.ImRealnameReviewInp)
return
}
@@ -0,0 +1,26 @@
package sys
import (
"context"
"hotgo/api/admin/imregistration"
"hotgo/internal/service"
)
var ImRegistration = cImRegistration{}
type cImRegistration struct{}
func (c *cImRegistration) Get(ctx context.Context, req *imregistration.GetReq) (res *imregistration.GetRes, err error) {
data, err := service.SysImRegistration().GetConfig(ctx)
if err != nil {
return
}
res = new(imregistration.GetRes)
res.ImRegistrationConfigModel = data
return
}
func (c *cImRegistration) Update(ctx context.Context, req *imregistration.UpdateReq) (res *imregistration.UpdateRes, err error) {
err = service.SysImRegistration().UpdateConfig(ctx, &req.ImRegistrationConfigUpdateInp)
return
}
@@ -0,0 +1,60 @@
// 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/imtenant"
"hotgo/internal/model/input/sysin"
"hotgo/internal/service"
)
var (
ImTenant = cImTenant{}
)
type cImTenant struct{}
// List 查看IM租户列表
func (c *cImTenant) List(ctx context.Context, req *imtenant.ListReq) (res *imtenant.ListRes, err error) {
list, totalCount, err := service.SysImTenant().List(ctx, &req.ImTenantListInp)
if err != nil {
return
}
if list == nil {
list = []*sysin.ImTenantListModel{}
}
res = new(imtenant.ListRes)
res.List = list
res.PageRes.Pack(req, totalCount)
return
}
// Edit 更新IM租户
func (c *cImTenant) Edit(ctx context.Context, req *imtenant.EditReq) (res *imtenant.EditRes, err error) {
err = service.SysImTenant().Edit(ctx, &req.ImTenantEditInp)
return
}
// View 获取指定IM租户信息
func (c *cImTenant) View(ctx context.Context, req *imtenant.ViewReq) (res *imtenant.ViewRes, err error) {
data, err := service.SysImTenant().View(ctx, &req.ImTenantViewInp)
if err != nil {
return
}
res = new(imtenant.ViewRes)
res.ImTenantViewModel = data
return
}
// Status 更新IM租户状态
func (c *cImTenant) Status(ctx context.Context, req *imtenant.StatusReq) (res *imtenant.StatusRes, err error) {
err = service.SysImTenant().Status(ctx, &req.ImTenantStatusInp)
return
}
@@ -0,0 +1,53 @@
// 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/imuser"
"hotgo/internal/model/input/sysin"
"hotgo/internal/service"
)
var (
ImUser = cImUser{}
)
type cImUser struct{}
// List 查看IM用户列表
func (c *cImUser) List(ctx context.Context, req *imuser.ListReq) (res *imuser.ListRes, err error) {
list, totalCount, err := service.SysImUser().List(ctx, &req.ImUserListInp)
if err != nil {
return
}
if list == nil {
list = []*sysin.ImUserListModel{}
}
res = new(imuser.ListRes)
res.List = list
res.PageRes.Pack(req, totalCount)
return
}
// View 获取指定IM用户信息
func (c *cImUser) View(ctx context.Context, req *imuser.ViewReq) (res *imuser.ViewRes, err error) {
data, err := service.SysImUser().View(ctx, &req.ImUserViewInp)
if err != nil {
return
}
res = new(imuser.ViewRes)
res.ImUserViewModel = data
return
}
func (c *cImUser) ResetPassword(ctx context.Context, req *imuser.ResetPasswordReq) (res *imuser.ResetPasswordRes, err error) {
err = service.SysImUser().ResetPassword(ctx, &req.ImUserPasswordResetInp)
return
}
@@ -0,0 +1,53 @@
// 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/imworkorder"
"hotgo/internal/model/input/sysin"
"hotgo/internal/service"
)
var (
ImWorkOrder = cImWorkOrder{}
)
type cImWorkOrder struct{}
// List 查看IM举报反馈工单列表
func (c *cImWorkOrder) List(ctx context.Context, req *imworkorder.ListReq) (res *imworkorder.ListRes, err error) {
list, totalCount, err := service.SysImWorkOrder().List(ctx, &req.ImWorkOrderListInp)
if err != nil {
return
}
if list == nil {
list = []*sysin.ImWorkOrderListModel{}
}
res = new(imworkorder.ListRes)
res.List = list
res.PageRes.Pack(req, totalCount)
return
}
// View 获取指定IM举报反馈工单信息
func (c *cImWorkOrder) View(ctx context.Context, req *imworkorder.ViewReq) (res *imworkorder.ViewRes, err error) {
data, err := service.SysImWorkOrder().View(ctx, &req.ImWorkOrderViewInp)
if err != nil {
return
}
res = new(imworkorder.ViewRes)
res.ImWorkOrderViewModel = data
return
}
// Status 更新IM举报反馈工单状态
func (c *cImWorkOrder) Status(ctx context.Context, req *imworkorder.StatusReq) (res *imworkorder.StatusRes, err error) {
err = service.SysImWorkOrder().Status(ctx, &req.ImWorkOrderStatusInp)
return
}