平台查询状态
This commit is contained in:
parent
31794d1f1e
commit
84005dd69c
|
@ -357,12 +357,14 @@ func init() {
|
||||||
|
|
||||||
// 平台玩家注册账号
|
// 平台玩家注册账号
|
||||||
admin.MyAdminApp.Route("/api/platform/createUser", PlatformSrvApi)
|
admin.MyAdminApp.Route("/api/platform/createUser", PlatformSrvApi)
|
||||||
|
// 平台玩家上分
|
||||||
// 平台玩家注册账号
|
|
||||||
admin.MyAdminApp.Route("/api/platform/upscore", PlatformSrvApi)
|
admin.MyAdminApp.Route("/api/platform/upscore", PlatformSrvApi)
|
||||||
|
// 平台玩家下分
|
||||||
// 平台玩家注册账号
|
|
||||||
admin.MyAdminApp.Route("/api/platform/downscore", PlatformSrvApi)
|
admin.MyAdminApp.Route("/api/platform/downscore", PlatformSrvApi)
|
||||||
|
// 平台查询游戏状态
|
||||||
|
admin.MyAdminApp.Route("/api/platform/getstatus", PlatformSrvApi)
|
||||||
|
// 平台查询下注信息
|
||||||
|
admin.MyAdminApp.Route("/api/platform/getgamedetailed", PlatformSrvApi)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Stats() map[string]ApiStats {
|
func Stats() map[string]ApiStats {
|
||||||
|
|
|
@ -286,7 +286,25 @@ type PlatfromDownScoreReq struct {
|
||||||
type PlatfromDownScoreRsp struct {
|
type PlatfromDownScoreRsp struct {
|
||||||
Code int `json:"code"`
|
Code int `json:"code"`
|
||||||
Data struct {
|
Data struct {
|
||||||
Count int64 `json:"count"`
|
Money int64 `json:"money"`
|
||||||
|
} `json:"data"`
|
||||||
|
Message string `json:"message"`
|
||||||
|
Success bool `json:"success"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询玩家游戏状态请求
|
||||||
|
type PlatfromPlayerStatusReq struct {
|
||||||
|
Username string `json:"username"`
|
||||||
|
Channel string `json:"channel"`
|
||||||
|
Timestamp int64 `json:"timestamp"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询游戏状态返回
|
||||||
|
type PlatfromPlayerStatusRsp struct {
|
||||||
|
Code int `json:"code"`
|
||||||
|
Data struct {
|
||||||
|
Money int64 `json:"money"`
|
||||||
|
IsOnline bool `json:"isOnline"`
|
||||||
} `json:"data"`
|
} `json:"data"`
|
||||||
Message string `json:"message"`
|
Message string `json:"message"`
|
||||||
Success bool `json:"success"`
|
Success bool `json:"success"`
|
||||||
|
|
|
@ -3220,7 +3220,7 @@ func init() {
|
||||||
player.SendDiffData()
|
player.SendDiffData()
|
||||||
}
|
}
|
||||||
|
|
||||||
pack.Data.Count = 0
|
pack.Data.Money = 0
|
||||||
|
|
||||||
jsonDataRsp, err = json.Marshal(pack)
|
jsonDataRsp, err = json.Marshal(pack)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -3232,16 +3232,18 @@ func init() {
|
||||||
}), "/api/platform/downscore").Start()
|
}), "/api/platform/downscore").Start()
|
||||||
} else {
|
} else {
|
||||||
//玩家不在线
|
//玩家不在线
|
||||||
|
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
||||||
var acc *model.Account
|
var acc *model.Account
|
||||||
|
|
||||||
acc, err = model.GetAccountByName("1", msg.Username)
|
acc, err = model.GetAccountByName("1", msg.Username)
|
||||||
if acc == nil {
|
if acc == nil {
|
||||||
return common.ResponseTag_ParamError, pack
|
return nil
|
||||||
}
|
}
|
||||||
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
|
||||||
findPlayer, _ := model.GetPlayerDataBySnId("1", int32(acc.SnId), false, true)
|
findPlayer, _ := model.GetPlayerDataBySnId(acc.Platform, int32(acc.SnId), false, true)
|
||||||
if findPlayer != nil {
|
if findPlayer != nil {
|
||||||
|
|
||||||
|
addcoin = -findPlayer.Coin
|
||||||
|
|
||||||
//增加帐变记录
|
//增加帐变记录
|
||||||
coinlogex := model.NewCoinLogEx(&model.CoinLogParam{
|
coinlogex := model.NewCoinLogEx(&model.CoinLogParam{
|
||||||
Platform: findPlayer.Platform,
|
Platform: findPlayer.Platform,
|
||||||
|
@ -3257,7 +3259,6 @@ func init() {
|
||||||
BaseCoin: 0,
|
BaseCoin: 0,
|
||||||
})
|
})
|
||||||
|
|
||||||
addcoin = -findPlayer.Coin
|
|
||||||
err := model.UpdatePlayerCoin(findPlayer.Platform, findPlayer.SnId, findPlayer.Coin+addcoin,
|
err := model.UpdatePlayerCoin(findPlayer.Platform, findPlayer.SnId, findPlayer.Coin+addcoin,
|
||||||
findPlayer.Diamond, findPlayer.SafeBoxCoin, findPlayer.CoinPayTs, findPlayer.SafeBoxCoinTs, findPlayer.MoneyPayTotal, findPlayer.ShopID)
|
findPlayer.Diamond, findPlayer.SafeBoxCoin, findPlayer.CoinPayTs, findPlayer.SafeBoxCoinTs, findPlayer.MoneyPayTotal, findPlayer.ShopID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -3288,7 +3289,7 @@ func init() {
|
||||||
pack.Message = data.(error).Error()
|
pack.Message = data.(error).Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
pack.Data.Count = remainNum
|
pack.Data.Money = -addcoin
|
||||||
|
|
||||||
jsonDataRsp, err = json.Marshal(pack)
|
jsonDataRsp, err = json.Marshal(pack)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -3305,13 +3306,13 @@ func init() {
|
||||||
WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/platform/getstatus", WebAPIHandlerWrapper(
|
WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/platform/getstatus", WebAPIHandlerWrapper(
|
||||||
func(tNode *transact.TransNode, params []byte) (int, interface{}) {
|
func(tNode *transact.TransNode, params []byte) (int, interface{}) {
|
||||||
|
|
||||||
var AccountInfo *webapi.PlatfromCreateAccountReq
|
var msg *webapi.PlatfromPlayerStatusReq
|
||||||
err := json.Unmarshal(params, &AccountInfo)
|
err := json.Unmarshal(params, &msg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Logger.Error("Unmarshal webapi.PlatfromCreateAccountReq error:", err)
|
logger.Logger.Error("Unmarshal webapi.PlatfromGetStatusReq error:", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
pack := &webapi.PlatfromGameLoginRsp{
|
pack := &webapi.PlatfromPlayerStatusRsp{
|
||||||
Success: false,
|
Success: false,
|
||||||
Code: 200,
|
Code: 200,
|
||||||
Message: "未知错误",
|
Message: "未知错误",
|
||||||
|
@ -3320,13 +3321,49 @@ func init() {
|
||||||
logger.Logger.Tracef("/api/platform/getstatus %v", pack)
|
logger.Logger.Tracef("/api/platform/getstatus %v", pack)
|
||||||
|
|
||||||
var jsonDataRsp []byte
|
var jsonDataRsp []byte
|
||||||
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
player := PlayerMgrSington.GetPlayerByAccount(msg.Username)
|
||||||
pack.Success = true
|
|
||||||
|
//玩家在线
|
||||||
|
if player != nil {
|
||||||
|
pack.Code = int(webapiproto.TagCode_SUCCESS)
|
||||||
pack.Message = "返回成功"
|
pack.Message = "返回成功"
|
||||||
|
pack.Success = true
|
||||||
|
|
||||||
|
if player.scene != nil {
|
||||||
|
pack.Data.IsOnline = true
|
||||||
|
}
|
||||||
|
|
||||||
|
pack.Data.Money = player.Coin
|
||||||
|
|
||||||
|
jsonDataRsp, err = json.Marshal(pack)
|
||||||
|
if err != nil {
|
||||||
|
logger.Logger.Errorf("/api/platform/getstatus err: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
tNode.TransRep.RetFiels = jsonDataRsp
|
||||||
|
tNode.Resume()
|
||||||
|
} else {
|
||||||
|
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
||||||
|
|
||||||
|
var acc *model.Account
|
||||||
|
acc, err = model.GetAccountByName("1", msg.Username)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
pack.Data.IsOnline = false
|
||||||
|
|
||||||
|
findPlayer, _ := model.GetPlayerDataBySnId(acc.Platform, int32(acc.SnId), false, true)
|
||||||
|
if findPlayer != nil {
|
||||||
|
pack.Data.Money = findPlayer.Coin
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}), task.CompleteNotifyWrapper(func(i interface{}, t task.Task) {
|
}), task.CompleteNotifyWrapper(func(i interface{}, t task.Task) {
|
||||||
|
|
||||||
|
pack.Code = int(webapiproto.TagCode_SUCCESS)
|
||||||
|
pack.Success = true
|
||||||
|
pack.Message = "返回成功"
|
||||||
|
|
||||||
jsonDataRsp, err = json.Marshal(pack)
|
jsonDataRsp, err = json.Marshal(pack)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Logger.Errorf("/api/platform/getstatus err: %v", err)
|
logger.Logger.Errorf("/api/platform/getstatus err: %v", err)
|
||||||
|
@ -3335,6 +3372,7 @@ func init() {
|
||||||
tNode.TransRep.RetFiels = jsonDataRsp
|
tNode.TransRep.RetFiels = jsonDataRsp
|
||||||
tNode.Resume()
|
tNode.Resume()
|
||||||
}), "/api/platform/getstatus").Start()
|
}), "/api/platform/getstatus").Start()
|
||||||
|
}
|
||||||
return common.ResponseTag_TransactYield, jsonDataRsp
|
return common.ResponseTag_TransactYield, jsonDataRsp
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue