package contact import ( "context" "github.com/suyuan32/simple-admin-common/msg/errormsg" "wechat-api/ent/contact" "wechat-api/internal/utils/dberrorhandler" "wechat-api/internal/svc" "wechat-api/internal/types" "github.com/zeromicro/go-zero/core/logx" ) type DeleteWhatsappContactLogic struct { logx.Logger ctx context.Context svcCtx *svc.ServiceContext } func NewDeleteWhatsappContactLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteWhatsappContactLogic { return &DeleteWhatsappContactLogic{ Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx} } func (l *DeleteWhatsappContactLogic) DeleteWhatsappContact(req *types.IDsReq) (*types.BaseMsgResp, error) { organizationId := l.ctx.Value("organizationId").(uint64) _, err := l.svcCtx.DB.Contact.Delete().Where( contact.IDIn(req.Ids...), contact.OrganizationIDEQ(organizationId), contact.Ctype(2), ).Exec(l.ctx) if err != nil { return nil, dberrorhandler.DefaultEntError(l.Logger, err, req) } return &types.BaseMsgResp{Msg: errormsg.DeleteSuccess}, nil }