package whatsapp_channel import ( "context" "wechat-api/internal/svc" "wechat-api/internal/types" "wechat-api/internal/utils/dberrorhandler" "github.com/suyuan32/simple-admin-common/msg/errormsg" "github.com/zeromicro/go-zero/core/logx" ) type CreateWhatsappChannelLogic struct { ctx context.Context svcCtx *svc.ServiceContext logx.Logger } func NewCreateWhatsappChannelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateWhatsappChannelLogic { return &CreateWhatsappChannelLogic{ ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx), } } func (l *CreateWhatsappChannelLogic) CreateWhatsappChannel(req *types.WhatsappChannelInfo) (*types.BaseMsgResp, error) { _, err := l.svcCtx.DB.WhatsappChannel.Create(). //SetNotNilStatus(req.Status). SetNotNilAk(req.Ak). SetNotNilSk(req.Sk). SetNotNilWaID(req.WaId). SetNotNilWaName(req.WaName). SetNotNilWabaID(req.WabaId). SetNotNilBusinessID(req.BusinessId). SetNotNilOrganizationID(req.OrganizationId). SetNotNilVerifyAccount(req.VerifyAccount). Save(l.ctx) if err != nil { return nil, dberrorhandler.DefaultEntError(l.Logger, err, req) } return &types.BaseMsgResp{Msg: errormsg.CreateSuccess}, nil }