41 lines
873 B
Go
41 lines
873 B
Go
package troll
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/pb"
|
|
|
|
"google.golang.org/protobuf/proto"
|
|
)
|
|
|
|
func (this *apiComp) RankListCheck(session comm.IUserSession, req *pb.TrollRankListReq) (code pb.ErrorCode) {
|
|
return
|
|
}
|
|
|
|
func (this *apiComp) RankList(session comm.IUserSession, req *pb.TrollRankListReq) (code pb.ErrorCode, data proto.Message) {
|
|
var (
|
|
rank []*pb.RankData
|
|
)
|
|
list, gold, err := this.module.QueryRankList()
|
|
if err == nil {
|
|
for index, v := range list {
|
|
if user := this.module.ModuleUser.GetUser(v); user != nil {
|
|
rank = append(rank, &pb.RankData{
|
|
RankId: int32(index + 1),
|
|
Uid: v,
|
|
Name: user.Name,
|
|
Gold: gold[index],
|
|
Figure: user.Figure,
|
|
Title: user.Title,
|
|
})
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
session.SendMsg(string(this.module.GetType()), TrollRankListResp, &pb.TrollRankListResp{
|
|
Data: rank,
|
|
})
|
|
|
|
return
|
|
}
|