增加提取castile到游戏内的列表接口

This commit is contained in:
yuming88
2025-04-28 20:03:37 +08:00
parent d40cdda6ae
commit 95a4337ab3
7 changed files with 93 additions and 19 deletions

View File

@@ -2,6 +2,9 @@ package transfercastile
import (
"context"
"nova_task/internal/consts"
"nova_task/internal/pkg/errs"
"nova_task/internal/pkg/utils"
"nova_task/internal/svc"
"nova_task/internal/types"
@@ -24,8 +27,26 @@ func NewTransferCastileToGameListLogic(ctx context.Context, svcCtx *svc.ServiceC
}
}
func (l *TransferCastileToGameListLogic) TransferCastileToGameList(req *types.TransferCastileToGameListReq) (resp *types.TransferCastileToGameResp, err error) {
// todo: add your logic here and delete this line
func (l *TransferCastileToGameListLogic) TransferCastileToGameList(req *types.TransferCastileToGameListReq) (resp *types.TransferCastileToGameListResp, err error) {
return
uid := utils.GetUidUint(l.ctx)
ls, err := l.svcCtx.CastileTokenLogModel.List(l.ctx, uid, uint64(req.RoleID), req.Page, req.Size)
if err != nil {
l.Errorw("get castile log list failed", logx.Field("err", err), logx.Field("uid", uid))
return nil, errs.New(errs.ErrDatabaseOperate, err)
}
var lss []types.TransferCastileToGameResp
for _, ll := range ls {
lss = append(lss, types.TransferCastileToGameResp{
Id: int(ll.Id),
RoleID: int64(ll.RoleId),
Amount: int64(ll.Amount),
Status: int64(ll.CallbackStatus),
CreatedAt: ll.CreatedAt.Format(consts.FORMATDATETIME),
})
}
return &types.TransferCastileToGameListResp{
List: lss,
Total: len(lss),
}, nil
}

View File

@@ -138,9 +138,10 @@ func (l *TransferCastileToGameLogic) TransferCastileToGame(req *types.TransferCa
}
return &types.TransferCastileToGameResp{
Id: int(res.Id),
RoleID: int64(res.RoleId),
Amount: int64(res.Amount),
Status: int64(res.CallbackStatus),
Id: int(res.Id),
RoleID: int64(res.RoleId),
Amount: int64(res.Amount),
Status: int64(res.CallbackStatus),
CreatedAt: res.CreatedAt.Format(consts.FORMATDATETIME),
}, nil
}