fix
This commit is contained in:
@@ -6,7 +6,6 @@ type apiMetadataValue struct{ group, description string }
|
||||
|
||||
var apiMetadata = map[string]apiMetadataValue{
|
||||
"DELETE /api/deleteApisByIds": {group: "api", description: "批量删除api"},
|
||||
"DELETE /customer/customer": {group: "客户", description: "删除客户"},
|
||||
"DELETE /dataAccessLog/deleteDataAccessLogByIds": {group: "数据权限审计", description: "批量删除数据权限审计日志"},
|
||||
"DELETE /department/deleteDepartment": {group: "部门", description: "删除部门"},
|
||||
"DELETE /info/deleteInfo": {group: "公告", description: "删除公告"},
|
||||
@@ -35,8 +34,6 @@ var apiMetadata = map[string]apiMetadataValue{
|
||||
"GET /attachmentCategory/getCategoryList": {group: "媒体库分类", description: "分类列表"},
|
||||
"GET /authority/getDataScopeDepts": {group: "角色", description: "获取角色自定义部门集"},
|
||||
"GET /authority/getUsersByAuthority": {group: "角色", description: "获取角色关联用户ID列表"},
|
||||
"GET /customer/customer": {group: "客户", description: "获取单一客户"},
|
||||
"GET /customer/customerList": {group: "客户", description: "获取客户列表"},
|
||||
"GET /department/findDepartment": {group: "部门", description: "根据ID获取部门"},
|
||||
"GET /department/getDepartmentUsers": {group: "部门", description: "获取部门成员ID列表"},
|
||||
"GET /info/findInfo": {group: "公告", description: "根据ID获取公告"},
|
||||
@@ -48,8 +45,6 @@ var apiMetadata = map[string]apiMetadataValue{
|
||||
"GET /position/findPosition": {group: "岗位", description: "根据ID获取岗位"},
|
||||
"GET /position/getPositionUsers": {group: "岗位", description: "获取岗位成员ID列表"},
|
||||
"GET /securityConfig/getSecurityConfig": {group: "安全配置", description: "获取安全配置"},
|
||||
"GET /simpleUploader/checkFileMd5": {group: "断点续传(插件版)", description: "文件完整度验证"},
|
||||
"GET /simpleUploader/mergeFileMd5": {group: "断点续传(插件版)", description: "上传完成合并文件"},
|
||||
"GET /sysDictionary/exportSysDictionary": {group: "系统字典", description: "导出字典JSON"},
|
||||
"GET /sysDictionary/findSysDictionary": {group: "系统字典", description: "根据ID获取字典(建议选择)"},
|
||||
"GET /sysDictionary/getSysDictionaryList": {group: "系统字典", description: "获取字典列表"},
|
||||
@@ -62,7 +57,6 @@ var apiMetadata = map[string]apiMetadataValue{
|
||||
"GET /sysDictionaryDetail/getSysDictionaryDetailList": {group: "系统字典详情", description: "获取字典内容列表"},
|
||||
"GET /sysError/findSysError": {group: "错误日志", description: "根据ID获取错误日志"},
|
||||
"GET /sysError/getSysErrorList": {group: "错误日志", description: "获取错误日志列表"},
|
||||
"GET /sysError/getSysErrorSolution": {group: "错误日志", description: "触发错误处理(异步)"},
|
||||
"GET /sysExportTemplate/exportExcel": {group: "导出模板", description: "导出Excel"},
|
||||
"GET /sysExportTemplate/exportTemplate": {group: "导出模板", description: "下载模板"},
|
||||
"GET /sysExportTemplate/findSysExportTemplate": {group: "导出模板", description: "根据ID获取导出模板"},
|
||||
@@ -103,12 +97,8 @@ var apiMetadata = map[string]apiMetadataValue{
|
||||
"POST /authorityBtn/canRemoveAuthorityBtn": {group: "按钮权限", description: "删除按钮"},
|
||||
"POST /authorityBtn/getAuthorityBtn": {group: "按钮权限", description: "获取已有按钮权限"},
|
||||
"POST /authorityBtn/setAuthorityBtn": {group: "按钮权限", description: "设置按钮权限"},
|
||||
"POST /autoCode/initAPI": {group: "代码生成器", description: "生成插件 API 初始化文件"},
|
||||
"POST /autoCode/initDictionary": {group: "代码生成器", description: "生成插件字典初始化文件"},
|
||||
"POST /autoCode/initMenu": {group: "代码生成器", description: "生成插件菜单初始化文件"},
|
||||
"POST /casbin/getPolicyPathByAuthorityId": {group: "casbin", description: "获取权限列表"},
|
||||
"POST /casbin/updateCasbin": {group: "casbin", description: "更改角色api权限"},
|
||||
"POST /customer/customer": {group: "客户", description: "创建客户"},
|
||||
"POST /dataAccessLog/getDataAccessLogList": {group: "数据权限审计", description: "获取数据权限审计日志"},
|
||||
"POST /department/createDepartment": {group: "部门", description: "创建部门"},
|
||||
"POST /department/getDepartmentList": {group: "部门", description: "获取部门树"},
|
||||
@@ -139,7 +129,6 @@ var apiMetadata = map[string]apiMetadataValue{
|
||||
"POST /position/getPositionList": {group: "岗位", description: "获取岗位列表"},
|
||||
"POST /position/setPositionUsers": {group: "岗位", description: "设置岗位成员(反向分配)"},
|
||||
"POST /securityConfig/setSecurityConfig": {group: "安全配置", description: "设置安全配置"},
|
||||
"POST /simpleUploader/upload": {group: "断点续传(插件版)", description: "插件版分片上传"},
|
||||
"POST /sysApiToken/createApiToken": {group: "API Token", description: "签发API Token"},
|
||||
"POST /sysApiToken/deleteApiToken": {group: "API Token", description: "作废API Token"},
|
||||
"POST /sysApiToken/getApiTokenList": {group: "API Token", description: "获取API Token列表"},
|
||||
@@ -168,7 +157,6 @@ var apiMetadata = map[string]apiMetadataValue{
|
||||
"POST /user/setUserDepartments": {group: "系统用户", description: "设置用户归属部门"},
|
||||
"POST /user/setUserPositions": {group: "系统用户", description: "设置用户岗位"},
|
||||
"PUT /authority/updateAuthority": {group: "角色", description: "更新角色信息"},
|
||||
"PUT /customer/customer": {group: "客户", description: "更新客户"},
|
||||
"PUT /department/updateDepartment": {group: "部门", description: "更新部门"},
|
||||
"PUT /info/updateInfo": {group: "公告", description: "更新公告"},
|
||||
"PUT /position/updatePosition": {group: "岗位", description: "更新岗位"},
|
||||
|
||||
@@ -14,8 +14,12 @@ func dictionaryDomain(value *dto.DictionaryRequest) *biz.Dictionary {
|
||||
}
|
||||
return &biz.Dictionary{ID: value.ID, Name: value.Name, Type: value.Type, Status: status, Desc: value.Description, ParentID: value.ParentID}
|
||||
}
|
||||
func (s *SettingsService) CreateDictionaryRequest(ctx context.Context, req *dto.DictionaryRequest) error {
|
||||
return s.CreateDictionary(ctx, dictionaryDomain(req))
|
||||
func (s *SettingsService) CreateDictionaryRequest(ctx context.Context, req *dto.DictionaryRequest) (map[string]any, error) {
|
||||
value := dictionaryDomain(req)
|
||||
if err := s.CreateDictionary(ctx, value); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dictionaryDTO(value), nil
|
||||
}
|
||||
func (s *SettingsService) UpdateDictionaryRequest(ctx context.Context, req *dto.DictionaryRequest) error {
|
||||
return s.UpdateDictionary(ctx, dictionaryDomain(req))
|
||||
|
||||
@@ -27,8 +27,8 @@ func (s *SettingsService) ImportDictionaryJSON(ctx context.Context, raw string)
|
||||
}
|
||||
return s.uc.ImportDictionary(ctx, dictionary, details)
|
||||
}
|
||||
func (s *SettingsService) DictionaryDetailsByParent(ctx context.Context, dictionaryID, parentID uint) ([]map[string]any, error) {
|
||||
items, err := s.uc.DictionaryDetailsByParent(ctx, dictionaryID, parentID)
|
||||
func (s *SettingsService) DictionaryDetailsByParent(ctx context.Context, dictionaryID uint, parentID *uint, includeChildren bool) ([]map[string]any, error) {
|
||||
items, err := s.uc.DictionaryDetailsByParent(ctx, dictionaryID, parentID, includeChildren)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@ type InitUploadRequest struct {
|
||||
FileSize int64 `json:"fileSize"`
|
||||
ChunkSize int64 `json:"chunkSize"`
|
||||
ChunkTotal int `json:"chunkTotal"`
|
||||
Mime string `json:"mime"`
|
||||
}
|
||||
type CompleteUploadRequest struct {
|
||||
UploadID uint `json:"uploadId"`
|
||||
|
||||
@@ -23,6 +23,11 @@ type DictionaryDetailRequest struct {
|
||||
type ImportDictionaryRequest struct {
|
||||
JSON string `json:"json"`
|
||||
}
|
||||
type DictionaryDetailsByParentRequest struct {
|
||||
DictionaryID uint `json:"sysDictionaryID" form:"sysDictionaryID" binding:"required"`
|
||||
ParentID *uint `json:"parentID" form:"parentID"`
|
||||
IncludeChildren bool `json:"includeChildren" form:"includeChildren"`
|
||||
}
|
||||
type SystemParameterRequest struct {
|
||||
ID uint `json:"ID" form:"ID"`
|
||||
Name string `json:"name" form:"name"`
|
||||
|
||||
@@ -87,7 +87,8 @@ type SetSystemConfigRequest struct {
|
||||
PathPrefix string `json:"pathPrefix"`
|
||||
} `json:"local"`
|
||||
Media struct {
|
||||
SessionTTL int32 `json:"sessionTtl"`
|
||||
SessionTTL int32 `json:"sessionTtl"`
|
||||
MaxFileSize int64 `json:"maxFileSize"`
|
||||
} `json:"media"`
|
||||
Storage *conf.AdminBackend_Storage `json:"storage"`
|
||||
Zap *conf.AdminBackend_Zap `json:"zap"`
|
||||
|
||||
@@ -5,12 +5,24 @@ import (
|
||||
"io"
|
||||
|
||||
"kra/internal/biz"
|
||||
"kra/internal/conf"
|
||||
"kra/internal/service/dto"
|
||||
)
|
||||
|
||||
type MediaService struct{ uc *biz.MediaUsecase }
|
||||
type MediaService struct {
|
||||
uc *biz.MediaUsecase
|
||||
runtime *conf.Runtime
|
||||
}
|
||||
|
||||
func NewMediaService(uc *biz.MediaUsecase) *MediaService { return &MediaService{uc: uc} }
|
||||
func NewMediaService(uc *biz.MediaUsecase, runtime *conf.Runtime) *MediaService {
|
||||
return &MediaService{uc: uc, runtime: runtime}
|
||||
}
|
||||
func (s *MediaService) MediaConfig() *conf.AdminBackend_Media {
|
||||
if config := s.runtime.Admin(); config != nil {
|
||||
return config.Media
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func mediaDTO(v *biz.MediaFile) map[string]any {
|
||||
return map[string]any{"ID": v.ID, "CreatedAt": v.CreatedAt, "UpdatedAt": v.UpdatedAt, "DeletedAt": nil, "name": v.Name, "classId": v.CategoryID, "url": v.URL, "tag": v.Tag, "key": v.Key, "size": v.Size, "mime": v.Mime, "md5": v.MD5, "userId": v.UserID}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ func (s *SystemService) SystemConfig() map[string]any {
|
||||
admin["local"] = map[string]any{"storePath": config.Local.StorePath, "pathPrefix": config.Local.PathPrefix}
|
||||
}
|
||||
if config.Media != nil {
|
||||
admin["media"] = map[string]any{"sessionTtl": config.Media.SessionTtl}
|
||||
admin["media"] = map[string]any{"sessionTtl": config.Media.SessionTtl, "maxFileSize": config.Media.MaxFileSize}
|
||||
}
|
||||
if config.Email != nil {
|
||||
email = map[string]any{"to": config.Email.To, "from": config.Email.From, "host": config.Email.Host, "secret": "******", "nickname": config.Email.Nickname, "port": config.Email.Port, "is-ssl": config.Email.IsSsl, "is-loginauth": config.Email.IsLoginAuth}
|
||||
@@ -169,8 +169,11 @@ func (s *SystemService) SaveSystemConfig(ctx context.Context, req *dto.SetSystem
|
||||
next.Local.PathPrefix = req.Config.Admin.Local.PathPrefix
|
||||
}
|
||||
}
|
||||
if next.Media != nil && req.Config.Admin.Media.SessionTTL > 0 {
|
||||
next.Media.SessionTtl = req.Config.Admin.Media.SessionTTL
|
||||
if next.Media != nil {
|
||||
if req.Config.Admin.Media.SessionTTL > 0 {
|
||||
next.Media.SessionTtl = req.Config.Admin.Media.SessionTTL
|
||||
}
|
||||
next.Media.MaxFileSize = req.Config.Admin.Media.MaxFileSize
|
||||
}
|
||||
if req.Config.Admin.Storage != nil {
|
||||
preserveStorageSecrets(req.Config.Admin.Storage, next.Storage)
|
||||
|
||||
Reference in New Issue
Block a user