12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- 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 UpdateWhatsappChannelLogic struct {
- ctx context.Context
- svcCtx *svc.ServiceContext
- logx.Logger
- }
- func NewUpdateWhatsappChannelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateWhatsappChannelLogic {
- return &UpdateWhatsappChannelLogic{
- ctx: ctx,
- svcCtx: svcCtx,
- Logger: logx.WithContext(ctx),
- }
- }
- func (l *UpdateWhatsappChannelLogic) UpdateWhatsappChannel(req *types.WhatsappChannelInfo) (*types.BaseMsgResp, error) {
- err := l.svcCtx.DB.WhatsappChannel.UpdateOneID(*req.Id).
- //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).
- Exec(l.ctx)
- if err != nil {
- return nil, dberrorhandler.DefaultEntError(l.Logger, err, req)
- }
- return &types.BaseMsgResp{Msg: errormsg.UpdateSuccess}, nil
- }
|