fix: 修复 player 详情 completionRate 和 k8s 公开路由
同步 k8s Envoy 中已放行公开接口的实际路由,避免落到泛用 user API;同时规范 dev API 测试脚本的响应体解析,使新增负向断言通过静态检查。
This commit is contained in:
@@ -45,15 +45,20 @@ func (l *GetPlayerLogic) GetPlayer(req *types.GetPlayerReq) (resp *types.PlayerP
|
||||
if player == nil {
|
||||
return nil, errors.New("player not found")
|
||||
}
|
||||
completionRate := 0.0
|
||||
if player.TotalOrders > 0 {
|
||||
completionRate = float64(player.CompletedOrders) / float64(player.TotalOrders)
|
||||
}
|
||||
|
||||
resp = &types.PlayerProfile{
|
||||
Id: player.Id,
|
||||
Rating: player.Rating,
|
||||
TotalOrders: player.TotalOrders,
|
||||
Status: player.Status,
|
||||
Gender: player.Gender,
|
||||
Services: []types.PlayerService{},
|
||||
Tags: append([]string{}, player.Tags...),
|
||||
Id: player.Id,
|
||||
Rating: player.Rating,
|
||||
TotalOrders: player.TotalOrders,
|
||||
CompletionRate: completionRate,
|
||||
Status: player.Status,
|
||||
Gender: player.Gender,
|
||||
Services: []types.PlayerService{},
|
||||
Tags: append([]string{}, player.Tags...),
|
||||
}
|
||||
|
||||
games := make([]string, 0, len(player.Games))
|
||||
|
||||
Reference in New Issue
Block a user