package practice import ( "go_dreamfactory/comm" "go_dreamfactory/pb" ) //参数校验 func (this *apiComp) UnLockCheck(session comm.IUserSession, req *pb.PracticeUnLockReq) (errdata *pb.ErrorData) { return } ///练功请求 解锁木桩 func (this *apiComp) UnLock(session comm.IUserSession, req *pb.PracticeUnLockReq) (errdata *pb.ErrorData) { var ( err error room *pb.DBPracticeRoom pillar *pb.DBPracticePillar filed string ) if room, err = this.module.modelPandata.queryUserMartialhall(session.GetUserId()); err != nil { code = pb.ErrorCode_DBError return } switch req.Index { case 1: pillar = room.Pillar1 filed = "pillar1" break case 2: pillar = room.Pillar2 filed = "pillar2" break case 3: pillar = room.Pillar3 filed = "pillar3" break case 4: pillar = room.Pillarf filed = "pillarf" break } if pillar.Isunlock != 1 { errdata = &pb.ErrorData{ Code: pb.ErrorCode_ReqParameterError, Title: pb.ErrorCode_ReqParameterError.ToString(), } return } pillar.Isunlock = 2 if room.Pillarf.Isunlock == 0 { room.Pillarf.Isunlock = 2 } if pillarconfigure, err := this.module.configure.getGamePandamasMz(req.Index); err != nil { code = pb.ErrorCode_ConfigNoFound return } else { if code = this.module.DispenseRes(session, pillarconfigure.PhotoGuideUnlocking, true); code != pb.ErrorCode_Success { return } } this.module.modelPandata.Change(session.GetUserId(), map[string]interface{}{ filed: pillar, "pillarf": room.Pillarf, }) go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype152, 1)) session.SendMsg(string(this.module.GetType()), "unlock", &pb.PracticeUnLockResp{Info: room}) return }