Compare commits

..

No commits in common. "71f07c2e5e9ee2aeda730015ff41098e6c27bb22" and "90d76a17c8c3509e362fafff9d4505096dec2938" have entirely different histories.

3 changed files with 18 additions and 92 deletions

View File

@ -658,7 +658,7 @@ func (this *Player) ReportGameEvent(param *ReportGameEventParam) *ReportGameEven
isNew = 1
}
if param.GameTime <= 0 {
if param.GameTime < 0 {
param.GameTime = int64(time.Now().Sub(this.scene.GameNowTime).Seconds())
}
if param.GameTime < 0 {
@ -679,7 +679,7 @@ func (this *Player) ReportGameEvent(param *ReportGameEventParam) *ReportGameEven
ModeId: this.scene.GameMode,
Tax: param.Tax,
Amount: param.Change,
CreateTime: time.Now().Unix(),
CreateTime: this.CreateTime.Unix(),
CreateDayTime: tCreateDay.Unix(),
Out: param.Out,
In: param.In,

View File

@ -262,7 +262,7 @@ type PlatfromUpScoreReq struct {
Username string `json:"username"`
Channel string `json:"channel"`
Timestamp int64 `json:"timestamp"`
Count string `json:"count"`
Count int64 `json:"count"`
}
// 上分返回

View File

@ -2984,12 +2984,8 @@ func init() {
player := PlayerMgrSington.GetPlayerByAccount(msg.Username)
var remainNum int64
var addcoin int64
var addcoin int64 = msg.Count
var logtype = int32(common.GainWayPlatformUpScore)
addcoin, err = strconv.ParseInt(msg.Count, 10, 64)
if err != nil {
logger.Logger.Error("Unmarshal webapi.PlatfromUpScoreReq strconv.ParseInt error:", err)
}
//玩家在线
if player != nil {
@ -3020,8 +3016,8 @@ func init() {
SnID: player.SnId,
Channel: player.Channel,
ChangeType: common.LoginTypePlatformToken,
ChangeNum: addcoin,
RemainNum: remainNum + addcoin,
ChangeNum: msg.Count,
RemainNum: remainNum + msg.Count,
Add: 0,
LogType: logtype,
GameID: 0,
@ -3042,10 +3038,9 @@ func init() {
pack.Code = int(webapiproto.TagCode_SUCCESS)
pack.Message = "返回成功"
pack.Success = true
if data != nil {
pack.Success = false
pack.Success = true
pack.Code = int(webapiproto.TagCode_SUCCESS)
pack.Message = data.(error).Error()
} else {
@ -3053,6 +3048,7 @@ func init() {
player.SendDiffData()
}
pack.Success = true
pack.Data.Count = player.Coin
jsonDataRsp, err = json.Marshal(pack)
@ -3080,8 +3076,8 @@ func init() {
SnID: findPlayer.SnId,
Channel: findPlayer.Channel,
ChangeType: common.LoginTypePlatformToken,
ChangeNum: addcoin,
RemainNum: remainNum + addcoin,
ChangeNum: msg.Count,
RemainNum: remainNum + msg.Count,
Add: 0,
LogType: logtype,
GameID: 0,
@ -3111,14 +3107,14 @@ func init() {
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
pack.Code = int(webapiproto.TagCode_SUCCESS)
pack.Message = "返回成功"
pack.Success = true
if data != nil {
pack.Success = false
pack.Success = true
pack.Code = int(webapiproto.TagCode_FAILED)
pack.Message = data.(error).Error()
}
pack.Success = true
pack.Data.Count = remainNum
jsonDataRsp, err = json.Marshal(pack)
@ -3153,14 +3149,12 @@ func init() {
var jsonDataRsp []byte
player := PlayerMgrSington.GetPlayerByAccount(msg.Username)
var remainNum int64
var addcoin int64
var logtype = int32(common.GainWayPlatformDownScore)
//玩家在线
if player != nil {
var remainNum int64
var addcoin int64 = -player.Coin
var logtype = int32(common.GainWayPlatformDownScore)
addcoin = -player.Coin
remainNum = player.Coin
platform := player.Platform
//玩家在游戏内
@ -3209,86 +3203,18 @@ func init() {
pack.Code = int(webapiproto.TagCode_SUCCESS)
pack.Message = "返回成功"
pack.Success = true
if data != nil {
pack.Success = false
pack.Code = int(webapiproto.TagCode_FAILED)
pack.Success = true
pack.Code = int(webapiproto.TagCode_SUCCESS)
pack.Message = data.(error).Error()
} else {
player.Coin += addcoin
player.SendDiffData()
}
pack.Data.Count = 0
jsonDataRsp, err = json.Marshal(pack)
if err != nil {
logger.Logger.Errorf("/api/platform/downscore err: %v", err)
}
tNode.TransRep.RetFiels = jsonDataRsp
tNode.Resume()
}), "/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{} {
findPlayer, _ := model.GetPlayerDataBySnId("1", int32(acc.SnId), false, true)
if findPlayer != nil {
//增加帐变记录
coinlogex := model.NewCoinLogEx(&model.CoinLogParam{
Platform: findPlayer.Platform,
SnID: findPlayer.SnId,
Channel: findPlayer.Channel,
ChangeType: common.LoginTypePlatformToken,
ChangeNum: addcoin,
RemainNum: remainNum + addcoin,
Add: 0,
LogType: logtype,
GameID: 0,
GameFreeID: 0,
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 {
logger.Logger.Errorf("model.UpdatePlayerCoin err:%v.", err)
return nil
}
//账变记录
err = model.InsertCoinLog(coinlogex)
if err != nil {
//回滚到对账日志
model.RemoveCoinLogOne("1", coinlogex.LogId)
logger.Logger.Errorf("model.InsertCoinLogs err:%v log:%v", err, coinlogex)
return err
}
}
remainNum = findPlayer.Coin + addcoin
return nil
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
pack.Code = int(webapiproto.TagCode_SUCCESS)
pack.Message = "返回成功"
pack.Success = true
if data != nil {
pack.Success = false
pack.Code = int(webapiproto.TagCode_FAILED)
pack.Message = data.(error).Error()
}
pack.Data.Count = remainNum
pack.Data.Count = 0
jsonDataRsp, err = json.Marshal(pack)
if err != nil {