1 Star 0 Fork 0

iThings/core

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
notifyChannelCreateLogic.go 1.18 KB
一键复制 编辑 原始数据 按行查看 历史
杨磊 提交于 2024-08-07 15:02 . feat: 完善项目
package notifymanagelogic
import (
"context"
"gitee.com/i-Things/core/service/syssvr/internal/repo/relationDB"
"gitee.com/i-Things/share/def"
"gitee.com/i-Things/share/errors"
"gitee.com/i-Things/share/utils"
"gitee.com/i-Things/core/service/syssvr/internal/svc"
"gitee.com/i-Things/core/service/syssvr/pb/sys"
"github.com/zeromicro/go-zero/core/logx"
)
type NotifyChannelCreateLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewNotifyChannelCreateLogic(ctx context.Context, svcCtx *svc.ServiceContext) *NotifyChannelCreateLogic {
return &NotifyChannelCreateLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *NotifyChannelCreateLogic) NotifyChannelCreate(in *sys.NotifyChannel) (*sys.WithID, error) {
po := utils.Copy[relationDB.SysNotifyChannel](in)
po.ID = 0
if !utils.SliceIn(po.Type, def.NotifyTypeSms, def.NotifyTypeEmail, def.NotifyTypeDingTalk,
def.NotifyTypeDingWebhook, def.NotifyTypeWxMini, def.NotifyTypeMessage, def.NotifyTypeWxEWebhook) {
return nil, errors.Parameter.AddMsg("type not support")
}
err := relationDB.NewNotifyChannelRepo(l.ctx).Insert(l.ctx, po)
return &sys.WithID{Id: po.ID}, err
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/i-Things/core.git
git@gitee.com:i-Things/core.git
i-Things
core
core
v0.1.4

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385