go_dreamfactory/modules/user/api_gettujian.go
2022-12-19 16:25:22 +08:00

41 lines
1011 B
Go

package user
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
func (this *apiComp) GetTujianCheck(session comm.IUserSession, req *pb.UserGetTujianReq) (code pb.ErrorCode) {
return
}
func (this *apiComp) GetTujian(session comm.IUserSession, req *pb.UserGetTujianReq) (code pb.ErrorCode, data proto.Message) {
if code = this.GetTujianCheck(session, req); code != pb.ErrorCode_Success {
return
}
uid := session.GetUserId()
rsp := &pb.UserGetTujianResp{}
if result, err := this.module.modelExpand.GetUserExpand(uid); err != nil {
this.module.Error("玩家扩展数据",
log.Field{Key: "uid", Value: uid},
log.Field{Key: "err", Value: err.Error()},
)
return
} else {
for k, v := range result.Tujian {
if v == 0 {
rsp.Heroids = append(rsp.Heroids, k)
}
}
}
err := session.SendMsg(string(this.module.GetType()), UserGetTujianResp, rsp)
if err != nil {
code = pb.ErrorCode_SystemError
}
return
}