461 lines
19 KiB
Go
461 lines
19 KiB
Go
// Package sysin
|
|
// @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 sysin
|
|
|
|
import (
|
|
"context"
|
|
"hotgo/internal/model/input/form"
|
|
|
|
"github.com/gogf/gf/v2/errors/gerror"
|
|
"github.com/gogf/gf/v2/os/gtime"
|
|
)
|
|
|
|
// ImGroupListInp 获取IM群组列表
|
|
type ImGroupListInp struct {
|
|
form.PageReq
|
|
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
|
Topic string `json:"topic" dc:"Topic"`
|
|
OwnerId int64 `json:"ownerId" dc:"群主ID"`
|
|
State *int `json:"state" dc:"通信状态"`
|
|
GroupStatus string `json:"groupStatus" dc:"业务状态"`
|
|
CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"`
|
|
TouchedAt []*gtime.Time `json:"touchedAt" dc:"活跃时间"`
|
|
}
|
|
|
|
func (in *ImGroupListInp) Filter(ctx context.Context) (err error) {
|
|
return
|
|
}
|
|
|
|
type ImGroupListModel struct {
|
|
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
|
TenantName string `json:"tenantName" dc:"租户名称"`
|
|
Topic string `json:"topic" dc:"Topic"`
|
|
State int `json:"state" dc:"状态"`
|
|
OwnerId int64 `json:"ownerId" dc:"群主ID"`
|
|
SeqId int `json:"seqId" dc:"最新消息序号"`
|
|
DelId int `json:"delId" dc:"删除序号"`
|
|
SubCnt int `json:"subCnt" dc:"成员数"`
|
|
TouchedAt *gtime.Time `json:"touchedAt" dc:"活跃时间"`
|
|
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
|
|
UpdatedAt *gtime.Time `json:"updatedAt" dc:"修改时间"`
|
|
PublicJson string `json:"publicJson" dc:"公开资料"`
|
|
TrustedJson string `json:"trustedJson" dc:"可信资料"`
|
|
TagsJson string `json:"tagsJson" dc:"标签"`
|
|
AuxJson string `json:"auxJson" dc:"辅助资料"`
|
|
|
|
GroupName string `json:"groupName" dc:"群名称"`
|
|
AvatarFileId string `json:"avatarFileId" dc:"头像文件ID"`
|
|
Description string `json:"description" dc:"简介"`
|
|
GroupStatus string `json:"groupStatus" dc:"业务状态"`
|
|
JoinApproval int `json:"joinApproval" dc:"入群审批"`
|
|
MuteAll int `json:"muteAll" dc:"全员禁言"`
|
|
MemberUploadFiles int `json:"memberUploadFiles" dc:"成员上传文件"`
|
|
MemberPrivateChat int `json:"memberPrivateChat" dc:"成员私聊"`
|
|
MemberInvite int `json:"memberInvite" dc:"成员邀请"`
|
|
MaxMemberCount int `json:"maxMemberCount" dc:"最大成员数"`
|
|
MaxAdminCount int `json:"maxAdminCount" dc:"最大管理员数"`
|
|
BusinessMemberCount int `json:"businessMemberCount" dc:"业务成员数"`
|
|
SettingsVersion int `json:"settingsVersion" dc:"治理配置版本"`
|
|
SettingsUpdatedAt *gtime.Time `json:"settingsUpdatedAt" dc:"治理配置更新时间"`
|
|
}
|
|
|
|
// ImGroupViewInp 获取指定IM群组信息
|
|
type ImGroupViewInp struct {
|
|
TenantId int64 `json:"tenantId" v:"required#租户ID不能为空" dc:"租户ID"`
|
|
Topic string `json:"topic" v:"required#Topic不能为空" dc:"Topic"`
|
|
}
|
|
|
|
func (in *ImGroupViewInp) Filter(ctx context.Context) (err error) {
|
|
if in.Topic == "" {
|
|
return gerror.New("Topic不能为空")
|
|
}
|
|
return
|
|
}
|
|
|
|
type ImGroupViewModel struct {
|
|
ImGroupListModel
|
|
AccessJson string `json:"accessJson" dc:"访问权限"`
|
|
UseBt int `json:"useBt" dc:"是否开启BT"`
|
|
}
|
|
|
|
// ImGroupMemberListInp 获取IM群成员列表
|
|
type ImGroupMemberListInp struct {
|
|
form.PageReq
|
|
TenantId int64 `json:"tenantId" v:"required#租户ID不能为空" dc:"租户ID"`
|
|
Topic string `json:"topic" v:"required#Topic不能为空" dc:"Topic"`
|
|
UserId int64 `json:"userId" dc:"用户ID"`
|
|
Role string `json:"role" dc:"角色"`
|
|
MemberStatus string `json:"memberStatus" dc:"成员状态"`
|
|
}
|
|
|
|
func (in *ImGroupMemberListInp) Filter(ctx context.Context) (err error) {
|
|
if in.Topic == "" {
|
|
return gerror.New("Topic不能为空")
|
|
}
|
|
return
|
|
}
|
|
|
|
type ImGroupMemberListModel struct {
|
|
UserId int64 `json:"userId" dc:"用户ID"`
|
|
Nickname string `json:"nickname" dc:"昵称"`
|
|
State int `json:"state" dc:"用户状态"`
|
|
ModeWant string `json:"modeWant" dc:"期望权限"`
|
|
ModeGiven string `json:"modeGiven" dc:"授予权限"`
|
|
RecvSeqId int `json:"recvSeqId" dc:"接收序号"`
|
|
ReadSeqId int `json:"readSeqId" dc:"已读序号"`
|
|
DelId int `json:"delId" dc:"删除序号"`
|
|
DeletedAt *gtime.Time `json:"deletedAt" dc:"删除时间"`
|
|
CreatedAt *gtime.Time `json:"createdAt" dc:"加入时间"`
|
|
UpdatedAt *gtime.Time `json:"updatedAt" dc:"修改时间"`
|
|
PrivateJson string `json:"privateJson" dc:"私有资料"`
|
|
Role string `json:"role" dc:"业务角色"`
|
|
MemberStatus string `json:"memberStatus" dc:"业务状态"`
|
|
GroupNickname string `json:"groupNickname" dc:"群昵称"`
|
|
Pinned int `json:"pinned" dc:"置顶"`
|
|
MuteNotifications int `json:"muteNotifications" dc:"免打扰"`
|
|
JoinSource string `json:"joinSource" dc:"加入来源"`
|
|
JoinedBy int64 `json:"joinedBy" dc:"邀请/处理人"`
|
|
JoinedAt *gtime.Time `json:"joinedAt" dc:"业务加入时间"`
|
|
LeftAt *gtime.Time `json:"leftAt" dc:"离开时间"`
|
|
RemovedBy int64 `json:"removedBy" dc:"移除人"`
|
|
Version int `json:"version" dc:"版本"`
|
|
}
|
|
|
|
// ImGroupTopicInp 群Topic通用入参
|
|
type ImGroupTopicInp struct {
|
|
TenantId int64 `json:"tenantId" v:"required#租户ID不能为空" dc:"租户ID"`
|
|
Topic string `json:"topic" v:"required#Topic不能为空" dc:"Topic"`
|
|
}
|
|
|
|
func (in *ImGroupTopicInp) Filter(ctx context.Context) (err error) {
|
|
if in.Topic == "" {
|
|
return gerror.New("Topic不能为空")
|
|
}
|
|
return
|
|
}
|
|
|
|
type ImGroupGovernanceModel struct {
|
|
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
|
TenantName string `json:"tenantName" dc:"租户名称"`
|
|
Topic string `json:"topic" dc:"Topic"`
|
|
OwnerUserId int64 `json:"ownerUserId" dc:"群主ID"`
|
|
Name string `json:"name" dc:"群名称"`
|
|
AvatarFileId string `json:"avatarFileId" dc:"头像文件ID"`
|
|
Description string `json:"description" dc:"简介"`
|
|
GroupStatus string `json:"groupStatus" dc:"业务状态"`
|
|
JoinApproval int `json:"joinApproval" dc:"入群审批"`
|
|
MuteAll int `json:"muteAll" dc:"全员禁言"`
|
|
MemberUploadFiles int `json:"memberUploadFiles" dc:"成员上传文件"`
|
|
MemberPrivateChat int `json:"memberPrivateChat" dc:"成员私聊"`
|
|
MemberInvite int `json:"memberInvite" dc:"成员邀请"`
|
|
MaxMemberCount int `json:"maxMemberCount" dc:"最大成员数"`
|
|
MaxAdminCount int `json:"maxAdminCount" dc:"最大管理员数"`
|
|
MemberCount int `json:"memberCount" dc:"成员数"`
|
|
Version int `json:"version" dc:"版本"`
|
|
CreatedBy int64 `json:"createdBy" dc:"创建人"`
|
|
DissolvedBy int64 `json:"dissolvedBy" dc:"解散人"`
|
|
DissolvedAt *gtime.Time `json:"dissolvedAt" dc:"解散时间"`
|
|
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
|
|
UpdatedAt *gtime.Time `json:"updatedAt" dc:"修改时间"`
|
|
}
|
|
|
|
type ImGroupGovernanceUpdateInp struct {
|
|
ImGroupTopicInp
|
|
JoinApproval int `json:"joinApproval" dc:"入群审批"`
|
|
MuteAll int `json:"muteAll" dc:"全员禁言"`
|
|
MemberUploadFiles int `json:"memberUploadFiles" dc:"成员上传文件"`
|
|
MemberPrivateChat int `json:"memberPrivateChat" dc:"成员私聊"`
|
|
MemberInvite int `json:"memberInvite" dc:"成员邀请"`
|
|
MaxMemberCount int `json:"maxMemberCount" dc:"最大成员数"`
|
|
MaxAdminCount int `json:"maxAdminCount" dc:"最大管理员数"`
|
|
}
|
|
|
|
func (in *ImGroupGovernanceUpdateInp) Filter(ctx context.Context) (err error) {
|
|
if err = in.ImGroupTopicInp.Filter(ctx); err != nil {
|
|
return
|
|
}
|
|
if in.JoinApproval != 0 && in.JoinApproval != 1 {
|
|
return gerror.New("入群审批值不正确")
|
|
}
|
|
if in.MuteAll != 0 && in.MuteAll != 1 {
|
|
return gerror.New("全员禁言值不正确")
|
|
}
|
|
if in.MemberUploadFiles != 0 && in.MemberUploadFiles != 1 {
|
|
return gerror.New("成员上传文件值不正确")
|
|
}
|
|
if in.MemberPrivateChat != 0 && in.MemberPrivateChat != 1 {
|
|
return gerror.New("成员私聊值不正确")
|
|
}
|
|
if in.MemberInvite != 0 && in.MemberInvite != 1 {
|
|
return gerror.New("成员邀请值不正确")
|
|
}
|
|
if in.MaxMemberCount < 0 || in.MaxAdminCount < 0 {
|
|
return gerror.New("人数上限不能小于0")
|
|
}
|
|
return
|
|
}
|
|
|
|
type ImGroupDissolveInp struct {
|
|
ImGroupTopicInp
|
|
Reason string `json:"reason" dc:"解散原因"`
|
|
}
|
|
|
|
func (in *ImGroupDissolveInp) Filter(ctx context.Context) (err error) {
|
|
if err = in.ImGroupTopicInp.Filter(ctx); err != nil {
|
|
return
|
|
}
|
|
if len([]rune(in.Reason)) > 200 {
|
|
return gerror.New("解散原因不能超过200个字符")
|
|
}
|
|
return
|
|
}
|
|
|
|
type ImGroupMuteInp struct {
|
|
ImGroupTopicInp
|
|
UserId int64 `json:"userId" v:"required#用户ID不能为空" dc:"用户ID"`
|
|
ExpiresAt *gtime.Time `json:"expiresAt" dc:"过期时间"`
|
|
Reason string `json:"reason" dc:"禁言原因"`
|
|
}
|
|
|
|
func (in *ImGroupMuteInp) Filter(ctx context.Context) (err error) {
|
|
if err = in.ImGroupTopicInp.Filter(ctx); err != nil {
|
|
return
|
|
}
|
|
if in.UserId <= 0 {
|
|
return gerror.New("用户ID不能为空")
|
|
}
|
|
if len([]rune(in.Reason)) > 200 {
|
|
return gerror.New("禁言原因不能超过200个字符")
|
|
}
|
|
return
|
|
}
|
|
|
|
type ImGroupUnmuteInp struct {
|
|
ImGroupTopicInp
|
|
UserId int64 `json:"userId" v:"required#用户ID不能为空" dc:"用户ID"`
|
|
}
|
|
|
|
func (in *ImGroupUnmuteInp) Filter(ctx context.Context) (err error) {
|
|
if err = in.ImGroupTopicInp.Filter(ctx); err != nil {
|
|
return
|
|
}
|
|
if in.UserId <= 0 {
|
|
return gerror.New("用户ID不能为空")
|
|
}
|
|
return
|
|
}
|
|
|
|
type ImGroupJoinRequestResolveInp struct {
|
|
ImGroupTopicInp
|
|
RequestId string `json:"requestId" v:"required#申请ID不能为空" dc:"申请ID"`
|
|
RejectReason string `json:"rejectReason" dc:"拒绝原因"`
|
|
}
|
|
|
|
func (in *ImGroupJoinRequestResolveInp) Filter(ctx context.Context) (err error) {
|
|
if err = in.ImGroupTopicInp.Filter(ctx); err != nil {
|
|
return
|
|
}
|
|
if in.RequestId == "" {
|
|
return gerror.New("申请ID不能为空")
|
|
}
|
|
if len([]rune(in.RejectReason)) > 200 {
|
|
return gerror.New("拒绝原因不能超过200个字符")
|
|
}
|
|
return
|
|
}
|
|
|
|
type ImGroupRoleUpdateInp struct {
|
|
ImGroupTopicInp
|
|
UserId int64 `json:"userId" v:"required#用户ID不能为空" dc:"用户ID"`
|
|
Role string `json:"role" v:"required#角色不能为空" dc:"角色"`
|
|
}
|
|
|
|
func (in *ImGroupRoleUpdateInp) Filter(ctx context.Context) (err error) {
|
|
if err = in.ImGroupTopicInp.Filter(ctx); err != nil {
|
|
return
|
|
}
|
|
if in.UserId <= 0 {
|
|
return gerror.New("用户ID不能为空")
|
|
}
|
|
if in.Role == "" {
|
|
return gerror.New("角色不能为空")
|
|
}
|
|
return
|
|
}
|
|
|
|
type ImGroupOwnerTransferInp struct {
|
|
ImGroupTopicInp
|
|
UserId int64 `json:"userId" v:"required#新群主ID不能为空" dc:"新群主ID"`
|
|
}
|
|
|
|
func (in *ImGroupOwnerTransferInp) Filter(ctx context.Context) (err error) {
|
|
if err = in.ImGroupTopicInp.Filter(ctx); err != nil {
|
|
return
|
|
}
|
|
if in.UserId <= 0 {
|
|
return gerror.New("新群主ID不能为空")
|
|
}
|
|
return
|
|
}
|
|
|
|
type ImGroupJoinRequestListInp struct {
|
|
form.PageReq
|
|
ImGroupTopicInp
|
|
Status string `json:"status" dc:"状态"`
|
|
ApplicantUserId int64 `json:"applicantUserId" dc:"申请人ID"`
|
|
}
|
|
|
|
type ImGroupJoinRequestListModel struct {
|
|
Id int64 `json:"id" dc:"ID"`
|
|
RequestId string `json:"requestId" dc:"申请ID"`
|
|
Topic string `json:"topic" dc:"Topic"`
|
|
ApplicantUserId int64 `json:"applicantUserId" dc:"申请人ID"`
|
|
InviterUserId int64 `json:"inviterUserId" dc:"邀请人ID"`
|
|
Source string `json:"source" dc:"来源"`
|
|
Message string `json:"message" dc:"申请消息"`
|
|
Status string `json:"status" dc:"状态"`
|
|
RejectReason string `json:"rejectReason" dc:"拒绝原因"`
|
|
HandledBy int64 `json:"handledBy" dc:"处理人"`
|
|
HandledAt *gtime.Time `json:"handledAt" dc:"处理时间"`
|
|
ExpiresAt *gtime.Time `json:"expiresAt" dc:"过期时间"`
|
|
Version int `json:"version" dc:"版本"`
|
|
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
|
|
UpdatedAt *gtime.Time `json:"updatedAt" dc:"修改时间"`
|
|
}
|
|
|
|
type ImGroupFileListInp struct {
|
|
form.PageReq
|
|
ImGroupTopicInp
|
|
Status string `json:"status" dc:"状态"`
|
|
FileType string `json:"fileType" dc:"文件类型"`
|
|
FileName string `json:"fileName" dc:"文件名"`
|
|
UploaderId int64 `json:"uploaderId" dc:"上传人ID"`
|
|
}
|
|
|
|
type ImGroupFileListModel struct {
|
|
Id int64 `json:"id" dc:"ID"`
|
|
GroupFileId string `json:"groupFileId" dc:"群文件ID"`
|
|
Topic string `json:"topic" dc:"Topic"`
|
|
FileId string `json:"fileId" dc:"文件ID"`
|
|
SourceTopic string `json:"sourceTopic" dc:"来源Topic"`
|
|
SourceSeq int `json:"sourceSeq" dc:"来源消息序号"`
|
|
UploaderId int64 `json:"uploaderId" dc:"上传人ID"`
|
|
FileName string `json:"fileName" dc:"文件名"`
|
|
MimeType string `json:"mimeType" dc:"MIME类型"`
|
|
FileType string `json:"fileType" dc:"文件类型"`
|
|
FileSize int64 `json:"fileSize" dc:"文件大小"`
|
|
Status string `json:"status" dc:"状态"`
|
|
DeletedBy int64 `json:"deletedBy" dc:"删除人"`
|
|
DeletedAt *gtime.Time `json:"deletedAt" dc:"删除时间"`
|
|
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
|
|
UpdatedAt *gtime.Time `json:"updatedAt" dc:"修改时间"`
|
|
}
|
|
|
|
type ImGroupFileDeleteInp struct {
|
|
ImGroupTopicInp
|
|
GroupFileId string `json:"groupFileId" v:"required#群文件ID不能为空" dc:"群文件ID"`
|
|
}
|
|
|
|
func (in *ImGroupFileDeleteInp) Filter(ctx context.Context) (err error) {
|
|
if err = in.ImGroupTopicInp.Filter(ctx); err != nil {
|
|
return
|
|
}
|
|
if in.GroupFileId == "" {
|
|
return gerror.New("群文件ID不能为空")
|
|
}
|
|
return
|
|
}
|
|
|
|
type ImGroupInvitationListInp struct {
|
|
form.PageReq
|
|
ImGroupTopicInp
|
|
Status string `json:"status" dc:"状态"`
|
|
TargetUserId int64 `json:"targetUserId" dc:"目标用户ID"`
|
|
InviterUserId int64 `json:"inviterUserId" dc:"邀请人ID"`
|
|
}
|
|
|
|
type ImGroupInvitationListModel struct {
|
|
Id int64 `json:"id" dc:"ID"`
|
|
InvitationId string `json:"invitationId" dc:"邀请ID"`
|
|
Topic string `json:"topic" dc:"Topic"`
|
|
InviterUserId int64 `json:"inviterUserId" dc:"邀请人ID"`
|
|
TargetUserId int64 `json:"targetUserId" dc:"目标用户ID"`
|
|
Message string `json:"message" dc:"邀请消息"`
|
|
Status string `json:"status" dc:"状态"`
|
|
Result string `json:"result" dc:"结果"`
|
|
JoinRequestId string `json:"joinRequestId" dc:"入群申请ID"`
|
|
ExpiresAt *gtime.Time `json:"expiresAt" dc:"过期时间"`
|
|
HandledAt *gtime.Time `json:"handledAt" dc:"处理时间"`
|
|
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
|
|
UpdatedAt *gtime.Time `json:"updatedAt" dc:"修改时间"`
|
|
}
|
|
|
|
type ImGroupAnnouncementListInp struct {
|
|
form.PageReq
|
|
ImGroupTopicInp
|
|
Status string `json:"status" dc:"状态"`
|
|
}
|
|
|
|
type ImGroupAnnouncementListModel struct {
|
|
Id int64 `json:"id" dc:"ID"`
|
|
AnnouncementId string `json:"announcementId" dc:"公告ID"`
|
|
Topic string `json:"topic" dc:"Topic"`
|
|
AuthorUserId int64 `json:"authorUserId" dc:"发布人ID"`
|
|
Content string `json:"content" dc:"内容"`
|
|
Status string `json:"status" dc:"状态"`
|
|
Version int `json:"version" dc:"版本"`
|
|
PublishedAt *gtime.Time `json:"publishedAt" dc:"发布时间"`
|
|
DeletedBy int64 `json:"deletedBy" dc:"删除人"`
|
|
DeletedAt *gtime.Time `json:"deletedAt" dc:"删除时间"`
|
|
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
|
|
UpdatedAt *gtime.Time `json:"updatedAt" dc:"修改时间"`
|
|
}
|
|
|
|
type ImGroupMuteListInp struct {
|
|
form.PageReq
|
|
ImGroupTopicInp
|
|
Status string `json:"status" dc:"状态"`
|
|
UserId int64 `json:"userId" dc:"用户ID"`
|
|
}
|
|
|
|
type ImGroupMuteListModel struct {
|
|
Topic string `json:"topic" dc:"Topic"`
|
|
UserId int64 `json:"userId" dc:"用户ID"`
|
|
MutedBy int64 `json:"mutedBy" dc:"禁言人"`
|
|
MutedAt *gtime.Time `json:"mutedAt" dc:"禁言时间"`
|
|
ExpiresAt *gtime.Time `json:"expiresAt" dc:"过期时间"`
|
|
Reason string `json:"reason" dc:"原因"`
|
|
Status string `json:"status" dc:"状态"`
|
|
RevokedBy int64 `json:"revokedBy" dc:"解除人"`
|
|
RevokedAt *gtime.Time `json:"revokedAt" dc:"解除时间"`
|
|
Version int `json:"version" dc:"版本"`
|
|
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
|
|
UpdatedAt *gtime.Time `json:"updatedAt" dc:"修改时间"`
|
|
}
|
|
|
|
type ImGroupAdminLogListInp struct {
|
|
form.PageReq
|
|
ImGroupTopicInp
|
|
Action string `json:"action" dc:"动作"`
|
|
OperatorId int64 `json:"operatorId" dc:"操作人ID"`
|
|
}
|
|
|
|
type ImGroupAdminLogListModel struct {
|
|
Id int64 `json:"id" dc:"ID"`
|
|
LogId string `json:"logId" dc:"日志ID"`
|
|
Topic string `json:"topic" dc:"Topic"`
|
|
OperatorId int64 `json:"operatorId" dc:"操作人"`
|
|
TargetUserId int64 `json:"targetUserId" dc:"目标用户"`
|
|
Action string `json:"action" dc:"动作"`
|
|
ObjectType string `json:"objectType" dc:"对象类型"`
|
|
ObjectId string `json:"objectId" dc:"对象ID"`
|
|
BeforeData string `json:"beforeData" dc:"变更前"`
|
|
AfterData string `json:"afterData" dc:"变更后"`
|
|
RequestId string `json:"requestId" dc:"请求ID"`
|
|
IdempotencyKey string `json:"idempotencyKey" dc:"幂等键"`
|
|
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
|
|
}
|