Compare commits

..

No commits in common. "8160786ac008601cf2909b18a9300eec85fb1730" and "71f07c2e5e9ee2aeda730015ff41098e6c27bb22" have entirely different histories.

3 changed files with 24 additions and 82 deletions

View File

@ -357,14 +357,12 @@ func init() {
// 平台玩家注册账号
admin.MyAdminApp.Route("/api/platform/createUser", PlatformSrvApi)
// 平台玩家上分
// 平台玩家注册账号
admin.MyAdminApp.Route("/api/platform/upscore", 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 {

View File

@ -286,25 +286,7 @@ type PlatfromDownScoreReq struct {
type PlatfromDownScoreRsp struct {
Code int `json:"code"`
Data struct {
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"`
Count int64 `json:"count"`
} `json:"data"`
Message string `json:"message"`
Success bool `json:"success"`

View File

@ -3220,7 +3220,7 @@ func init() {
player.SendDiffData()
}
pack.Data.Money = 0
pack.Data.Count = 0
jsonDataRsp, err = json.Marshal(pack)
if err != nil {
@ -3232,18 +3232,16 @@ func init() {
}), "/api/platform/downscore").Start()
} else {
//玩家不在线
var acc *model.Account
acc, err = model.GetAccountByName("1", msg.Username)
if acc == nil {
return common.ResponseTag_ParamError, pack
}
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
var acc *model.Account
acc, err = model.GetAccountByName("1", msg.Username)
if acc == nil {
return nil
}
findPlayer, _ := model.GetPlayerDataBySnId(acc.Platform, int32(acc.SnId), false, true)
findPlayer, _ := model.GetPlayerDataBySnId("1", int32(acc.SnId), false, true)
if findPlayer != nil {
addcoin = -findPlayer.Coin
//增加帐变记录
coinlogex := model.NewCoinLogEx(&model.CoinLogParam{
Platform: findPlayer.Platform,
@ -3259,6 +3257,7 @@ func init() {
BaseCoin: 0,
})
addcoin = -findPlayer.Coin
err := model.UpdatePlayerCoin(findPlayer.Platform, findPlayer.SnId, findPlayer.Coin+addcoin,
findPlayer.Diamond, findPlayer.SafeBoxCoin, findPlayer.CoinPayTs, findPlayer.SafeBoxCoinTs, findPlayer.MoneyPayTotal, findPlayer.ShopID)
if err != nil {
@ -3289,7 +3288,7 @@ func init() {
pack.Message = data.(error).Error()
}
pack.Data.Money = -addcoin
pack.Data.Count = remainNum
jsonDataRsp, err = json.Marshal(pack)
if err != nil {
@ -3306,13 +3305,13 @@ func init() {
WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/platform/getstatus", WebAPIHandlerWrapper(
func(tNode *transact.TransNode, params []byte) (int, interface{}) {
var msg *webapi.PlatfromPlayerStatusReq
err := json.Unmarshal(params, &msg)
var AccountInfo *webapi.PlatfromCreateAccountReq
err := json.Unmarshal(params, &AccountInfo)
if err != nil {
logger.Logger.Error("Unmarshal webapi.PlatfromGetStatusReq error:", err)
logger.Logger.Error("Unmarshal webapi.PlatfromCreateAccountReq error:", err)
}
pack := &webapi.PlatfromPlayerStatusRsp{
pack := &webapi.PlatfromGameLoginRsp{
Success: false,
Code: 200,
Message: "未知错误",
@ -3321,19 +3320,12 @@ func init() {
logger.Logger.Tracef("/api/platform/getstatus %v", pack)
var jsonDataRsp []byte
player := PlayerMgrSington.GetPlayerByAccount(msg.Username)
//玩家在线
if player != nil {
pack.Code = int(webapiproto.TagCode_SUCCESS)
pack.Message = "返回成功"
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
pack.Success = true
pack.Message = "返回成功"
if player.scene != nil {
pack.Data.IsOnline = true
}
pack.Data.Money = player.Coin
return nil
}), task.CompleteNotifyWrapper(func(i interface{}, t task.Task) {
jsonDataRsp, err = json.Marshal(pack)
if err != nil {
@ -3342,37 +3334,7 @@ func init() {
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
}), task.CompleteNotifyWrapper(func(i interface{}, t task.Task) {
pack.Code = int(webapiproto.TagCode_SUCCESS)
pack.Success = true
pack.Message = "返回成功"
jsonDataRsp, err = json.Marshal(pack)
if err != nil {
logger.Logger.Errorf("/api/platform/getstatus err: %v", err)
}
tNode.TransRep.RetFiels = jsonDataRsp
tNode.Resume()
}), "/api/platform/getstatus").Start()
}
}), "/api/platform/getstatus").Start()
return common.ResponseTag_TransactYield, jsonDataRsp
}))