游戏上分修改
This commit is contained in:
parent
c56575acef
commit
b34fc744f8
|
@ -2983,11 +2983,12 @@ func init() {
|
|||
var jsonDataRsp []byte
|
||||
player := PlayerMgrSington.GetPlayerByAccount(msg.Username)
|
||||
|
||||
var remainNum int64
|
||||
var addcoin int64 = msg.Count
|
||||
var logtype = int32(common.GainWayPlatformUpScore)
|
||||
|
||||
//玩家在线
|
||||
if player != nil {
|
||||
var remainNum int64
|
||||
var addcoin int64 = msg.Count
|
||||
var logtype = int32(common.GainWayPlatformUpScore)
|
||||
|
||||
remainNum = player.Coin
|
||||
platform := player.Platform
|
||||
|
@ -3055,10 +3056,75 @@ func init() {
|
|||
logger.Logger.Errorf("/api/platform/upscore err: %v", err)
|
||||
}
|
||||
|
||||
tNode.TransRep.RetFiels = jsonDataRsp
|
||||
tNode.Resume()
|
||||
}), "/api/platform/upscore").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: msg.Count,
|
||||
RemainNum: remainNum + msg.Count,
|
||||
Add: 0,
|
||||
LogType: logtype,
|
||||
GameID: 0,
|
||||
GameFreeID: 0,
|
||||
BaseCoin: 0,
|
||||
})
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
|
||||
pack.Code = int(webapiproto.TagCode_SUCCESS)
|
||||
pack.Message = "返回成功"
|
||||
|
||||
if data != nil {
|
||||
pack.Success = true
|
||||
pack.Code = int(webapiproto.TagCode_FAILED)
|
||||
pack.Message = data.(error).Error()
|
||||
}
|
||||
|
||||
pack.Success = true
|
||||
pack.Data.Count = msg.Count
|
||||
|
||||
jsonDataRsp, err = json.Marshal(pack)
|
||||
if err != nil {
|
||||
logger.Logger.Errorf("/api/platform/upscore err: %v", err)
|
||||
}
|
||||
|
||||
tNode.TransRep.RetFiels = jsonDataRsp
|
||||
tNode.Resume()
|
||||
}), "/api/platform/upscore").Start()
|
||||
}
|
||||
|
||||
return common.ResponseTag_TransactYield, jsonDataRsp
|
||||
}))
|
||||
|
||||
|
|
Loading…
Reference in New Issue