feat: add IM org and notification admin
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
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 ImNotificationTemplateListInp struct {
|
||||
form.PageReq
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
Scene string `json:"scene" dc:"通知场景"`
|
||||
Status *int `json:"status" dc:"状态"`
|
||||
}
|
||||
|
||||
func (in *ImNotificationTemplateListInp) Filter(ctx context.Context) (err error) { return }
|
||||
|
||||
type ImNotificationTemplateListModel struct {
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
TenantName string `json:"tenantName" dc:"租户名称"`
|
||||
Id int64 `json:"id" dc:"ID"`
|
||||
Scene string `json:"scene" dc:"通知场景"`
|
||||
Name string `json:"name" dc:"场景名称"`
|
||||
InAppEnabled int `json:"inAppEnabled" dc:"站内通知"`
|
||||
PushEnabled int `json:"pushEnabled" dc:"Push通知"`
|
||||
SmsEnabled int `json:"smsEnabled" dc:"短信通知"`
|
||||
Status int `json:"status" dc:"状态"`
|
||||
TitleTemplate string `json:"titleTemplate" dc:"标题模板"`
|
||||
ContentTemplate string `json:"contentTemplate" dc:"内容模板"`
|
||||
PayloadJson string `json:"payloadJson" dc:"扩展JSON"`
|
||||
UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"`
|
||||
}
|
||||
|
||||
type ImNotificationTemplateUpdateInp struct {
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
Scene string `json:"scene" v:"required#通知场景不能为空" dc:"通知场景"`
|
||||
InAppEnabled int `json:"inAppEnabled" dc:"站内通知"`
|
||||
PushEnabled int `json:"pushEnabled" dc:"Push通知"`
|
||||
SmsEnabled int `json:"smsEnabled" dc:"短信通知"`
|
||||
Status int `json:"status" dc:"状态"`
|
||||
TitleTemplate string `json:"titleTemplate" dc:"标题模板"`
|
||||
ContentTemplate string `json:"contentTemplate" dc:"内容模板"`
|
||||
PayloadJson *gjson.Json `json:"payloadJson" dc:"扩展JSON"`
|
||||
}
|
||||
|
||||
func (in *ImNotificationTemplateUpdateInp) Filter(ctx context.Context) (err error) {
|
||||
in.Scene = strings.TrimSpace(in.Scene)
|
||||
in.TitleTemplate = strings.TrimSpace(in.TitleTemplate)
|
||||
in.ContentTemplate = strings.TrimSpace(in.ContentTemplate)
|
||||
if !dict.HasOptionKey(consts.ImNotificationSceneOptions, in.Scene) {
|
||||
return gerror.New("通知场景不合法")
|
||||
}
|
||||
if !dict.HasOptionKey(consts.ImNotificationTemplateStatusOptions, in.Status) {
|
||||
return gerror.New("通知模板状态不合法")
|
||||
}
|
||||
if in.TitleTemplate == "" {
|
||||
return gerror.New("标题模板不能为空")
|
||||
}
|
||||
if in.ContentTemplate == "" {
|
||||
return gerror.New("内容模板不能为空")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user