feat: add IM file policy and org exports

This commit is contained in:
richjohnrambo
2026-08-21 23:07:06 +08:00
parent 204f96e07a
commit 5c3f6ae58d
19 changed files with 912 additions and 3 deletions
@@ -0,0 +1,75 @@
package sysin
import (
"context"
"hotgo/internal/consts"
"hotgo/internal/library/dict"
"hotgo/internal/model/input/form"
"strings"
"github.com/gogf/gf/v2/encoding/gjson"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/os/gtime"
)
type ImFilePolicyListInp struct {
form.PageReq
TenantId int64 `json:"tenantId" dc:"租户ID"`
Purpose string `json:"purpose" dc:"用途"`
AutoCleanup *int `json:"autoCleanup" dc:"自动清理"`
ScanEnabled *int `json:"scanEnabled" dc:"病毒扫描"`
}
func (in *ImFilePolicyListInp) Filter(ctx context.Context) (err error) { return }
type ImFilePolicyListModel struct {
TenantId int64 `json:"tenantId" dc:"租户ID"`
TenantName string `json:"tenantName" dc:"租户名称"`
Id int64 `json:"id" dc:"ID"`
Purpose string `json:"purpose" dc:"用途"`
MaxSize int64 `json:"maxSize" dc:"单文件大小上限"`
RetentionDays int `json:"retentionDays" dc:"保留天数"`
AllowedMimes string `json:"allowedMimes" dc:"允许MIME JSON"`
AutoCleanup int `json:"autoCleanup" dc:"自动清理"`
ScanEnabled int `json:"scanEnabled" dc:"病毒扫描"`
Remark string `json:"remark" dc:"备注"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"`
}
type ImFilePolicyUpdateInp struct {
TenantId int64 `json:"tenantId" dc:"租户ID"`
Purpose string `json:"purpose" v:"required#用途不能为空" dc:"用途"`
MaxSize int64 `json:"maxSize" dc:"单文件大小上限"`
RetentionDays int `json:"retentionDays" dc:"保留天数"`
AllowedMimes *gjson.Json `json:"allowedMimes" dc:"允许MIME JSON"`
AutoCleanup int `json:"autoCleanup" dc:"自动清理"`
ScanEnabled int `json:"scanEnabled" dc:"病毒扫描"`
Remark string `json:"remark" dc:"备注"`
}
func (in *ImFilePolicyUpdateInp) Filter(ctx context.Context) (err error) {
in.Purpose = strings.TrimSpace(in.Purpose)
in.Remark = strings.TrimSpace(in.Remark)
if !dict.HasOptionKey(consts.ImFilePurposeOptions, in.Purpose) {
return gerror.New("文件用途不合法")
}
if in.Purpose == consts.ImFilePurposeUnknown || in.Purpose == consts.ImFilePurposeOrphan {
return gerror.New("该文件用途不允许配置策略")
}
if in.MaxSize <= 0 {
return gerror.New("单文件大小上限必须大于0")
}
if in.RetentionDays < 0 {
return gerror.New("保留天数不能小于0")
}
if !dict.HasOptionKey(consts.ImFilePolicySwitchOptions, in.AutoCleanup) {
return gerror.New("自动清理开关不合法")
}
if !dict.HasOptionKey(consts.ImFilePolicySwitchOptions, in.ScanEnabled) {
return gerror.New("病毒扫描开关不合法")
}
if len([]rune(in.Remark)) > 200 {
return gerror.New("备注不能超过200个字符")
}
return nil
}
@@ -38,6 +38,20 @@ type ImOrgDepartmentModel struct {
UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"`
}
type ImOrgDepartmentExportModel struct {
TenantName string `json:"tenantName" dc:"租户名称"`
DepartmentId string `json:"departmentId" dc:"部门ID"`
Name string `json:"name" dc:"部门名称"`
ParentId string `json:"parentId" dc:"上级部门ID"`
SortOrder int `json:"sortOrder" dc:"排序"`
Version int `json:"version" dc:"版本"`
State string `json:"state" dc:"状态"`
ChildCount int `json:"childCount" dc:"子部门数"`
MemberCount int `json:"memberCount" dc:"成员数"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"`
}
type ImOrgDepartmentEditInp struct {
TenantId int64 `json:"tenantId" dc:"租户ID"`
Id int64 `json:"id" dc:"ID"`
@@ -112,6 +126,23 @@ type ImOrgMemberModel struct {
UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"`
}
type ImOrgMemberExportModel struct {
TenantName string `json:"tenantName" dc:"租户名称"`
DepartmentId string `json:"departmentId" dc:"部门ID"`
DepartmentName string `json:"departmentName" dc:"部门名称"`
UserId int64 `json:"userId" dc:"用户ID"`
DisplayName string `json:"displayName" dc:"展示名称"`
Position string `json:"position" dc:"岗位"`
Mobile string `json:"mobile" dc:"手机号"`
Email string `json:"email" dc:"邮箱"`
EmploymentState string `json:"employmentState" dc:"在职状态"`
Contactable int `json:"contactable" dc:"是否可联系"`
SortOrder int `json:"sortOrder" dc:"排序"`
Version int `json:"version" dc:"版本"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"`
}
type ImOrgMemberEditInp struct {
TenantId int64 `json:"tenantId" dc:"租户ID"`
Id int64 `json:"id" dc:"ID"`