36 lines
745 B
Go
36 lines
745 B
Go
package logic
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
|
|
"juwan-backend/app/shop/rpc/internal/svc"
|
|
"juwan-backend/app/shop/rpc/pb"
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
)
|
|
|
|
type DelShopsLogic struct {
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
logx.Logger
|
|
}
|
|
|
|
func NewDelShopsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DelShopsLogic {
|
|
return &DelShopsLogic{
|
|
ctx: ctx,
|
|
svcCtx: svcCtx,
|
|
Logger: logx.WithContext(ctx),
|
|
}
|
|
}
|
|
|
|
func (l *DelShopsLogic) DelShops(in *pb.DelShopsReq) (*pb.DelShopsResp, error) {
|
|
err := l.svcCtx.ShopModelRO.Shops.DeleteOneID(in.Id).Exec(l.ctx)
|
|
if err != nil {
|
|
logx.Errorf("delete shop failed, %s", err.Error())
|
|
return nil, errors.New("delete failed")
|
|
}
|
|
|
|
return &pb.DelShopsResp{}, nil
|
|
}
|