go_dreamfactory/modules/martialhall/api_info.go
2022-08-18 15:09:34 +08:00

41 lines
1.1 KiB
Go

package martialhall
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs"
"google.golang.org/protobuf/proto"
)
//参数校验
func (this *apiComp) InfoCheck(session comm.IUserSession, req *pb.MartialhallInfoReq) (code pb.ErrorCode) {
return
}
///练功请求
func (this *apiComp) Info(session comm.IUserSession, req *pb.MartialhallInfoReq) (code pb.ErrorCode, data proto.Message) {
var (
err error
mart *pb.DBMartialhall
mdata *cfg.GameKungfuMasterworkerData
)
if mart, err = this.module.modelMartialhall.queryUserMartialhall(session.GetUserId()); err != nil {
code = pb.ErrorCode_DBError
return
}
if mdata, err = this.module.configure.getMasterworker(mart.Lv); err != nil {
code = pb.ErrorCode_ConfigNoFound
return
}
check(mart.Pillar1, mdata)
check(mart.Pillar2, mdata)
check(mart.Pillar3, mdata)
check(mart.Pillar4, mdata)
check(mart.Pillar5, mdata)
this.module.modelMartialhall.Add(session.GetUserId(), mart)
session.SendMsg(string(this.module.GetType()), "info", &pb.MartialhallInfoResp{Info: mart})
return
}