34 lines
750 B
Go
34 lines
750 B
Go
package logic
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"juwan-backend/app/game/rpc/internal/svc"
|
|
"juwan-backend/app/game/rpc/pb"
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
)
|
|
|
|
type DelGamesLogic struct {
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
logx.Logger
|
|
}
|
|
|
|
func NewDelGamesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DelGamesLogic {
|
|
return &DelGamesLogic{
|
|
ctx: ctx,
|
|
svcCtx: svcCtx,
|
|
Logger: logx.WithContext(ctx),
|
|
}
|
|
}
|
|
|
|
func (l *DelGamesLogic) DelGames(in *pb.DelGamesReq) (*pb.DelGamesResp, error) {
|
|
err := l.svcCtx.GameModelRW.Games.DeleteOneID(in.Id).Exec(l.ctx)
|
|
if err != nil {
|
|
logx.Errorf("delete games failed, %s", err.Error())
|
|
return nil, errors.New("delete games failed")
|
|
}
|
|
return &pb.DelGamesResp{}, nil
|
|
}
|