休闲平台上分修改
This commit is contained in:
parent
a1ecd801e1
commit
358da77924
|
@ -2902,6 +2902,8 @@ func init() {
|
|||
"Platform": "1",
|
||||
"Channel": AccountInfo.Channel,
|
||||
"Timestamp": AccountInfo.Timestamp,
|
||||
"Avatar": AccountInfo.Avatar,
|
||||
"NickName": AccountInfo.Nickname,
|
||||
"Exp": time.Now().Add(time.Hour * 24).Unix(),
|
||||
})
|
||||
tokenStr, err := token.SignedString([]byte(common.Config.AppId))
|
||||
|
@ -2933,7 +2935,7 @@ func init() {
|
|||
Plt: acc.Platform,
|
||||
AccId: acc.AccountId.Hex(),
|
||||
NickName: AccountInfo.Nickname,
|
||||
HeadUrl: AccountInfo.Avater,
|
||||
HeadUrl: AccountInfo.Avatar,
|
||||
})
|
||||
|
||||
if pi == nil || tf == false {
|
||||
|
@ -2965,23 +2967,72 @@ func init() {
|
|||
WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/platform/upscore", WebAPIHandlerWrapper(
|
||||
func(tNode *transact.TransNode, params []byte) (int, interface{}) {
|
||||
|
||||
var AccountInfo *webapi.PlatfromCreateAccountReq
|
||||
err := json.Unmarshal(params, &AccountInfo)
|
||||
var msg *webapi.PlatfromUpScoreReq
|
||||
err := json.Unmarshal(params, &msg)
|
||||
if err != nil {
|
||||
logger.Logger.Error("Unmarshal webapi.PlatfromCreateAccountReq error:", err)
|
||||
logger.Logger.Error("Unmarshal webapi.PlatfromUpScoreReq error:", err)
|
||||
}
|
||||
|
||||
pack := &webapi.PlatfromGameLoginRsp{
|
||||
logger.Logger.Tracef("/api/platform/upscore upScoreReqInfo%v", msg)
|
||||
pack := &webapi.PlatfromUpScoreRsp{
|
||||
Success: false,
|
||||
Code: 200,
|
||||
Message: "未知错误",
|
||||
}
|
||||
|
||||
logger.Logger.Tracef("/api/platform/upscore %v", pack)
|
||||
|
||||
var jsonDataRsp []byte
|
||||
player := PlayerMgrSington.GetPlayerByAccount(msg.Username)
|
||||
|
||||
//玩家在线
|
||||
if player != nil {
|
||||
var remainNum int64
|
||||
var addcoin int64 = msg.Count
|
||||
var logtype = int32(common.GainWayPlatformUpScore)
|
||||
|
||||
remainNum = player.Coin
|
||||
|
||||
platform := player.Platform
|
||||
//玩家在游戏内
|
||||
if player.scene != nil {
|
||||
pack.Code = int(webapiproto.TagCode_FAILED)
|
||||
pack.Message = "Unsupported!!! because player in scene!"
|
||||
return common.ResponseTag_ParamError, pack
|
||||
}
|
||||
if len(platform) > 0 {
|
||||
pack.Code = int(webapiproto.TagCode_FAILED)
|
||||
pack.Message = "player platform forbit!"
|
||||
return common.ResponseTag_ParamError, pack
|
||||
}
|
||||
|
||||
if player.Coin+addcoin < 0 {
|
||||
pack.Code = int(webapiproto.TagCode_FAILED)
|
||||
pack.Message = "coin not enough!"
|
||||
return common.ResponseTag_ParamError, pack
|
||||
}
|
||||
|
||||
//增加帐变记录
|
||||
coinlogex := model.NewCoinLogEx(&model.CoinLogParam{
|
||||
Platform: player.Platform,
|
||||
SnID: player.SnId,
|
||||
Channel: player.Channel,
|
||||
ChangeType: common.LoginTypePlatformToken,
|
||||
ChangeNum: msg.Count,
|
||||
RemainNum: remainNum + msg.Count,
|
||||
Add: 0,
|
||||
LogType: logtype,
|
||||
GameID: 0,
|
||||
GameFreeID: 0,
|
||||
BaseCoin: 0,
|
||||
})
|
||||
|
||||
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
||||
err := model.InsertCoinLog(coinlogex)
|
||||
if err != nil {
|
||||
//回滚到对账日志
|
||||
model.RemoveCoinLogOne(platform, coinlogex.LogId)
|
||||
logger.Logger.Errorf("model.InsertCoinLogs err:%v log:%v", err, coinlogex)
|
||||
return err
|
||||
}
|
||||
pack.Success = true
|
||||
pack.Message = "返回成功"
|
||||
|
||||
|
@ -2990,12 +3041,13 @@ func init() {
|
|||
|
||||
jsonDataRsp, err = json.Marshal(pack)
|
||||
if err != nil {
|
||||
logger.Logger.Errorf("/api/platform/createUser err: %v", err)
|
||||
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