go_dreamfactory/modules/sociaty/api_cross_challengestart.go
2023-01-11 19:24:40 +08:00

41 lines
1.1 KiB
Go

package sociaty
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
// 开始挑战
func (this *apiComp) ChallengestartCheck(session comm.IUserSession, req *pb.SociatyBChallengeStartReq) (code pb.ErrorCode) {
return
}
func (this *apiComp) Challengestart(session comm.IUserSession, req *pb.SociatyBChallengeStartReq) (code pb.ErrorCode, data proto.Message) {
if code = this.ChallengestartCheck(session, req); code != pb.ErrorCode_Success {
return
}
uid := session.GetUserId()
sociaty := this.module.modelSociaty.getUserSociaty(uid)
if sociaty != nil && sociaty.Id == "" {
code = pb.ErrorCode_SociatyNoFound
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
return
}
this.module.modelSociatyBoss.challengestart(session, sociaty)
rsp := &pb.SociatyBChallengeStartResp{
SociatyId: sociaty.Id,
Uid: uid,
}
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeChallengestart, rsp); err != nil {
code = pb.ErrorCode_SystemError
}
return
}