tianyuan-api-server/apps/gateway/internal/logic/whitelistr/deletewhitelistlogic.go
2024-10-02 00:57:17 +08:00

36 lines
770 B
Go

package whitelistr
import (
"context"
"tianyuan-api/apps/sentinel/client/whitelist"
"tianyuan-api/apps/gateway/internal/svc"
"tianyuan-api/apps/gateway/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type DeleteWhitelistLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewDeleteWhitelistLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteWhitelistLogic {
return &DeleteWhitelistLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *DeleteWhitelistLogic) DeleteWhitelist(req *types.DeleteWhitelistReq) error {
_, err := l.svcCtx.WhitelistRpc.DeleteWhitelist(l.ctx, &whitelist.DeleteWhitelistRequest{
Id: req.Id,
})
if err != nil {
return err
}
return nil
}