feat: add IM admin P1 operations
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
package sysin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/internal/model/input/form"
|
||||
|
||||
"github.com/gogf/gf/v2/encoding/gjson"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
type ImExternalConfigListInp struct {
|
||||
form.PageReq
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
Service string `json:"service" dc:"服务"`
|
||||
Provider string `json:"provider" dc:"服务商"`
|
||||
Enabled *int `json:"enabled" dc:"是否启用"`
|
||||
}
|
||||
|
||||
func (in *ImExternalConfigListInp) Filter(ctx context.Context) (err error) { return }
|
||||
|
||||
type ImExternalConfigListModel struct {
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
TenantName string `json:"tenantName" dc:"租户名称"`
|
||||
Id int64 `json:"id" dc:"ID"`
|
||||
Service string `json:"service" dc:"服务"`
|
||||
Provider string `json:"provider" dc:"服务商"`
|
||||
Endpoint string `json:"endpoint" dc:"端点"`
|
||||
Enabled int `json:"enabled" dc:"是否启用"`
|
||||
Status string `json:"status" dc:"配置状态"`
|
||||
ConfigJson string `json:"configJson" dc:"普通配置"`
|
||||
HasSecret bool `json:"hasSecret" dc:"是否有敏感配置"`
|
||||
CheckedAt *gtime.Time `json:"checkedAt" dc:"检查时间"`
|
||||
CheckResult string `json:"checkResult" dc:"检查结果"`
|
||||
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
|
||||
UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"`
|
||||
}
|
||||
|
||||
type ImExternalConfigViewInp struct {
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
Service string `json:"service" v:"required#服务不能为空" dc:"服务"`
|
||||
}
|
||||
|
||||
func (in *ImExternalConfigViewInp) Filter(ctx context.Context) (err error) {
|
||||
if in.Service == "" {
|
||||
return gerror.New("服务不能为空")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
type ImExternalConfigViewModel struct {
|
||||
ImExternalConfigListModel
|
||||
}
|
||||
|
||||
type ImExternalConfigUpdateInp struct {
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
Service string `json:"service" v:"required#服务不能为空" dc:"服务"`
|
||||
Provider string `json:"provider" dc:"服务商"`
|
||||
Endpoint string `json:"endpoint" dc:"端点"`
|
||||
Enabled int `json:"enabled" dc:"是否启用"`
|
||||
ConfigJson *gjson.Json `json:"configJson" dc:"普通配置"`
|
||||
SecretJson *gjson.Json `json:"secretJson" dc:"敏感配置,空则保持原值"`
|
||||
}
|
||||
|
||||
func (in *ImExternalConfigUpdateInp) Filter(ctx context.Context) (err error) {
|
||||
if in.Service == "" {
|
||||
return gerror.New("服务不能为空")
|
||||
}
|
||||
if in.Enabled != 0 && in.Enabled != 1 {
|
||||
return gerror.New("启用状态不正确")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
type ImExternalConfigCheckInp struct {
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
Service string `json:"service" v:"required#服务不能为空" dc:"服务"`
|
||||
}
|
||||
|
||||
func (in *ImExternalConfigCheckInp) Filter(ctx context.Context) (err error) {
|
||||
if in.Service == "" {
|
||||
return gerror.New("服务不能为空")
|
||||
}
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user