79 lines
2.7 KiB
Go
79 lines
2.7 KiB
Go
package sysin
|
|
|
|
import (
|
|
"context"
|
|
"hotgo/internal/model/input/form"
|
|
|
|
"github.com/gogf/gf/v2/errors/gerror"
|
|
"github.com/gogf/gf/v2/os/gtime"
|
|
)
|
|
|
|
type ImMessageEncryptionListInp struct {
|
|
form.PageReq
|
|
TenantId int64 `json:"tenantId" dc:"商户ID"`
|
|
Keyword string `json:"keyword" dc:"商户编码或名称"`
|
|
Enabled *int `json:"enabled" dc:"消息加密开关"`
|
|
}
|
|
|
|
func (in *ImMessageEncryptionListInp) Filter(ctx context.Context) error {
|
|
return nil
|
|
}
|
|
|
|
type ImMessageEncryptionListModel struct {
|
|
TenantId int64 `json:"tenantId" dc:"商户ID"`
|
|
TenantCode string `json:"tenantCode" dc:"商户编码"`
|
|
TenantName string `json:"tenantName" dc:"商户名称"`
|
|
MessageEncryptionEnabled int `json:"messageEncryptionEnabled" dc:"是否启用消息加密"`
|
|
ActiveVersion uint `json:"activeVersion" dc:"当前密钥版本"`
|
|
PendingVersion uint `json:"pendingVersion" dc:"待激活密钥版本"`
|
|
KeyCount int `json:"keyCount" dc:"密钥版本数"`
|
|
LastRotatedAt *gtime.Time `json:"lastRotatedAt" dc:"最后轮换时间"`
|
|
}
|
|
|
|
type ImMessageEncryptionActionInp struct {
|
|
TenantId int64 `json:"tenantId" v:"required|min:1#请选择商户|商户不正确" dc:"商户ID"`
|
|
Remark string `json:"remark" dc:"操作备注"`
|
|
}
|
|
|
|
func (in *ImMessageEncryptionActionInp) Filter(ctx context.Context) error {
|
|
if in.TenantId <= 0 {
|
|
return gerror.New("请选择商户")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type ImMessageEncryptionSwitchInp struct {
|
|
TenantId int64 `json:"tenantId" v:"required|min:1#请选择商户|商户不正确" dc:"商户ID"`
|
|
Enabled int `json:"enabled" dc:"是否启用"`
|
|
}
|
|
|
|
func (in *ImMessageEncryptionSwitchInp) Filter(ctx context.Context) error {
|
|
if in.TenantId <= 0 {
|
|
return gerror.New("请选择商户")
|
|
}
|
|
if in.Enabled != 0 && in.Enabled != 1 {
|
|
return gerror.New("消息加密开关值不正确")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type ImMessageKeyGetInp struct {
|
|
TenantCode string `json:"tenantCode" dc:"商户编码"`
|
|
Version uint `json:"version" dc:"密钥版本,0表示当前版本"`
|
|
}
|
|
|
|
type ImMessageKeyModel struct {
|
|
TenantId int64 `json:"tenantId" dc:"商户ID"`
|
|
TenantCode string `json:"tenantCode" dc:"商户编码"`
|
|
Enabled bool `json:"enabled" dc:"消息加密是否启用"`
|
|
Version uint `json:"version" dc:"密钥版本"`
|
|
Algorithm string `json:"algorithm" dc:"算法"`
|
|
Status string `json:"status" dc:"密钥状态"`
|
|
Key string `json:"key" dc:"Base64编码DEK,仅内部接口返回"`
|
|
}
|
|
|
|
type ImMessageKeyAckInp struct {
|
|
TenantCode string `json:"tenantCode" dc:"商户编码"`
|
|
Version uint `json:"version" dc:"密钥版本"`
|
|
}
|