1
This commit is contained in:
parent
a090e3136e
commit
782e8ccb84
@ -35,6 +35,18 @@ type LoginRsp struct {
|
||||
} `json:"info"`
|
||||
}
|
||||
|
||||
type UserQueryStatusRsp struct {
|
||||
Errcode int `json:"errcode"`
|
||||
Errmsg string `json:"errmsg"`
|
||||
Users []*UserStatus
|
||||
}
|
||||
|
||||
type UserStatus struct {
|
||||
AccountId string `json:"account_id"`
|
||||
Battling int32 `json:"battling"`
|
||||
Online int32 `json:"online"`
|
||||
}
|
||||
|
||||
type WspListener interface {
|
||||
ProcessSSMMsg(*ss.SsNetMsgHandler, *f5.MsgHdr)
|
||||
SendProxyMsg(net.Conn, uint16, proto.Message)
|
||||
|
@ -11,6 +11,8 @@ import (
|
||||
"main/constant"
|
||||
"main/common"
|
||||
"math/rand"
|
||||
"strings"
|
||||
"net/http"
|
||||
"github.com/gin-gonic/gin"
|
||||
. "main/global"
|
||||
)
|
||||
@ -78,7 +80,22 @@ func (this *playerMgr) UnInit() {
|
||||
}
|
||||
|
||||
func (this *playerMgr) queryStatusHandle(c *gin.Context) {
|
||||
|
||||
accountIds := strings.Split(c.DefaultQuery("accountIds", ""), ",")
|
||||
rspObj := new(common.UserQueryStatusRsp)
|
||||
f5.GetApp().RegisterMainThreadCb(
|
||||
func () {
|
||||
for _, accountId := range(accountIds) {
|
||||
hum := _playerMgr.GetPlayerByAccountId(accountId)
|
||||
if hum != nil {
|
||||
u := new(common.UserStatus)
|
||||
u.AccountId = accountId
|
||||
u.Battling = q5.BoolToInt32(hum.IsBattling())
|
||||
u.Online = q5.BoolToInt32(hum.IsOnline())
|
||||
q5.AppendSlice(&rspObj.Users, u)
|
||||
c.JSON(http.StatusOK, rspObj)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func (this *playerMgr) CMLogin(hdr *f5.MsgHdr, msg *cs.CMLogin) {
|
||||
|
@ -77,6 +77,7 @@ type UserQueryStatusRsp struct {
|
||||
Users []struct {
|
||||
AccountId string `json:"account_id"`
|
||||
Battling int32 `json:"battling"`
|
||||
Online int32 `json:"online"`
|
||||
}
|
||||
}
|
||||
|
||||
|
2
third_party/q5
vendored
2
third_party/q5
vendored
@ -1 +1 @@
|
||||
Subproject commit fc08e4f8c51900b8eec8f67e29ccd321c1f1a758
|
||||
Subproject commit 75b0c72d7201725700b1d8d383fd36a63c81aebe
|
Loading…
x
Reference in New Issue
Block a user