56 lines
1.2 KiB
Go
56 lines
1.2 KiB
Go
package realarena
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/pb"
|
|
)
|
|
|
|
// 参数校验
|
|
func (this *apiComp) MatchCheck(session comm.IUserSession, req *pb.RealArenaMatchReq) (errdata *pb.ErrorData) {
|
|
|
|
return
|
|
}
|
|
|
|
//匹配
|
|
func (this *apiComp) Match(session comm.IUserSession, req *pb.RealArenaMatchReq) (errdata *pb.ErrorData) {
|
|
var (
|
|
info *pb.DBRealArena
|
|
err error
|
|
)
|
|
|
|
if info, err = this.module.model.getinfo(session); err != nil {
|
|
errdata = &pb.ErrorData{
|
|
Code: pb.ErrorCode_ReqParameterError,
|
|
Message: err.Error(),
|
|
}
|
|
return
|
|
}
|
|
|
|
if err = this.module.match.MatchReq(&pb.DBRealArenaMember{
|
|
User: info.Uinfo,
|
|
Dan: 1,
|
|
Integral: info.Integral,
|
|
Heros: make([]string, 5),
|
|
Disable: -1,
|
|
Leader: -1,
|
|
}); err != nil {
|
|
errdata = &pb.ErrorData{
|
|
Code: pb.ErrorCode_SystemError,
|
|
Message: err.Error(),
|
|
}
|
|
return
|
|
}
|
|
if err = this.module.model.change(session.GetUserId(), map[string]interface{}{
|
|
"state": 1,
|
|
}); err != nil {
|
|
errdata = &pb.ErrorData{
|
|
Code: pb.ErrorCode_DBError,
|
|
Title: pb.ErrorCode_DBError.ToString(),
|
|
Message: err.Error(),
|
|
}
|
|
return
|
|
}
|
|
session.SendMsg(string(this.module.GetType()), "match", &pb.RealArenaInfoResp{})
|
|
return
|
|
}
|