31 lines
806 B
Go
31 lines
806 B
Go
package battle
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/pb"
|
|
|
|
"google.golang.org/protobuf/proto"
|
|
)
|
|
|
|
//参数校验
|
|
func (this *apiComp) ResultCheck(session comm.IUserSession, req *pb.BattleResultReq) (code pb.ErrorCode) {
|
|
if req.Id == "" {
|
|
code = pb.ErrorCode_ReqParameterError
|
|
}
|
|
return
|
|
}
|
|
|
|
///获取本服聊天消息记录
|
|
func (this *apiComp) Result(session comm.IUserSession, req *pb.BattleResultReq) (code pb.ErrorCode, data proto.Message) {
|
|
var ()
|
|
if code = this.ResultCheck(session, req); code != pb.ErrorCode_Success {
|
|
return
|
|
}
|
|
this.module.modelBattle.Change(req.Id, map[string]interface{}{
|
|
"state": pb.BBattleState_end,
|
|
"result": pb.DBBattleComp_red,
|
|
})
|
|
session.SendMsg(string(this.module.GetType()), "result", &pb.BattleResultResp{Id: req.Id, Issucc: true})
|
|
return
|
|
}
|