package practice import ( "go_dreamfactory/comm" "go_dreamfactory/pb" "google.golang.org/protobuf/proto" ) //参数校验 func (this *apiComp) UnLockCheck(session comm.IUserSession, req *pb.PracticeUnLockReq) (code pb.ErrorCode) { return } ///练功请求 解锁木桩 func (this *apiComp) UnLock(session comm.IUserSession, req *pb.PracticeUnLockReq) (code pb.ErrorCode, data proto.Message) { 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 { code = pb.ErrorCode_ReqParameterError return } pillar.Isunlock = 2 if room.Pillarf.Isunlock == 0 { room.Pillarf.Isunlock = 2 } this.module.modelPandata.Change(session.GetUserId(), map[string]interface{}{ filed: pillar, "pillarf": room.Pillarf, }) session.SendMsg(string(this.module.GetType()), "unLock", &pb.PracticeUnLockResp{Info: room}) return }