This commit is contained in:
aozhiwei 2024-04-20 15:59:56 +08:00
parent 782e8ccb84
commit 4fbd3f2959

View File

@ -82,6 +82,7 @@ func (this *playerMgr) UnInit() {
func (this *playerMgr) queryStatusHandle(c *gin.Context) {
accountIds := strings.Split(c.DefaultQuery("accountIds", ""), ",")
rspObj := new(common.UserQueryStatusRsp)
chDone := make(chan bool)
f5.GetApp().RegisterMainThreadCb(
func () {
for _, accountId := range(accountIds) {
@ -92,10 +93,18 @@ func (this *playerMgr) queryStatusHandle(c *gin.Context) {
u.Battling = q5.BoolToInt32(hum.IsBattling())
u.Online = q5.BoolToInt32(hum.IsOnline())
q5.AppendSlice(&rspObj.Users, u)
c.JSON(http.StatusOK, rspObj)
chDone <- true
}
}
})
for {
select {
case <-chDone:
close(chDone)
c.JSON(http.StatusOK, rspObj)
return
}
}
}
func (this *playerMgr) CMLogin(hdr *f5.MsgHdr, msg *cs.CMLogin) {