From f2c63ce4271c732401a76fb85e963a7ef66a5ed5 Mon Sep 17 00:00:00 2001 From: sk <123456@qq.com> Date: Wed, 10 Jul 2024 11:18:49 +0800 Subject: [PATCH] =?UTF-8?q?v=E5=8D=A1=E6=8E=89=E8=90=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/constant.go | 2 + data/DB_PropExchange.dat | Bin 384 -> 384 bytes data/DB_Task.dat | Bin 2441 -> 2441 bytes dbproxy/svc/l_dbshoplog.go | 23 ++ dbproxy/svc/l_itemlog.go | 79 ++++- dbproxy/svc/u_bag.go | 18 +- dbproxy/svc/u_player.go | 6 + gamesrv/base/scene.go | 4 +- model/baginfo.go | 1 + model/itemdatalog.go | 25 ++ model/player.go | 3 +- worldsrv/bagmgr.go | 11 +- worldsrv/friendmgr.go | 2 +- worldsrv/player.go | 6 +- worldsrv/shopmgr.go | 9 +- worldsrv/trascate_webapi.go | 668 +----------------------------------- 16 files changed, 178 insertions(+), 679 deletions(-) diff --git a/common/constant.go b/common/constant.go index c76bcbd..3de9ef4 100644 --- a/common/constant.go +++ b/common/constant.go @@ -599,6 +599,8 @@ const ( ItemIDPermit = 100011 // 赛季通行证积分 ItemIDLong = 50013 // 龙币 ItemIDPetSkill = 11001 //宠物技能升级道具 + ItemIDVCard = 30001 // v卡 + ItemIDJCard = 30002 // 金券 ) func ToItemId(id int32) int32 { diff --git a/data/DB_PropExchange.dat b/data/DB_PropExchange.dat index 7b8e28fe01ca67a162dc181f09f4b1e09a29f16b..6cdad7119586cd0415a2b6480130107ecc7c3f3e 100644 GIT binary patch delta 94 zcmZo*ZeZr&GUH$rV3cCxxZcJ*kws~up7TUO3E|sq%wWOGP#Pp@BPFWD$+57PO`u`z eBNnb$4i<=#iCyXwB}I9FM%;p`zB5^vF&6;m6BW|{ literal 384 zcmd-w<6snElw#w!+{O&1uR!UmQ2H8_z7C?5I5-yevI!h$vE|a^U;?YZ0hPZArEfv$ z+i2>;IUwf4%!8?e*$cA|-8`^4K=;Ai1#t%_*c}aPAF*)7a(Y2LTPb19c$G aK$wHT1_R~64p3s}SOoOw7iKO7+Cl(i+B`J? diff --git a/data/DB_Task.dat b/data/DB_Task.dat index 0ba769e8b17ba1476b3252858639dac3cbe974c2..2747ac48e4e276acd5894390e6a1456343c0dabc 100644 GIT binary patch delta 281 zcmeAa?i8L7F37>Lu$N8XLL0Lc8^;nLi+^KA4x=C&$08t`(F!7apv89bQ$~G5HjayJ z%mPeM(FqIrx#T#+1vn&_6$CW63>bkXfaF=A@(T{hO?G9PY78+8rVD5mmjZ{d0J8*( z0}8$I%Y0?>6-I%{6WCZLe`St^x(9B?ES|~9EGs8(VHY%Z zVB}Kf*z}4~fK!51fkop5JJ=l{Q;<}H6>SD8;s+_3T*x9bIfwNf)bBud!tC9g%_heT E0J}g&f&c&j delta 225 zcmeAa?i8L7F385Qq?b*A--?4{A&|b%#=J2jhfxs1JJ4cl#m2D+D9$+fDWm@65GEmc zISz3F4hd!j0Szt#MyRd@hvb0jF19fXuuOJknmRd+T|k+MOMydJfLVe?fmh?eEFPd* zh)JwaJq?{zlX;o10PP2v&jl3)+Bo?WbHZc+HnGVWEK4RkGmCI5b8LFWD8MPfs=zXt gi%o`eGmys*<`uHYOwM6_2Q>p`GSD@fv)SaB0a|)DmH+?% diff --git a/dbproxy/svc/l_dbshoplog.go b/dbproxy/svc/l_dbshoplog.go index aade343..d361a88 100644 --- a/dbproxy/svc/l_dbshoplog.go +++ b/dbproxy/svc/l_dbshoplog.go @@ -100,6 +100,29 @@ func (svc *DbShopLogSvc) GetDbShopLogsByState(args *model.DbShopLogArgs, dbShops } return } + +func GetMoneyTotal(platform string, snid int32) int64 { + c := DbShopLogCollection(platform) + if c == nil { + logger.Logger.Error("UpdateDbShopState == nil") + return 0 + } + var err error + type m struct { + Total int64 `bson:"total"` + } + tc := new(m) + err = c.Pipe([]bson.M{ + {"$match": bson.M{"snid": snid, "state": 1, "consumenum": bson.M{"$gt": 0}}}, + {"$group": bson.M{"_id": nil, "total": bson.M{"$sum": "$consumenum"}}}, + }).AllowDiskUse().One(tc) + if err != nil { + logger.Logger.Error("GetMoneyTotal error:", err) + return 0 + } + return tc.Total +} + func init() { rpc.Register(new(DbShopLogSvc)) } diff --git a/dbproxy/svc/l_itemlog.go b/dbproxy/svc/l_itemlog.go index 941fe85..bc85f6d 100644 --- a/dbproxy/svc/l_itemlog.go +++ b/dbproxy/svc/l_itemlog.go @@ -1,11 +1,15 @@ package svc import ( + "net/rpc" + "github.com/globalsign/mgo" + "github.com/globalsign/mgo/bson" + + "mongo.games.com/game/common" "mongo.games.com/game/dbproxy/mongo" "mongo.games.com/game/model" "mongo.games.com/goserver/core/logger" - "net/rpc" ) func ItemLogsCollection(plt string) *mongo.Collection { @@ -13,7 +17,6 @@ func ItemLogsCollection(plt string) *mongo.Collection { if s != nil { c_itemlog, first := s.DB().C(model.ItemLogCollName) if first { - c_itemlog.EnsureIndex(mgo.Index{Key: []string{"snid"}, Background: true, Sparse: true}) c_itemlog.EnsureIndex(mgo.Index{Key: []string{"logtype"}, Background: true, Sparse: true}) c_itemlog.EnsureIndex(mgo.Index{Key: []string{"itemid"}, Background: true, Sparse: true}) c_itemlog.EnsureIndex(mgo.Index{Key: []string{"createts"}, Background: true, Sparse: true}) @@ -21,6 +24,7 @@ func ItemLogsCollection(plt string) *mongo.Collection { c_itemlog.EnsureIndex(mgo.Index{Key: []string{"typeid"}, Background: true, Sparse: true}) c_itemlog.EnsureIndex(mgo.Index{Key: []string{"gameid"}, Background: true, Sparse: true}) c_itemlog.EnsureIndex(mgo.Index{Key: []string{"gamefreeid"}, Background: true, Sparse: true}) + c_itemlog.EnsureIndex(mgo.Index{Key: []string{"snid", "logtype", "itemid", "typeid"}, Background: true, Sparse: true}) } return c_itemlog } @@ -44,6 +48,77 @@ func (svc *ItemLogSvc) InsertItemLog(log *model.ItemLog, ret *bool) (err error) return } +func GetItemCount(platform string, snid, id int32, tp int) (count int64) { + c := ItemLogsCollection(platform) + if c == nil { + return 0 + } + var err error + var swapN, matchN int64 + var costN, gainN int64 + type m struct { + Count int64 `bson:"count"` + } + tc := new(m) + // 兑换返还 + err = c.Pipe([]bson.M{ + {"$match": bson.M{"snid": snid, "logtype": 0, "itemid": id, "typeid": common.GainWay_Exchange}}, + {"$group": bson.M{"_id": nil, "count": bson.M{"$sum": "$count"}}}, + }).AllowDiskUse().One(tc) + if err != nil { + logger.Logger.Warn("GetItemCount swapN error:", err) + return 0 + } + swapN = tc.Count + + // 比赛返回 + err = c.Pipe([]bson.M{ + {"$match": bson.M{"snid": snid, "logtype": 0, "itemid": id, "typeid": common.GainWay_MatchSignup}}, + {"$group": bson.M{"_id": nil, "count": bson.M{"$sum": "$count"}}}, + }).AllowDiskUse().One(tc) + if err != nil { + logger.Logger.Warn("GetItemCount matchN error:", err) + return 0 + } + matchN = tc.Count + + // 消耗总数量 + err = c.Pipe([]bson.M{ + {"$match": bson.M{"snid": snid, "logtype": 1, "itemid": id}}, + {"$group": bson.M{"_id": nil, "count": bson.M{"$sum": "$count"}}}, + }).AllowDiskUse().One(tc) + if err != nil { + logger.Logger.Warn("GetItemCount costN error:", err) + return 0 + } + costN = tc.Count + + // 获得总数量 + err = c.Pipe([]bson.M{ + {"$match": bson.M{"snid": snid, "logtype": 0, "itemid": id}}, + {"$group": bson.M{"_id": nil, "count": bson.M{"$sum": "$count"}}}, + }).AllowDiskUse().One(tc) + if err != nil { + logger.Logger.Warn("GetItemCount gainN error:", err) + return 0 + } + gainN = tc.Count + + if tp == 0 { + // 获得数量 = 获得总数量 - 兑换返还 - 比赛返回 + count = gainN - swapN - matchN + } else { + // 消耗数量 = 消耗总数量 - 兑换返还 - 比赛返回 + count = costN - swapN - matchN + } + return count +} + +func (svc *ItemLogSvc) GetItemCount(req *model.ItemCountParam, count *int64) error { + *count = GetItemCount(req.Platform, req.Snid, req.Id, req.Tp) + return nil +} + func init() { rpc.Register(new(ItemLogSvc)) } diff --git a/dbproxy/svc/u_bag.go b/dbproxy/svc/u_bag.go index a6b02d3..48afcfd 100644 --- a/dbproxy/svc/u_bag.go +++ b/dbproxy/svc/u_bag.go @@ -7,9 +7,11 @@ import ( "github.com/globalsign/mgo" "github.com/globalsign/mgo/bson" + "mongo.games.com/goserver/core/logger" + + "mongo.games.com/game/common" "mongo.games.com/game/dbproxy/mongo" "mongo.games.com/game/model" - "mongo.games.com/goserver/core/logger" ) var ( @@ -95,6 +97,7 @@ func (svc *BagSvc) AddBagItem(args *model.BagInfo, ret *bool) error { if bag.BagId == "" { bag.BagId = bson.NewObjectId() } + var vCard int64 // v卡返还 for id, v := range args.BagItem { if item, exist := bag.BagItem[id]; !exist { if v.ItemNum <= 0 { @@ -111,12 +114,25 @@ func (svc *BagSvc) AddBagItem(args *model.BagInfo, ret *bool) error { } item.ItemNum += v.ItemNum } + // v卡返还 + if id == common.ItemIDVCard && args.GainWay == common.GainWay_Exchange && v.ItemNum > 0 { + vCard = v.ItemNum + } } _, err = cbag.Upsert(bson.M{"_id": bag.BagId}, bag) if err != nil { *ret = false logger.Logger.Info("AddBagItem error ", err) } + + // v卡返还 + if vCard > 0 { + c := PlayerDataCollection(args.Platform) + if c != nil { + err = c.Update(bson.M{"snid": args.SnId}, bson.M{"$inc": bson.M{"vcardcost": -vCard}}) + } + } + return err } diff --git a/dbproxy/svc/u_player.go b/dbproxy/svc/u_player.go index 2b3b7fb..eda8b18 100644 --- a/dbproxy/svc/u_player.go +++ b/dbproxy/svc/u_player.go @@ -400,6 +400,12 @@ func (svc *PlayerDataSvc) GetPlayerDataBySnId(args *model.GetPlayerDataBySnIdArg ret.Pd.IScoreTs = time.Now() cplayerdata.Update(bson.M{"snid": args.SnId}, bson.M{"$set": bson.M{"icode": code, "iscorets": ret.Pd.IScoreTs}}) } + if ret.Pd.VCardCost == 0 { + ret.Pd.VCardCost = GetItemCount(ret.Pd.Platform, ret.Pd.SnId, common.ItemIDVCard, 1) + } + if ret.Pd.MoneyTotal == 0 { + ret.Pd.MoneyTotal = GetMoneyTotal(ret.Pd.Platform, ret.Pd.SnId) + } f(ret.Pd) if args.CorrectData && ret.Pd != nil { CorrectData(ret.Pd) diff --git a/gamesrv/base/scene.go b/gamesrv/base/scene.go index 78f4805..7c56092 100644 --- a/gamesrv/base/scene.go +++ b/gamesrv/base/scene.go @@ -2,6 +2,7 @@ package base import ( "fmt" + "math" "math/rand" "strconv" "time" @@ -2149,7 +2150,8 @@ func (this *Scene) TryBillExGameDrop(p *Player) { if drop.MaxAmount > drop.MinAmount { num = rand.Int31n(drop.MaxAmount-drop.MinAmount+1) + drop.MinAmount } - + a := math.Max(float64(p.MoneyTotal), 50) * 10.0 / math.Max(float64(p.VCardCost), 500.0) + num = int32(float64(num) * math.Min(a, 1.5)) p.Items[drop.ItemId] += int64(num) realDrop[drop.ItemId] = num } diff --git a/model/baginfo.go b/model/baginfo.go index 6591384..fc2e14e 100644 --- a/model/baginfo.go +++ b/model/baginfo.go @@ -13,6 +13,7 @@ type BagInfo struct { SnId int32 //玩家账号直接在这里生成 Platform string //平台 BagItem map[int32]*Item //背包数据 key为itemId + GainWay int32 `bson:"-"` } type Item struct { diff --git a/model/itemdatalog.go b/model/itemdatalog.go index aecc757..4482baf 100644 --- a/model/itemdatalog.go +++ b/model/itemdatalog.go @@ -1,9 +1,11 @@ package model import ( + "errors" "time" "github.com/globalsign/mgo/bson" + "mongo.games.com/goserver/core/logger" ) var ( @@ -62,3 +64,26 @@ func NewItemLogEx(param ItemParam) *ItemLog { itemLog.Cost = param.Cost return itemLog } + +type ItemCountParam struct { + Platform string + Snid int32 // 玩家id + Id int32 // 道具id + Tp int // 类型 0.获取 1.消耗 +} + +func GetItemCount(param *ItemCountParam) (int64, error) { + if rpcCli == nil { + logger.Logger.Warnf("rpcCli is nil") + return 0, errors.New("rpcCli is nil") + } + + var ret int64 + err := rpcCli.CallWithTimeout("ItemLogSvc.GetItemCount", param, &ret, time.Second*30) + if err != nil { + logger.Logger.Warnf("GetItemCount err:%v", err) + return 0, err + } + + return ret, err +} diff --git a/model/player.go b/model/player.go index 23d39bf..9bfc783 100644 --- a/model/player.go +++ b/model/player.go @@ -479,6 +479,8 @@ type PlayerData struct { Permit time.Time // 赛季通行证领取时间 PermitStartTs int64 // 赛季通行证开始时间戳 DiamondLotteryScore int64 //钻石抽奖幸运值 + VCardCost int64 // 消耗v卡数量 + MoneyTotal int64 // 现金总充值金额,不包含api加币时的现金 } // 七日签到数据 @@ -489,7 +491,6 @@ type NewSignData struct { TurnplateIdx []int32 //领取转盘下标 VideoTicket int64 // 领取视频奖励时间戳 Addup2Data map[int32]map[int32]int64 // 进阶奖励key1 - day key2-次数 value-结束领取时间戳(-1代表已领取) - } type TaskData struct { diff --git a/worldsrv/bagmgr.go b/worldsrv/bagmgr.go index 0a15755..7cc753e 100644 --- a/worldsrv/bagmgr.go +++ b/worldsrv/bagmgr.go @@ -322,6 +322,14 @@ func (this *BagMgr) AddItems(p *Player, addItems []*Item, add int64, gainWay int if v.ItemId == common.ItemIDPetSkill && v.ItemNum > 0 { PetMgrSington.CheckShowRed(p) } + if v.ItemId == common.ItemIDVCard && (v.ItemNum <= 0 || + gainWay == common.GainWay_MatchSignup || gainWay == common.GainWay_Exchange) { + // 比赛报名返还,兑换返还 + p.VCardCost += -v.ItemNum + if p.VCardCost < 0 { + p.VCardCost = 0 + } + } } if len(changeItems) > 0 { @@ -386,6 +394,7 @@ func (this *BagMgr) AddItemsOffline(platform string, snid int32, addItems []*Ite SnId: findPlayer.SnId, Platform: findPlayer.Platform, BagItem: make(map[int32]*model.Item), + GainWay: gainWay, } for _, v := range addItems { if v == nil || v.ItemNum == 0 { @@ -572,7 +581,7 @@ func (this *BagMgr) SyncBagData(snid int32, changeItemIds ...int32) { //Describe: itemInfo.Describe, ObtainTime: itemInfo.ObtainTime, }) - if itemInfo.ItemId == VCard { + if itemInfo.ItemId == common.ItemIDVCard { FriendMgrSington.UpdateInfo(p.Platform, p.SnId) } } diff --git a/worldsrv/friendmgr.go b/worldsrv/friendmgr.go index 123059d..153b69e 100644 --- a/worldsrv/friendmgr.go +++ b/worldsrv/friendmgr.go @@ -179,7 +179,7 @@ func (this *FriendMgr) UpdateInfo(platform string, snid int32) { info.Sex = p.Sex info.Coin = p.Coin info.Diamond = p.Diamond - item := BagMgrSingleton.GetItem(p.SnId, VCard) + item := BagMgrSingleton.GetItem(p.SnId, common.ItemIDVCard) if item != nil { info.VCard = item.ItemNum } diff --git a/worldsrv/player.go b/worldsrv/player.go index 5143ffb..617bc11 100644 --- a/worldsrv/player.go +++ b/worldsrv/player.go @@ -183,6 +183,9 @@ func (this *Player) init() bool { if this.WelfData == nil { this.WelfData = model.NewWelfareData() } + if this.VCardCost < 0 { + this.VCardCost = 0 + } return true } @@ -3021,7 +3024,7 @@ func (this *Player) SendPlayerInfo() { if this.WelfData != nil { scPlayerData.Data.ReliefFundTimes = this.WelfData.ReliefFundTimes } - if item := BagMgrSingleton.GetItem(this.SnId, VCard); item != nil { + if item := BagMgrSingleton.GetItem(this.SnId, common.ItemIDVCard); item != nil { scPlayerData.Data.VCoin = item.ItemNum //V卡 } // 排位积分 @@ -3925,6 +3928,7 @@ func (this *Player) GetPayGoodsInfo() { this.AddDiamond(int64(info.Amount[1]), 0, info.GainWay, "Callback_login", info.Remark) } this.AddMoneyPayTotal(int64(info.ConsumeNum)) + this.MoneyTotal += int64(info.ConsumeNum) if info.ItemInfo != nil { for _, v := range info.ItemInfo { items = append(items, &Item{ItemId: v.ItemId, ItemNum: v.ItemNum}) diff --git a/worldsrv/shopmgr.go b/worldsrv/shopmgr.go index 8b29cc6..aa39737 100644 --- a/worldsrv/shopmgr.go +++ b/worldsrv/shopmgr.go @@ -72,11 +72,6 @@ const ( Shop_Status_Revoke // 4为撤单 ) -const ( - VCard int32 = 30001 - JCard int32 = 30002 //金券 -) - /* 1.兑换成功:兑换成功,请等待审核 2.今日兑换已达上限,请明日再来 @@ -811,7 +806,7 @@ func (this *ShopMgr) Exchange(p *Player, goodsId int32, username, mobile, commen //扣除V卡 if info.Price > 0 { item := model.ItemInfo{ - ItemId: VCard, + ItemId: common.ItemIDVCard, ItemNum: int64(info.Price * num), } _, code, _ := BagMgrSingleton.AddItem(p, int64(item.ItemId), -item.ItemNum, 0, common.GainWay_Exchange, @@ -825,7 +820,7 @@ func (this *ShopMgr) Exchange(p *Player, goodsId int32, username, mobile, commen //扣除金券 if info.JPrice > 0 { item := model.ItemInfo{ - ItemId: JCard, + ItemId: common.ItemIDJCard, ItemNum: int64(info.JPrice * num), } _, _, isF := BagMgrSingleton.AddItem(p, int64(item.ItemId), -item.ItemNum, 0, common.GainWay_Exchange, diff --git a/worldsrv/trascate_webapi.go b/worldsrv/trascate_webapi.go index 3fbe3ec..5f9989d 100644 --- a/worldsrv/trascate_webapi.go +++ b/worldsrv/trascate_webapi.go @@ -174,613 +174,6 @@ func (this *WebAPIHandlerMgr) GetWebAPIHandler(name string) WebAPIHandler { } func init() { - //API用户登录 - //WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/Member/APIMemberRegisterOrLogin", WebAPIHandlerWrapper( - // func(tNode *transact.TransNode, params []byte) (int, proto.Message) { - // logger.Logger.Trace("WebAPIHandler:/api/Member/APIMemberRegisterOrLogin", params) - // pack := &webapi.SALogin{} - // msg := &webapi.ASLogin{} - // err1 := proto.Unmarshal(params, msg) - // if err1 != nil { - // pack.Tag = webapi.TagCode_FAILED - // pack.Msg = "数据序列化失败" + err1.Error() - // return common.ResponseTag_ParamError, pack - // } - // - // platformID, channel, _, _, tagkey := PlatformMgrSingleton.GetPlatformByPackageTag(msg.GetPlatformTag()) - // platform := PlatformMgrSingleton.GetPlatform(strconv.Itoa(int(platformID))) - // if platform == nil { - // pack.Tag = webapi.TagCode_FAILED - // pack.Msg = "没有对应的包标识" - // return common.ResponseTag_ParamError, pack - // } - // merchantkey := platform.MerchantKey - // - // sign := msg.GetSign() - // - // raw := fmt.Sprintf("%v%v%v%v%v", msg.GetTelegramId(), msg.GetPlatformTag(), msg.GetUsername(), merchantkey, msg.GetTs()) - // h := md5.New() - // io.WriteString(h, raw) - // newsign := hex.EncodeToString(h.Sum(nil)) - // - // if newsign != sign { - // pack.Tag = webapi.TagCode_FAILED - // pack.Msg = "商户验签失败" - // return common.ResponseTag_ParamError, pack - // } - // - // var acc *model.Account - // var errcode int - // - // rawpwd := fmt.Sprintf("%v%v%v", msg.GetSign(), common.GetAppId(), time.Now().Unix()) - // hpwd := md5.New() - // io.WriteString(hpwd, rawpwd) - // pwd := hex.EncodeToString(h.Sum(nil)) - // - // task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { - // acc, errcode = model.AccountIsExist(msg.GetTelegramId(), msg.GetTelegramId(), "", platform.IdStr, time.Now().Unix(), 5, tagkey, false) - // if errcode == 2 { - // var err int - // acc, err = model.InsertAccount(msg.GetTelegramId(), pwd, platform.IdStr, strconv.Itoa(int(channel)), "", "", - // "telegramapi", 0, 0, msg.GetPlatformTag(), "", "", "", tagkey) - // if acc != nil { //需要预先创建玩家数据 - // _, _ = model.GetPlayerData(acc.PackegeTag,acc.AccountId.Hex()) - // } - // if err == 5 { - // return 1 - // } else { - // //t.flag = login_proto.OpResultCode_OPRC_Login_CreateAccError - // } - // } - // return errcode - // }), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) { - // switch data.(int) { - // case 1: - // { - // if err := model.UpdatePlayerTokenPassword(acc.Platform, acc.AccountId.Hex(), pwd); err != nil { - // pack.Tag = webapi.TagCode_FAILED - // pack.Msg = err.Error() - // } else { - // tokenuserdata := &common.TokenUserData{ - // TelegramId: msg.GetTelegramId(), - // Password: pwd, - // Packagetag: msg.GetPlatformTag(), - // Expired: time.Now().Add(time.Minute * 15).Unix(), - // } - // - // token, err := common.CreateTokenAes(tokenuserdata) - // if err != nil { - // pack.Tag = webapi.TagCode_FAILED - // pack.Msg = err.Error() - // } else { - // pack.Tag = webapi.TagCode_SUCCESS - // pack.Msg = "" - // pack.Snid = proto.Int32(acc.SnId) - // pack.Token = fmt.Sprintf("%v?token=%v&snid=%v", model.GameParamData.CSURL, token, acc.SnId) - // } - // } - // } - // case 2: - // { - // pack.Tag = webapi.TagCode_FAILED - // pack.Msg = "创建帐号失败" - // } - // case 3: - // { - // //t.flag = login_proto.OpResultCode_OPRC_LoginPassError - // pack.Tag = webapi.TagCode_FAILED - // pack.Msg = "账号密码错误" - // } - // case 4: - // { - // //t.flag = login_proto.OpResultCode_OPRC_AccountBeFreeze - // pack.Tag = webapi.TagCode_FAILED - // pack.Msg = "帐号冻结" - // } - // } - // tNode.TransRep.RetFiels = pack - // tNode.Resume() - // }), "APIMemberRegisterOrLogin").Start() - // return common.ResponseTag_TransactYield, pack - // })) - - //API用户加减币 - //WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/Game/APIAddSubCoinById", WebAPIHandlerWrapper( - // func(tNode *transact.TransNode, params []byte) (int, proto.Message) { - // pack := &webapi.SAAddCoinById{} - // msg := &webapi.ASAddCoinById{} - // err1 := proto.Unmarshal(params, msg) - // if err1 != nil { - // pack.Tag = webapi.TagCode_FAILED - // pack.Msg = "数据序列化失败" + err1.Error() - // return common.ResponseTag_ParamError, pack - // } - // - // member_snid := msg.GetID() - // coin := msg.GetGold() - // coinEx := msg.GetGoldEx() - // oper := msg.GetOper() - // gold_desc := msg.GetDesc() - // billNo := int(msg.GetBillNo()) - // platform := msg.GetPlatform() - // //logType := msg.GetLogType() - // isAccTodayRecharge := msg.GetIsAccTodayRecharge() - // needFlowRate := msg.GetNeedFlowRate() - // needGiveFlowRate := msg.GetNeedGiveFlowRate() - // - // if CacheDataMgr.CacheBillCheck(billNo, platform) { - // pack.Tag = webapi.TagCode_FAILED - // pack.Msg = "Bill number repeated!" - // return common.ResponseTag_ParamError, pack - // } - // CacheDataMgr.CacheBillNumber(billNo, platform) //防止手抖点两下 - // - // var err error - // var pd *model.PlayerData - // oldGold := int64(0) - // oldSafeBoxGold := int64(0) - // var timeStamp = time.Now().UnixNano() - // player := PlayerMgrSington.GetPlayerBySnId(int32(member_snid)) - // if player != nil { //在线玩家处理 - // if player.scene != nil { - // CacheDataMgr.ClearCacheBill(billNo, platform) - // pack.Tag = webapi.TagCode_FAILED - // pack.Msg = "Unsupported!!! because player in scene!" - // return common.ResponseTag_ParamError, pack - // } - // pd = player.PlayerData - // if len(platform) > 0 && player.Platform != platform { - // CacheDataMgr.ClearCacheBill(billNo, platform) - // pack.Tag = webapi.TagCode_FAILED - // pack.Msg = "player platform forbit!" - // return common.ResponseTag_ParamError, pack - // } - // - // opcode := int32(common.GainWay_Api_In) - // - // if coin < 0 { - // opcode = int32(common.GainWay_Api_Out) - // if player.Coin+coin < 0 { - // CacheDataMgr.ClearCacheBill(billNo, platform) - // pack.Tag = webapi.TagCode_FAILED - // pack.Msg = "coin not enough!" - // return common.ResponseTag_ParamError, pack - // } - // } - // - // //if logType != 0 { - // // opcode = logType - // //} - // - // oldGold = player.Coin - // oldSafeBoxGold = player.SafeBoxCoin - // coinLog := model.NewPayCoinLog(int64(billNo), int32(member_snid), coin, opcode, - // gold_desc, model.PayCoinLogType_Coin, coinEx) - // timeStamp = coinLog.TimeStamp - // //增加帐变记录 - // coinlogex := model.NewCoinLogEx(int32(member_snid), coin+coinEx, oldGold+coin+coinEx, - // oldSafeBoxGold, 0, opcode, 0, oper, gold_desc, pd.Platform, pd.Channel, - // pd.BeUnderAgentCode, 0, pd.PackageID, 0) - // - // task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { - // err = model.InsertPayCoinLogs(platform, coinLog) - // if err != nil { - // logger.Logger.Errorf("model.InsertPayCoinLogs err:%v log:%v", err, coinLog) - // return err - // } - // err = model.InsertCoinLog(coinlogex) - // if err != nil { - // //回滚到对账日志 - // model.RemovePayCoinLog(platform, coinLog.LogId) - // logger.Logger.Errorf("model.InsertCoinLogs err:%v log:%v", err, coinlogex) - // return err - // } - // return err - // }), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) { - // CacheDataMgr.ClearCacheBill(billNo, platform) - // if data != nil { - // pack.Tag = webapi.TagCode_FAILED - // pack.Msg = data.(error).Error() - // } else { - // //player.Coin += coin + coinEx - // player.AddCoinAsync(coin+coinEx, common.GainWay_Api_In, oper, gold_desc, true, 0, false) - // //增加相应的泥码量 - // player.AddDirtyCoin(coin, coinEx) - // player.SetPayTs(timeStamp) - // - // if player.TodayGameData == nil { - // player.TodayGameData = model.NewPlayerGameCtrlData() - // } - // //actRandCoinMgr.OnPlayerRecharge(player, coin) - // if isAccTodayRecharge { - // - // player.AddCoinPayTotal(coin) - // player.TodayGameData.RechargeCoin += coin //累加当天充值金额 - // if coin >= 0 && coinEx >= 0 { - // plt := PlatformMgrSingleton.GetPlatform(pd.Platform) - // curVer := int32(0) - // if plt != nil { - // curVer = plt.ExchangeVer - // } - // log := model.NewCoinGiveLogEx(pd.SnId, pd.Name, coin, coinEx, 0, opcode, pd.PromoterTree, - // model.COINGIVETYPE_PAY, curVer, pd.Platform, pd.Channel, pd.BeUnderAgentCode, - // "", "system", pd.PackageID, int32(needFlowRate), int32(needGiveFlowRate)) - // if log != nil { - // err := model.InsertGiveCoinLog(log) - // if err == nil { - // if pd.LastExchangeOrder != "" && pd.TotalConvertibleFlow > 0 { - // err = model.UpdateGiveCoinLastFlow(platform, pd.LastExchangeOrder, pd.TotalConvertibleFlow) - // } - // } - // //清空流水,更新id - // pd.TotalConvertibleFlow = 0 - // pd.LastExchangeOrder = log.LogId.Hex() - // if player == nil { - // //需要回写数据库 - // task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { - // model.UpdatePlayerExchageFlowAndOrder(platform, member_snid, 0, pd.LastExchangeOrder) - // return nil - // }), nil, "UpdateGiveCoinLogs").StartByExecutor(pd.AccountId) - // } - // } - // } - // } - // - // player.dirty = true - // player.Time2Save() - // if player.scene == nil { //如果在大厅,那么同步下金币 - // player.SendDiffData() - // } - // player.SendPlayerRechargeAnswer(coin) - // pack.Tag = webapi.TagCode_SUCCESS - // pack.Msg = "" - // } - // tNode.TransRep.RetFiels = pack - // tNode.Resume() - // if err != nil { - // logger.Logger.Error("AddSubCoinById task marshal data error:", err) - // } - // }), "APIAddCoinById").Start() - // return common.ResponseTag_TransactYield, pack - // } else { - // task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { - // pd, _ = model.GetPlayerDataBySnId(platform, int32(member_snid), false, true) - // if pd == nil { - // return errors.New("Player not find.") - // } - // if len(platform) > 0 && pd.Platform != platform { - // return errors.New("player platform forbit.") - // } - // oldGold = pd.Coin - // oldSafeBoxGold = pd.SafeBoxCoin - // - // opcode := int32(common.GainWay_Api_In) - // if coin < 0 { - // opcode = int32(common.GainWay_Api_Out) - // if pd.Coin+coin < 0 { - // return errors.New("coin not enough!") - // } - // } - // - // //if logType != 0 { - // // opcode = logType - // //} - // coinLog := model.NewPayCoinLog(int64(billNo), int32(member_snid), coin, opcode, - // gold_desc, model.PayCoinLogType_Coin, coinEx) - // timeStamp = coinLog.TimeStamp - // err = model.InsertPayCoinLogs(platform, coinLog) - // if err != nil { - // logger.Logger.Errorf("model.InsertPayCoinLogs err:%v log:%v", err, coinLog) - // return err - // } - // //增加帐变记录 - // coinlogex := model.NewCoinLogEx(int32(member_snid), coin+coinEx, oldGold+coin+coinEx, - // oldSafeBoxGold, 0, opcode, 0, oper, gold_desc, pd.Platform, - // pd.Channel, pd.BeUnderAgentCode, 0, pd.PackageID, 0) - // err = model.InsertCoinLog(coinlogex) - // if err != nil { - // //回滚到对账日志 - // model.RemovePayCoinLog(platform, coinLog.LogId) - // logger.Logger.Errorf("model.InsertCoinLogs err:%v log:%v", err, coinlogex) - // return err - // } - // return err - // }), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) { - // CacheDataMgr.ClearCacheBill(billNo, platform) - // if data != nil { - // pack.Tag = webapi.TagCode_FAILED - // pack.Msg = data.(error).Error() - // } else { - // pack.Tag = webapi.TagCode_SUCCESS - // pack.Msg = "" - // if isAccTodayRecharge && coin >= 0 { - // OnPlayerPay(pd, coin) - // } - // if isAccTodayRecharge && coin >= 0 && coinEx >= 0 { - // - // plt := PlatformMgrSingleton.GetPlatform(pd.Platform) - // curVer := int32(0) - // if plt != nil { - // curVer = plt.ExchangeVer - // } - // log := model.NewCoinGiveLogEx(pd.SnId, pd.Name, coin, coinEx, 0, common.GainWay_Api_In, pd.PromoterTree, - // model.COINGIVETYPE_PAY, curVer, pd.Platform, pd.Channel, pd.BeUnderAgentCode, - // "", "system", pd.PackageID, int32(needFlowRate), int32(needGiveFlowRate)) - // if log != nil { - // err := model.InsertGiveCoinLog(log) - // if err == nil { - // if pd.LastExchangeOrder != "" && pd.TotalConvertibleFlow > 0 { - // err = model.UpdateGiveCoinLastFlow(platform, pd.LastExchangeOrder, pd.TotalConvertibleFlow) - // } - // } - // //清空流水,更新id - // pd.TotalConvertibleFlow = 0 - // pd.LastExchangeOrder = log.LogId.Hex() - // if player == nil { - // //需要回写数据库 - // task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { - // model.UpdatePlayerExchageFlowAndOrder(platform, int32(member_snid), 0, pd.LastExchangeOrder) - // return nil - // }), nil, "UpdateGiveCoinLogs").StartByExecutor(pd.AccountId) - // } - // } - // - // } - // } - // - // tNode.TransRep.RetFiels = pack - // tNode.Resume() - // if err != nil { - // logger.Logger.Error("AddSubCoinById task marshal data error:", err) - // } - // }), "APIAddSubCoinById").Start() - // return common.ResponseTag_TransactYield, pack - // } - // })) - - //获取用户金币数量 - //WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/Member/GetMemberGoldById", WebAPIHandlerWrapper( - // func(tNode *transact.TransNode, params []byte) (int, proto.Message) { - // pack := &webapi.SAMemberGold{} - // msg := &webapi.ASMemberGold{} - // - // err1 := proto.Unmarshal(params, msg) - // if err1 != nil { - // pack.Tag = webapi.TagCode_FAILED - // pack.Msg = "数据序列化失败" + err1.Error() - // return common.ResponseTag_ParamError, pack - // } - // - // platform := PlatformMgrSingleton.GetPlatform(msg.GetPlatform()) - // if platform == nil { - // pack.Tag = webapi.TagCode_FAILED - // pack.Msg = "没有对应的包标识" - // return common.ResponseTag_ParamError, pack - // } - // platform_param := msg.GetPlatform() - // member_snid := msg.GetSnid() - // var err error - // gold := int64(0) - // bank := int64(0) - // p := PlayerMgrSington.GetPlayerBySnId(member_snid) - // task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { - // if p != nil { - // if len(platform_param) > 0 && p.Platform != platform_param { - // return errors.New("Platform error.") - // } - // bank = p.SafeBoxCoin - // gold = p.GetCoin() - // return nil - // } else { - // pbi, _ := model.GetPlayerDataBySnId(platform_param, member_snid, true, true) - // if pbi == nil { - // return errors.New("snid error") - // } - // if len(platform_param) > 0 && pbi.Platform != platform_param { - // return errors.New("Platform error.") - // } - // bank = pbi.SafeBoxCoin - // gold = pbi.Coin - // return nil - // } - // }), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) { - // if data != nil { - // pack.Tag = webapi.TagCode_FAILED - // pack.Msg = data.(error).Error() - // } else { - // - // pd := &webapi.PlayerCoinData{ - // Id: member_snid, - // Gold: gold, - // Bank: bank, - // } - // pack.Tag = webapi.TagCode_SUCCESS - // //pack.Msg = data.(error).Error() - // pack.Data = pd - // } - // tNode.TransRep.RetFiels = pack - // tNode.Resume() - // if err != nil { - // logger.Logger.Error("AddSubCoinById task marshal data error:", err) - // } - // }), "GetMemberGoldById").Start() - // - // return common.ResponseTag_TransactYield, pack - // })) - - //获取用户注单记录游戏记录 - //WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/Member/GetGameHistory", WebAPIHandlerWrapper( - // func(tNode *transact.TransNode, params []byte) (int, proto.Message) { - // pack := &webapi.SAPlayerHistory{} - // msg := &webapi.ASPlayerHistory{} - // - // err1 := proto.Unmarshal(params, msg) - // if err1 != nil { - // pack.Tag = webapi.TagCode_FAILED - // pack.Msg = "数据序列化失败" + err1.Error() - // return common.ResponseTag_ParamError, pack - // } - // - // platform := PlatformMgrSingleton.GetPlatform(msg.GetPlatform()) - // if platform == nil { - // pack.Tag = webapi.TagCode_FAILED - // pack.Msg = "没有对应的包标识" - // return common.ResponseTag_ParamError, pack - // } - // platform_param := msg.GetPlatform() - // member_snid := msg.GetSnid() - // - // gameid := int(msg.GetGameId()) - // historyModel := msg.GetGameHistoryModel() - // p := PlayerMgrSington.GetPlayerBySnId(member_snid) - // if p == nil{ - // pi,_:=model.GetPlayerDataBySnId(platform_param, member_snid, true, true) - // p = &Player{PlayerData:pi} - // } - // - // if p != nil { - // switch historyModel { - // case PLAYER_HISTORY_MODEL: // 历史记录 - // task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { - // var genPlayerHistoryInfo = func(spinID string, isFree bool, createdTime, totalBetValue, totalPriceValue, totalBonusValue, multiple int64, player *gamehall.PlayerHistoryInfo) { - // player.SpinID = proto.String(spinID) - // player.CreatedTime = proto.Int64(createdTime) - // player.TotalBetValue = proto.Int64(totalBetValue) - // player.TotalPriceValue = proto.Int64(totalPriceValue) - // player.IsFree = proto.Bool(isFree) - // player.TotalBonusValue = proto.Int64(totalBonusValue) - // player.Multiple = proto.Int64(multiple) - // } - // - // var genPlayerHistoryInfoMsg = func(spinid string, v *model.NeedGameRecord, gdl *model.GameDetailedLog, player *gamehall.PlayerHistoryInfo) { - // switch gameid { - // case common.GameId_Crash: - // data, err := model.UnMarshalGameNoteByHUNDRED(gdl.GameDetailedNote) - // if err != nil { - // logger.Logger.Errorf("World UnMarshalAvengersGameNote error:%v", err) - // } - // jsonString, _ := json.Marshal(data) - // - // // convert json to struct - // gnd := model.CrashType{} - // json.Unmarshal(jsonString, &gnd) - // - // //gnd := data.(*model.CrashType) - // for _, curplayer := range gnd.PlayerData { - // if curplayer.UserId == p.SnId { - // genPlayerHistoryInfo(spinid, false, int64(v.Ts), int64(curplayer.UserBetTotal), curplayer.ChangeCoin, 0, int64(curplayer.UserMultiple), player) - // break - // } - // } - // case common.GameId_Avengers: - // data, err := model.UnMarshalAvengersGameNote(gdl.GameDetailedNote) - // if err != nil { - // logger.Logger.Errorf("World UnMarshalAvengersGameNote error:%v", err) - // } - // gnd := data.(*model.GameResultLog) - // genPlayerHistoryInfo(spinid, gnd.BaseResult.IsFree, int64(v.Ts), int64(gnd.BaseResult.TotalBet), gnd.BaseResult.WinTotal, gnd.BaseResult.WinSmallGame, 0, player) - // //case common.GameId_EasterIsland: - // // data, err := model.UnMarshalEasterIslandGameNote(gdl.GameDetailedNote) - // // if err != nil { - // // logger.Logger.Errorf("World UnMarshalEasterIslandGameNote error:%v", err) - // // } - // // gnd := data.(*model.EasterIslandType) - // // genPlayerHistoryInfo(spinid, gnd.IsFree, int64(v.Ts), int64(gnd.Score), gnd.TotalPriceValue, gnd.TotalBonusValue, player) - // default: - // logger.Logger.Errorf("World CSHundredSceneGetGameHistoryInfoHandler receive gameid(%v) error", gameid) - // } - // } - // - // gameclass := int32(2) - // spinid := strconv.FormatInt(int64(p.SnId), 10) - // dbGameFrees := srvdata.PBDB_GameFreeMgr.Datas.Arr //.GetData(data.DbGameFree.Id) - // roomtype := int32(0) - // for _, v := range dbGameFrees { - // if int32(gameid) == v.GetGameId() { - // gameclass = v.GetGameClass() - // roomtype = v.GetSceneType() - // break - // } - // } - // - // gpl := model.GetPlayerListByHallEx(p.SnId, p.Platform, 0, 50, 0, 0, roomtype, gameclass, gameid) - // pack := &gamehall.SCPlayerHistory{} - // for _, v := range gpl.Data { - // if v.GameDetailedLogId == "" { - // logger.Logger.Error("World PlayerHistory GameDetailedLogId is nil") - // break - // } - // gdl := model.GetPlayerHistory(p.Platform, v.GameDetailedLogId) - // player := &gamehall.PlayerHistoryInfo{} - // genPlayerHistoryInfoMsg(spinid, v, gdl, player) - // pack.PlayerHistory = append(pack.PlayerHistory, player) - // } - // proto.SetDefaults(pack) - // logger.Logger.Infof("World gameid:%v PlayerHistory:%v ", gameid, pack) - // return pack - // }), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) { - // if data == nil { - // tNode.TransRep.RetFiels = data - // tNode.Resume() - // } - // }), "CSGetPlayerHistoryHandlerWorld").Start() - // case BIGWIN_HISTORY_MODEL: // 爆奖记录 - // jackpotList := JackpotListMgrSington.GetJackpotList(gameid) - // //if len(jackpotList) < 1 { - // // JackpotListMgrSington.GenJackpot(gameid) // 初始化爆奖记录 - // // JackpotListMgrSington.after(gameid) // 开启定时器 - // // jackpotList = JackpotListMgrSington.GetJackpotList(gameid) - // //} - // pack := JackpotListMgrSington.GetStoCMsg(jackpotList) - // pack.GameId = msg.GetGameId() - // logger.Logger.Infof("World BigWinHistory: %v %v", gameid, pack) - // p.SendToClient(int(gamehall.HundredScenePacketID_PACKET_SC_GAMEBIGWINHISTORY), pack) - // case GAME_HISTORY_MODEL: - // task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { - // var genGameHistoryInfo = func(gameNumber string, createdTime, multiple int64, hash string, gamehistory *gamehall.GameHistoryInfo) { - // gamehistory.GameNumber = proto.String(gameNumber) - // gamehistory.CreatedTime = proto.Int64(createdTime) - // gamehistory.Hash = proto.String(hash) - // gamehistory.Multiple = proto.Int64(multiple) - // } - // - // gls := model.GetAllGameDetailedLogsByGameIdAndTs(p.Platform, gameid, 20) - // - // pack := &gamehall.SCPlayerHistory{} - // for _, v := range gls { - // - // gamehistory := &gamehall.GameHistoryInfo{} - // - // data, err := model.UnMarshalGameNoteByHUNDRED(v.GameDetailedNote) - // if err != nil { - // logger.Logger.Errorf("World UnMarshalAvengersGameNote error:%v", err) - // } - // jsonString, _ := json.Marshal(data) - // - // // convert json to struct - // gnd := model.CrashType{} - // json.Unmarshal(jsonString, &gnd) - // - // genGameHistoryInfo(v.LogId, int64(v.Ts), int64(gnd.Rate), gnd.Hash, gamehistory) - // pack.GameHistory = append(pack.GameHistory, gamehistory) - // } - // proto.SetDefaults(pack) - // logger.Logger.Infof("World gameid:%v History:%v ", gameid, pack) - // return pack - // }), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) { - // if data == nil { - // tNode.TransRep.RetFiels = data - // tNode.Resume() - // } - // }), "CSGetGameHistoryHandlerWorld").Start() - // default: - // logger.Logger.Errorf("World CSHundredSceneGetGameHistoryInfoHandler receive historyModel(%v) error", historyModel) - // } - // } - // - // return common.ResponseTag_TransactYield, pack - // })) - //API用户加减币 WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/Game/QPAPIAddSubCoinById", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { @@ -2123,42 +1516,6 @@ func init() { return common.ResponseTag_Ok, pack })) - // 水池开关 - //WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/Game/GamePoolSwitch", WebAPIHandlerWrapper( - // func(tNode *transact.TransNode, params []byte) (int, proto.Message) { - // pack := &webapi_proto.SAGamePoolSwitch{} - // msg := &webapi_proto.ASGamePoolSwitch{} - // err := proto.Unmarshal(params, msg) - // if err != nil { - // pack.Tag = webapi_proto.TagCode_FAILED - // pack.Msg = "数据序列化失败" + err.Error() - // return common.ResponseTag_ParamError, pack - // } - // if msg.GameFreeId == 0 { - // pack.Tag = webapi_proto.TagCode_FAILED - // pack.Msg = "GameFreeId id zero" - // return common.ResponseTag_ParamError, pack - // } - // gs := GameSessMgrSington.GetGameSess(int(msg.ServerId)) - // if gs != nil { - // msg := &server.WGGamePoolSwitch{ - // Platform: msg.GetPlatform(), - // GameFreeId: msg.GetGameFreeId(), - // ServerId: msg.GetServerId(), - // GroupId: msg.GetGroupId(), - // Switch: msg.GetSwitch(), - // } - // gs.Send(int(server.SSPacketID_PACKET_WG_GAMEPOOLSWITCH), msg) - // } else { - // pack.Tag = webapi_proto.TagCode_FAILED - // pack.Msg = "no find srvId" - // return common.ResponseTag_ParamError, pack - // } - // pack.Tag = webapi_proto.TagCode_SUCCESS - // pack.Msg = "switch game pool success" - // return common.ResponseTag_Ok, pack - // })) - //更新水池 // 修改本地缓存,修改数据库,同步到gamesrv WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/Game/UpdateGamePool", WebAPIHandlerWrapper( @@ -2253,23 +1610,6 @@ func init() { return common.ResponseTag_TransactYield, nil })) - //查询水池 - //WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/Game/QueryAllGamePool", WebAPIHandlerWrapper( - // func(tNode *transact.TransNode, params []byte) (int, proto.Message) { - // pack := &webapi_proto.SAQueryAllGamePool{} - // msg := &webapi_proto.ASQueryAllGamePool{} - // err := proto.Unmarshal(params, msg) - // if err != nil { - // pack.Tag = webapi_proto.TagCode_FAILED - // pack.Msg = "数据序列化失败" + err.Error() - // return common.ResponseTag_ParamError, pack - // } - // pageNo := msg.GetPageNo() - // pageSize := msg.GetPageSize() - // StartQueryCoinPoolStatesTransact(tNode, int32(pageNo), int32(pageSize)) - // return common.ResponseTag_TransactYield, nil - // })) - //////////////////////////房间////////////////////////// WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/Cache/GetRoom", WebAPIHandlerWrapper( func(tNode *transact.TransNode, params []byte) (int, proto.Message) { pack := &webapiproto.SAGetRoom{} @@ -4026,7 +3366,7 @@ func init() { return common.ResponseTag_ParamError, pack } //cdata := ShopMgrSington.GetExchangeData(msg.GoodsId) - item := srvdata.GameItemMgr.Get(platform, VCard) + item := srvdata.GameItemMgr.Get(platform, common.ItemIDVCard) if item == nil { pack.Tag = webapiproto.TagCode_FAILED pack.Msg = "item is nil" @@ -4037,11 +3377,11 @@ func init() { var items []*Item //V卡 if addvcoin > 0 { - items = append(items, &Item{ItemId: VCard, ItemNum: int64(addvcoin)}) + items = append(items, &Item{ItemId: common.ItemIDVCard, ItemNum: int64(addvcoin)}) } //金券 if jPrice > 0 { - items = append(items, &Item{ItemId: JCard, ItemNum: int64(jPrice)}) + items = append(items, &Item{ItemId: common.ItemIDJCard, ItemNum: int64(jPrice)}) } remark := fmt.Sprintf("兑换撤单 %v-%v", msg.GoodsId, msg.Name) if player != nil { @@ -4104,6 +3444,7 @@ func init() { player.AddDiamond(int64(info.Amount[1]), 0, info.GainWay, "Callback", info.Remark) } player.AddMoneyPayTotal(int64(info.ConsumeNum)) + player.MoneyTotal += int64(info.ConsumeNum) player.dirty = true player.SendDiffData() info.Amount[2] = player.GetVIPExpByPay(info.ConsumeNum) @@ -4423,7 +3764,6 @@ func init() { } tNode.TransRep.RetFiels = pack tNode.Resume() - }) return common.ResponseTag_TransactYield, pack }