go_dreamfactory/modules/island/api_buy.go
2023-11-01 20:34:14 +08:00

42 lines
961 B
Go

package island
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
)
// 参数校验
func (this *apiComp) BuyCheck(session comm.IUserSession, req *pb.IsLandBuyReq) (errdata *pb.ErrorData) {
return
}
// /获取自己的排行榜信息
func (this *apiComp) Buy(session comm.IUserSession, req *pb.IsLandBuyReq) (errdata *pb.ErrorData) {
var (
info *pb.DBIsland
heros []*pb.DBHero
err error
)
if errdata = this.BuyCheck(session, req); errdata != nil {
return
}
if info, err = this.module.model.getmodel(session.GetUserId()); err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Message: err.Error(),
}
return
}
if heros, err = this.module.modelhero.getHeroList(session.GetUserId()); err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Message: err.Error(),
}
return
}
session.SendMsg(string(this.module.GetType()), "info", &pb.IsLandInfoResp{Info: info, Heros: heros})
return
}