上传武馆雕像刷新优化
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) {
|
||||
var (
|
||||
err error
|
||||
room *pb.DBPracticeRoom
|
||||
err error
|
||||
room *pb.DBPracticeRoom
|
||||
update map[string]interface{} = make(map[string]interface{})
|
||||
)
|
||||
if room, err = this.module.modelPandata.queryUserMartialhall(session.GetUserId()); err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
@ -30,6 +31,15 @@ func (this *apiComp) Info(session comm.IUserSession, req *pb.PracticeInfoReq) (c
|
||||
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中
|
||||
cd := int32(configure.Now().Sub(time.Unix(room.Refresh, 0)).Seconds())
|
||||
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
|
||||
return
|
||||
}
|
||||
this.module.modelPandata.Change(session.GetUserId(), map[string]interface{}{
|
||||
"npcstate": room.Npcstate,
|
||||
"refresh": room.Refresh,
|
||||
"battlenum": room.Battlenum,
|
||||
"captain": room.Captain,
|
||||
"formation": room.Formation,
|
||||
})
|
||||
update["npcstate"] = room.Npcstate
|
||||
update["refresh"] = room.Refresh
|
||||
update["battlenum"] = room.Battlenum
|
||||
update["captain"] = room.Captain
|
||||
update["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})
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user