fix: api descript
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"juwan-backend/app/player/rpc/internal/svc"
|
||||
"juwan-backend/app/player/rpc/pb"
|
||||
|
||||
"github.com/shopspring/decimal"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type UpdatePlayersLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewUpdatePlayersLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdatePlayersLogic {
|
||||
return &UpdatePlayersLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *UpdatePlayersLogic) UpdatePlayers(in *pb.UpdatePlayersReq) (*pb.UpdatePlayersResp, error) {
|
||||
update := l.svcCtx.PlayerModelRW.Players.UpdateOneID(in.Id).
|
||||
SetNillableStatus(in.Status).
|
||||
SetNillableUserID(in.UserId).
|
||||
SetNillableShopID(in.ShopId)
|
||||
if in.Rating != nil {
|
||||
rating := decimal.NewFromFloat(*in.Rating)
|
||||
update.SetRating(rating)
|
||||
}
|
||||
|
||||
return &pb.UpdatePlayersResp{}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user