fix: shop_players 关系表主键与模型对齐
This commit is contained in:
@@ -3,6 +3,7 @@ package logic
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"juwan-backend/app/shop/rpc/internal/models/shopplayers"
|
||||
|
||||
"juwan-backend/app/shop/rpc/internal/svc"
|
||||
"juwan-backend/app/shop/rpc/pb"
|
||||
@@ -25,11 +26,19 @@ func NewDelShopPlayersLogic(ctx context.Context, svcCtx *svc.ServiceContext) *De
|
||||
}
|
||||
|
||||
func (l *DelShopPlayersLogic) DelShopPlayers(in *pb.DelShopPlayersReq) (*pb.DelShopPlayersResp, error) {
|
||||
err := l.svcCtx.ShopModelRO.ShopPlayers.DeleteOneID(in.Id).Exec(l.ctx)
|
||||
affected, err := l.svcCtx.ShopModelRW.ShopPlayers.Delete().
|
||||
Where(
|
||||
shopplayers.ShopIDEQ(in.ShopId),
|
||||
shopplayers.PlayerIDEQ(in.PlayerId),
|
||||
).
|
||||
Exec(l.ctx)
|
||||
if err != nil {
|
||||
logx.Errorf("delete shop players failed, %s", err.Error())
|
||||
return nil, errors.New("delete failed")
|
||||
}
|
||||
if affected == 0 {
|
||||
return nil, errors.New("delete failed")
|
||||
}
|
||||
|
||||
return &pb.DelShopPlayersResp{}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user