fix: api descript
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.9.2
|
||||
|
||||
package player
|
||||
|
||||
import (
|
||||
"context"
|
||||
"juwan-backend/app/player/rpc/playerservice"
|
||||
|
||||
"juwan-backend/app/player/api/internal/svc"
|
||||
"juwan-backend/app/player/api/internal/types"
|
||||
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type ListServicesLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// 获取所有服务列表
|
||||
func NewListServicesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListServicesLogic {
|
||||
return &ListServicesLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *ListServicesLogic) ListServices(req *types.PageReq) (resp *types.PlayerServiceListResp, err error) {
|
||||
resp = &types.PlayerServiceListResp{}
|
||||
s, err := l.svcCtx.PlayerRpc.SearchPlayerServices(l.ctx, &playerservice.SearchPlayerServicesReq{
|
||||
Page: req.Offset,
|
||||
Limit: req.Limit,
|
||||
PlayerId: 0,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, v := range s.PlayerServices {
|
||||
temp := types.PlayerService{}
|
||||
err = copier.Copy(&temp, &v)
|
||||
if err == nil {
|
||||
logx.Errorf("ListPlayerServicesLogic.ListPlayerServices copier.Copy err: %v", err)
|
||||
continue
|
||||
}
|
||||
resp.Items = append(resp.Items, temp)
|
||||
}
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user