Compare commits

..

No commits in common. "b6b7ff4035d06772de8c23168263bb81418cd9a0" and "bcc677ed87a48898734ec8d6653fa10b7c25b473" have entirely different histories.

14 changed files with 2007 additions and 1816 deletions

View File

@ -11,7 +11,7 @@
 
 è<>¶å¥³ç¢Žç‰‡ ¢œ(  è<>¶å¥³ç¢Žç‰‡ ¢œ(
 钻石 ¢<>(  钻石 ¢<>(
! 5å…ƒè¯<C3A8>è´¹ç´å…券 ºê(0 ! 5å…ƒè¯<C3A8>è´¹ç´å…券 ºê(0
 钻石 ¢<>(0¸  钻石 ¢<>(0¸
积分 ¬<>0¸ 积分 ¬<>0¸
1å…ƒè¯<C3A8>è´¹ç´å…券 ¸ê( 1å…ƒè¯<C3A8>è´¹ç´å…券 ¸ê(

View File

@ -92,7 +92,7 @@
"Type": 1, "Type": 1,
"Name": "5元话费直兑券", "Name": "5元话费直兑券",
"Item_Id": 30010, "Item_Id": 30010,
"Grade": 1, "Grade": 5,
"Oddrate": 17 "Oddrate": 17
}, },
{ {

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -102,15 +102,6 @@ func (svc *ItemLogSvc) GetItemCount(req *model.ItemCountParam, count *int64) err
return nil return nil
} }
func (svc *ItemLogSvc) UpdateState(req *model.UpdateParam, res *model.UpdateRes) error {
c := ItemLogsCollection(req.Platform)
if c == nil {
return nil
}
err := c.UpdateId(req.LogId, bson.M{"$set": bson.M{"status": req.State}})
return err
}
func init() { func init() {
rpc.Register(new(ItemLogSvc)) rpc.Register(new(ItemLogSvc))
} }

View File

@ -27,7 +27,6 @@ type ItemLog struct {
GameId int32 // 游戏id,游戏中获得时有值 GameId int32 // 游戏id,游戏中获得时有值
GameFreeId int32 // 场次id,游戏中获得时有值 GameFreeId int32 // 场次id,游戏中获得时有值
Cost []*ItemInfo // 消耗的道具 Cost []*ItemInfo // 消耗的道具
Id string // 撤销的id兑换失败
} }
func NewItemLog() *ItemLog { func NewItemLog() *ItemLog {
@ -47,7 +46,6 @@ type ItemParam struct {
GameId int64 // 游戏id,游戏中获得时有值 GameId int64 // 游戏id,游戏中获得时有值
GameFreeId int64 // 场次id,游戏中获得时有值 GameFreeId int64 // 场次id,游戏中获得时有值
Cost []*ItemInfo // 消耗的道具 Cost []*ItemInfo // 消耗的道具
LogId string // 撤销的id兑换失败
} }
func NewItemLogEx(param ItemParam) *ItemLog { func NewItemLogEx(param ItemParam) *ItemLog {
@ -64,7 +62,6 @@ func NewItemLogEx(param ItemParam) *ItemLog {
itemLog.GameId = int32(param.GameId) itemLog.GameId = int32(param.GameId)
itemLog.GameFreeId = int32(param.GameFreeId) itemLog.GameFreeId = int32(param.GameFreeId)
itemLog.Cost = param.Cost itemLog.Cost = param.Cost
itemLog.Id = param.LogId
return itemLog return itemLog
} }
@ -90,28 +87,3 @@ func GetItemCount(param *ItemCountParam) (int64, error) {
return ret, err return ret, err
} }
type UpdateParam struct {
Platform string
LogId bson.ObjectId
State int
}
type UpdateRes struct {
}
func UpdateItemState(param *UpdateParam) error {
if rpcCli == nil {
logger.Logger.Warnf("rpcCli is nil")
return errors.New("rpcCli is nil")
}
var ret UpdateRes
err := rpcCli.CallWithTimeout("ItemLogSvc.UpdateState", param, &ret, time.Second*30)
if err != nil {
logger.Logger.Warnf("UpdateItemState err:%v", err)
return err
}
return err
}

File diff suppressed because it is too large Load Diff

View File

@ -361,6 +361,26 @@ message DB_CreateroomArray {
repeated DB_Createroom Arr = 1; repeated DB_Createroom Arr = 1;
} }
message DB_DiamondLottery {
int32 Id = 1;
int32 Type = 2;
string Name = 3;
int32 Item_Id = 4;
int32 Grade = 5;
int32 Oddrate = 6;
}
message DB_DiamondLotteryArray {
repeated DB_DiamondLottery Arr = 1;
}
message DB_Fish { message DB_Fish {
int32 Id = 1; int32 Id = 1;

2
public

@ -1 +1 @@
Subproject commit ddda8276651cda84843a64458a7a3edd6835d6e6 Subproject commit 3d5fc5c6e4eeb3b8008ff098751c1bd6b211793c

View File

@ -0,0 +1,77 @@
// Code generated by xlsx2proto.
// DO NOT EDIT!
package srvdata
import (
"google.golang.org/protobuf/proto"
"mongo.games.com/game/protocol/server"
)
var PBDB_DiamondLotteryMgr = &DB_DiamondLotteryMgr{
Datas: &server.DB_DiamondLotteryArray{},
pool: make(map[int32]*server.DB_DiamondLottery),
}
type DB_DiamondLotteryMgr struct {
Datas *server.DB_DiamondLotteryArray
pool map[int32]*server.DB_DiamondLottery
}
func (this *DB_DiamondLotteryMgr) unmarshal(data []byte) error {
err := proto.Unmarshal(data, this.Datas)
if err == nil {
this.arrangeData()
}
return err
}
func (this *DB_DiamondLotteryMgr) reunmarshal(data []byte) error {
newDatas := &server.DB_DiamondLotteryArray{}
err := proto.Unmarshal(data, newDatas)
if err == nil {
for _, item := range newDatas.Arr {
existItem := this.GetData(item.GetId())
if existItem == nil {
this.pool[item.GetId()] = item
this.Datas.Arr = append(this.Datas.Arr, item)
} else {
*existItem = *item
}
}
}
return err
}
func (this *DB_DiamondLotteryMgr) arrangeData() {
if this.Datas == nil {
return
}
dataArr := this.Datas.GetArr()
if dataArr == nil {
return
}
for _, data := range dataArr {
this.pool[data.GetId()] = data
}
}
func (this *DB_DiamondLotteryMgr) GetData(id int32) *server.DB_DiamondLottery {
if data, ok := this.pool[id]; ok {
return data
}
return nil
}
func init() {
DataMgr.register("DB_DiamondLottery.dat", &ProtobufDataLoader{dh: PBDB_DiamondLotteryMgr})
}

View File

@ -306,25 +306,13 @@ func CSUpBagInfo(s *netlib.Session, packetid int, data interface{}, sid int64) e
send() send()
return nil return nil
} }
bagInfo, _, isF := BagMgrSingleton.AddItemsV2(&ItemParam{ _, _, isF := BagMgrSingleton.AddItem(p, int64(msg.ItemId), int64(-1), 0, common.GainWayItemChange, "sys", "背包内使用兑换", 0, 0, false)
P: p,
Change: []*Item{
{
ItemId: msg.GetItemId(),
ItemNum: -1,
},
},
GainWay: common.GainWayItemChange,
Operator: "system",
Remark: "背包内使用兑换",
noLog: false,
})
if isF { if isF {
pack.RetCode = bag.OpResultCode_OPRC_Sucess pack.RetCode = bag.OpResultCode_OPRC_Sucess
pack.NowItemId = item.ItemId pack.NowItemId = item.ItemId
pack.NowItemNum = item.ItemNum pack.NowItemNum = item.ItemNum
//获取兑换码 //获取兑换码
BagMgrSingleton.ItemExchangeCard(p, msg.ItemId, int32(itemInfo.Num), msg.CardType, bagInfo.LogId) BagMgrSingleton.ItemExchangeCard(p, msg.ItemId, int32(itemInfo.Num), msg.CardType)
} }
} }
send() send()

View File

@ -4,10 +4,12 @@ import (
"errors" "errors"
"fmt" "fmt"
"math" "math"
webapiproto "mongo.games.com/game/protocol/webapi"
"mongo.games.com/game/webapi"
"mongo.games.com/game/worldsrv/internal"
"strconv" "strconv"
"time" "time"
"github.com/globalsign/mgo/bson"
"mongo.games.com/goserver/core/basic" "mongo.games.com/goserver/core/basic"
"mongo.games.com/goserver/core/i18n" "mongo.games.com/goserver/core/i18n"
"mongo.games.com/goserver/core/logger" "mongo.games.com/goserver/core/logger"
@ -19,10 +21,7 @@ import (
"mongo.games.com/game/proto" "mongo.games.com/game/proto"
"mongo.games.com/game/protocol/bag" "mongo.games.com/game/protocol/bag"
playerproto "mongo.games.com/game/protocol/player" playerproto "mongo.games.com/game/protocol/player"
webapiproto "mongo.games.com/game/protocol/webapi"
"mongo.games.com/game/srvdata" "mongo.games.com/game/srvdata"
"mongo.games.com/game/webapi"
"mongo.games.com/game/worldsrv/internal"
) )
const ( const (
@ -64,7 +63,6 @@ type BagInfo struct {
Platform string //平台 Platform string //平台
BagItem map[int32]*Item //背包数据 key为itemId BagItem map[int32]*Item //背包数据 key为itemId
dirty bool dirty bool
LogId string `bson:"-"`
} }
// BagMgrSingleton 背包管理器 // BagMgrSingleton 背包管理器
@ -150,18 +148,15 @@ type ItemParam struct {
Operator, Remark string // 操作人,备注 Operator, Remark string // 操作人,备注
gameId, gameFreeId int64 // 游戏id,场次id gameId, gameFreeId int64 // 游戏id,场次id
noLog bool // 是否不记录日志 noLog bool // 是否不记录日志
LogId string // 撤销的id,道具兑换失败
} }
type AddItemParam struct { type AddItemParam struct {
Cost []*model.ItemInfo // 获得道具时消耗的道具数量 Cost []*model.ItemInfo // 获得道具时消耗的道具数量
LogId string
} }
func (this *BagMgr) AddItemsV2(args *ItemParam) (*BagInfo, bag.OpResultCode, bool) { func (this *BagMgr) AddItemsV2(args *ItemParam) (*BagInfo, bag.OpResultCode, bool) {
return this.AddItems(args.P, args.Change, args.Add, args.GainWay, args.Operator, args.Remark, args.gameId, args.gameFreeId, args.noLog, AddItemParam{ return this.AddItems(args.P, args.Change, args.Add, args.GainWay, args.Operator, args.Remark, args.gameId, args.gameFreeId, args.noLog, AddItemParam{
Cost: args.Cost, Cost: args.Cost,
LogId: args.LogId,
}) })
} }
@ -177,10 +172,8 @@ func (this *BagMgr) AddItemsV2(args *ItemParam) (*BagInfo, bag.OpResultCode, boo
func (this *BagMgr) AddItems(p *Player, addItems []*Item, add int64, gainWay int32, operator, remark string, func (this *BagMgr) AddItems(p *Player, addItems []*Item, add int64, gainWay int32, operator, remark string,
gameId, gameFreeId int64, noLog bool, params ...AddItemParam) (*BagInfo, bag.OpResultCode, bool) { gameId, gameFreeId int64, noLog bool, params ...AddItemParam) (*BagInfo, bag.OpResultCode, bool) {
var cost []*model.ItemInfo var cost []*model.ItemInfo
var id string
if len(params) > 0 { if len(params) > 0 {
cost = params[0].Cost cost = params[0].Cost
id = params[0].LogId
} }
var items []*Item var items []*Item
@ -230,7 +223,6 @@ func (this *BagMgr) AddItems(p *Player, addItems []*Item, add int64, gainWay int
var permitScore, long int64 var permitScore, long int64
var changeItems []int32 var changeItems []int32
var newBagInfo *BagInfo var newBagInfo *BagInfo
var logId string
if _, exist := this.PlayerBag[p.SnId]; !exist { if _, exist := this.PlayerBag[p.SnId]; !exist {
newBagInfo = &BagInfo{ newBagInfo = &BagInfo{
SnId: p.SnId, SnId: p.SnId,
@ -317,11 +309,9 @@ func (this *BagMgr) AddItems(p *Player, addItems []*Item, add int64, gainWay int
GameId: gameId, GameId: gameId,
GameFreeId: gameFreeId, GameFreeId: gameFreeId,
Cost: cost, Cost: cost,
LogId: id,
}) })
if log != nil { if log != nil {
LogChannelSingleton.WriteLog(log) LogChannelSingleton.WriteLog(log)
logId = log.LogId.Hex()
} }
} }
@ -352,7 +342,6 @@ func (this *BagMgr) AddItems(p *Player, addItems []*Item, add int64, gainWay int
if len(changeItems) > 0 { if len(changeItems) > 0 {
newBagInfo.dirty = true newBagInfo.dirty = true
newBagInfo.LogId = logId
p.dirty = true p.dirty = true
this.PlayerBag[p.SnId] = newBagInfo this.PlayerBag[p.SnId] = newBagInfo
this.SyncBagData(p.SnId, changeItems...) this.SyncBagData(p.SnId, changeItems...)
@ -617,7 +606,7 @@ func (this *BagMgr) SyncBagData(snid int32, changeItemIds ...int32) {
} }
// 兑换话费卡 // 兑换话费卡
func (this *BagMgr) ItemExchangeCard(p *Player, itemId int32, money, cardType int32, logId string) bool { func (this *BagMgr) ItemExchangeCard(p *Player, itemId int32, money, cardType int32) bool {
// 兑换码奖品 // 兑换码奖品
var err error var err error
var newMsg *model.Message var newMsg *model.Message
@ -672,30 +661,10 @@ func (this *BagMgr) ItemExchangeCard(p *Player, itemId int32, money, cardType in
ItemNum: 1, // 数量 ItemNum: 1, // 数量
ObtainTime: time.Now().Unix(), ObtainTime: time.Now().Unix(),
}) })
this.AddItemsV2(&ItemParam{ this.AddItems(p, items, 0, common.GainWayItemChange, "system", "背包内使用兑换失败", 0, 0, false)
P: p,
Change: items,
Add: 0,
GainWay: common.GainWayItemChange,
Operator: "system",
Remark: "背包内使用兑换失败",
gameId: 0,
gameFreeId: 0,
noLog: false,
LogId: logId,
})
logger.Logger.Errorf("获取兑换码失败 snid:%v itemID:%v res:%v err:%v", p.SnId, itemId, res, err) logger.Logger.Errorf("获取兑换码失败 snid:%v itemID:%v res:%v err:%v", p.SnId, itemId, res, err)
pack.RetCode = bag.OpResultCode_OPRC_Error pack.RetCode = bag.OpResultCode_OPRC_Error
p.SendToClient(int(bag.SPacketID_PACKET_SC_ITEM_EXCHANGE_RES), pack) p.SendToClient(int(bag.SPacketID_PACKET_SC_ITEM_EXCHANGE_RES), pack)
// 标记兑换失败
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
model.UpdateItemState(&model.UpdateParam{
Platform: p.Platform,
LogId: bson.ObjectIdHex(logId),
State: 1,
})
return nil
}), nil).Start()
return return
} }
p := PlayerMgrSington.GetPlayerBySnId(p.SnId) p := PlayerMgrSington.GetPlayerBySnId(p.SnId)

BIN
xlsx/DB_DiamondLottery.xlsx Normal file

Binary file not shown.