上传武馆雕像刷新优化
This commit is contained in:
parent
eab92a1205
commit
dd910fd977
@ -18,8 +18,9 @@ func (this *apiComp) InfoCheck(session comm.IUserSession, req *pb.PracticeInfoRe
|
|||||||
///练功请求
|
///练功请求
|
||||||
func (this *apiComp) Info(session comm.IUserSession, req *pb.PracticeInfoReq) (code pb.ErrorCode, data proto.Message) {
|
func (this *apiComp) Info(session comm.IUserSession, req *pb.PracticeInfoReq) (code pb.ErrorCode, data proto.Message) {
|
||||||
var (
|
var (
|
||||||
err error
|
err error
|
||||||
room *pb.DBPracticeRoom
|
room *pb.DBPracticeRoom
|
||||||
|
update map[string]interface{} = make(map[string]interface{})
|
||||||
)
|
)
|
||||||
if room, err = this.module.modelPandata.queryUserMartialhall(session.GetUserId()); err != nil {
|
if room, err = this.module.modelPandata.queryUserMartialhall(session.GetUserId()); err != nil {
|
||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
@ -30,6 +31,15 @@ func (this *apiComp) Info(session comm.IUserSession, req *pb.PracticeInfoReq) (c
|
|||||||
this.module.modelPandata.refreshnpc(room)
|
this.module.modelPandata.refreshnpc(room)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for i := 0; i < len(room.Statuers); {
|
||||||
|
if time.Unix(room.Statuers[i].End, 0).After(configure.Now()) { //过期
|
||||||
|
room.Statuers = append(room.Statuers[:i], room.Statuers[i+1:]...)
|
||||||
|
update["statuers"] = room.Statuers
|
||||||
|
} else {
|
||||||
|
i++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if room.Npcstate == 3 { //CD中
|
if room.Npcstate == 3 { //CD中
|
||||||
cd := int32(configure.Now().Sub(time.Unix(room.Refresh, 0)).Seconds())
|
cd := int32(configure.Now().Sub(time.Unix(room.Refresh, 0)).Seconds())
|
||||||
if cd >= this.module.configure.GetGlobalConf().PandamasChallengeCd {
|
if cd >= this.module.configure.GetGlobalConf().PandamasChallengeCd {
|
||||||
@ -38,16 +48,16 @@ func (this *apiComp) Info(session comm.IUserSession, req *pb.PracticeInfoReq) (c
|
|||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.module.modelPandata.Change(session.GetUserId(), map[string]interface{}{
|
update["npcstate"] = room.Npcstate
|
||||||
"npcstate": room.Npcstate,
|
update["refresh"] = room.Refresh
|
||||||
"refresh": room.Refresh,
|
update["battlenum"] = room.Battlenum
|
||||||
"battlenum": room.Battlenum,
|
update["captain"] = room.Captain
|
||||||
"captain": room.Captain,
|
update["formation"] = room.Formation
|
||||||
"formation": room.Formation,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if len(update) > 0 {
|
||||||
|
this.module.modelPandata.Change(session.GetUserId(), update)
|
||||||
|
}
|
||||||
session.SendMsg(string(this.module.GetType()), "info", &pb.PracticeInfoResp{Info: room})
|
session.SendMsg(string(this.module.GetType()), "info", &pb.PracticeInfoResp{Info: room})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user