所有发给game的消息都转发一份到金蚕

This commit is contained in:
aozhiwei 2020-02-27 11:13:01 +08:00
parent de4d07ecd6
commit 0d0ca89b46
5 changed files with 8 additions and 6 deletions

View File

@ -45,7 +45,7 @@ func HGamePreOrder(w http.ResponseWriter, r *http.Request) {
uid := r.PostFormValue("uid")
sid := r.PostFormValue("server")
if !redis.HExists("game_info", sid) {
if !redis.IsValidServerId(util.StringToUint32(sid)) {
log.Error("not Found server ", r.Form.Encode())
return
}

View File

@ -48,7 +48,7 @@ func HuaweiPreOrder(w http.ResponseWriter, r *http.Request) {
sid := r.PostFormValue("server")
log.Debugf("HuaweiPreOrder Param %+v", r.Form)
if !redis.HExists("game_info", sid) {
if !redis.IsValidServerId(util.StringToUint32(sid)) {
log.Error("not Found server ", r.Form.Encode())
return
}

View File

@ -185,9 +185,7 @@ func (srv *PayServer) TestGameProxy(w http.ResponseWriter, r *http.Request) {
}
func (srv *PayServer) SendMsgToGame(sid int, urlPath string, msg interface{}, name string) (respData []byte, e error) {
if sid >= 100 {
return srv.forwardKsGame(sid, urlPath, msg, name)
}
srv.forwardKsGame(sid, urlPath, msg, name)
info := redis.HGet("game_info", sid)
if info == "" {
log.Debug("SendMsgToGame info=nil")

View File

@ -52,7 +52,7 @@ func XiaomiPreOrder(w http.ResponseWriter, r *http.Request) {
}
return
}
if !redis.HExists("game_info", sid) {
if !redis.IsValidServerId(util.StringToUint32(sid)) {
log.Error("not Found server ", r.Form.Encode())
return
}

View File

@ -69,3 +69,7 @@ func initPool() {
}
}
}
func IsValidServerId(sid uint32) (bool) {
return sid > 0 && sid < 200;
}