背包兑换娃娃

This commit is contained in:
by 2024-09-19 13:35:34 +08:00
parent 02365888a1
commit 2925465b41
8 changed files with 755 additions and 39 deletions

View File

@ -315,7 +315,8 @@ const (
GainWayRoomGain = 107 //房卡场获得
GainWayItemShop = 108 // 交易市场道具交易
GainWayClawdoorCostItem = 109 // 娃娃机上分扣道具
GainWayItemChangeDoll = 110 // 道具兑换娃娃
GainWayItemShopChangeDoll = 110 // 商城兑换娃娃
GainWayItemBagChangeDoll = 111 // 背包内兑换娃娃
)
// 后台选择 金币变化类型 的充值 类型id号起始
@ -596,8 +597,8 @@ const (
ItemTypeExpireTime = 15 // 时效类道具
ItemTypeObjective = 16 // 目标类道具
ItemTypeChange = 17 // 兑换话费
ItemTypeMachine = 18 //娃娃兑换
ItemTypeSkinChip = 22 // 皮肤碎片
ItemTypeDoll = 26 //娃娃兑换
)
func GetKeyNoviceGameId(gameId int) string {

View File

@ -0,0 +1,73 @@
package svc
import (
"github.com/globalsign/mgo"
"github.com/globalsign/mgo/bson"
"mongo.games.com/game/dbproxy/mongo"
"mongo.games.com/game/model"
"mongo.games.com/goserver/core/logger"
"net/rpc"
)
func DbBagChangeDollLogCollection(plt string) *mongo.Collection {
s := mongo.MgoSessionMgrSington.GetPltMgoSession(plt, model.BagChangeDollLogDBName)
if s != nil {
dollRec, first := s.DB().C(model.BagChangeDollLogCollName)
if first {
dollRec.EnsureIndex(mgo.Index{Key: []string{"snid"}, Background: true, Sparse: true})
}
return dollRec
}
return nil
}
type DbBagChangeDollLogSvc struct {
}
func (svc *DbBagChangeDollLogSvc) InsertDbBagChangeDollLog(args *model.DbBagChangeDollLogArgs, ret *bool) (err error) {
clog := DbBagChangeDollLogCollection(args.Log.Platform)
if clog == nil {
return
}
logger.Logger.Trace("DbBagChangeDollLogSvc.InsertDbBagChangeDollLog")
err = clog.Insert(args.Log)
if err != nil {
logger.Logger.Error("DbBagChangeDollLogSvc.InsertDbBagChangeDollLog error:", err)
return
}
*ret = true
return
}
func (svc *DbBagChangeDollLogSvc) GetDbBagChangeDollLog(args *model.DbBagChangeDollLogArgs, dollLog []*model.BagChangeDollLog) (err error) {
clog := DbBagChangeDollLogCollection(args.Log.Platform)
if clog == nil {
logger.Logger.Error("GetDbBagChangeDollLog == nil")
return nil
}
logger.Logger.Trace("DbBagChangeDollLogSvc.GetDbBagChangeDollLog")
err = clog.Find(bson.M{"_id": args.Log.Snid}).All(dollLog)
if err != nil {
logger.Logger.Error("DbBagChangeDollLogSvc.GetDbBagChangeDollLog error:", err)
return nil
}
return
}
func (svc *DbBagChangeDollLogSvc) UpdateDbShopState(args *model.DbBagChangeDollLogArgs, ret *bool) (err error) {
clog := DbBagChangeDollLogCollection(args.Log.Platform)
if clog == nil {
logger.Logger.Error("UpdateDbShopState == nil")
return nil
}
logger.Logger.Trace("DbBagChangeDollLogSvc.UpdateDbShopState")
err = clog.UpdateId(args.Log.LogId, bson.M{"$set": bson.M{"state": args.Log.State}})
if err != nil {
logger.Logger.Error("DbBagChangeDollLogSvc.UpdateDbShopState error:", err)
return nil
}
*ret = true
return
}
func init() {
rpc.Register(new(DbBagChangeDollLogSvc))
}

83
model/bagchangedolllog.go Normal file
View File

@ -0,0 +1,83 @@
package model
import (
"github.com/globalsign/mgo/bson"
"mongo.games.com/goserver/core/logger"
"time"
)
type BagChangeDollLog struct {
LogId bson.ObjectId `bson:"_id"`
Platform string //平台
Snid int32 //用户id
ItemId int32
ItemNum int32
UserName string //姓名
UserTel string //手机号
Addr string //地址
State int32 //状态 0.默认 1.成功 2.失败 3.未发货准备发货
Remark string //备注信息
CreateTs time.Time //订单生成时间
OpTs time.Time //订单最后操作时间
Ts int64
}
var (
BagChangeDollLogDBName = "log"
BagChangeDollLogCollName = "log_bagChangeDoll"
)
type DbBagChangeDollLogArgs struct {
Log *BagChangeDollLog
}
func NewDbBagChangeDoll(platform string, snid, itemId, itemNum int32, state int32, remark string, addr string, userName string, userTel string) *BagChangeDollLog {
t := time.Now()
return &BagChangeDollLog{
LogId: bson.NewObjectId(),
Platform: platform,
Snid: snid,
ItemId: itemId,
ItemNum: itemNum,
State: state,
UserName: userName,
UserTel: userTel,
Addr: addr,
Remark: remark,
CreateTs: t,
OpTs: t,
Ts: t.Unix(),
}
}
func InsertDbBagChangeDollLog(log *BagChangeDollLog) (err error) {
if rpcCli == nil {
logger.Logger.Error("model.InsertDbBagChangeDollLog rpcCli == nil")
return
}
var ret bool
args := &DbBagChangeDollLogArgs{
Log: log,
}
err = rpcCli.CallWithTimeout("DbBagChangeDollLogSvc.InsertDbBagChangeDollLog", args, &ret, time.Second*30)
if err != nil {
logger.Logger.Warn("InsertDbBagChangeDollLog error:", err)
return
}
return
}
func GetDbBagChangeDollLog(platform string, snid int32) []*BagChangeDollLog {
if rpcCli == nil {
logger.Logger.Error("model.GetDbBagChangeDollLog rpcCli == nil")
return nil
}
var ret []*BagChangeDollLog
args := &DbBagChangeDollLogArgs{
Log: &BagChangeDollLog{Snid: snid, Platform: platform},
}
err := rpcCli.CallWithTimeout("DbBagChangeDollLogSvc.GetDbBagChangeDollLog", args, &ret, time.Second*30)
if err != nil {
logger.Logger.Warn("GetDbBagChangeDollLog error:", err)
return nil
}
return ret
}

View File

@ -96,8 +96,12 @@ const (
SPacketID_PACKET_SC_ITEM_EXCHANGE_RES SPacketID = 2533 //背包道具兑换返回
SPacketID_PACKET_ALL_BAG_END SPacketID = 2549 //最大消息号
//3000~3099
SPacketID_PACKET_PropExchange SPacketID = 3000 // 道具兑换
SPacketID_PACKET_ExchangeList SPacketID = 3001 // 兑换列表
SPacketID_PACKET_PropExchange SPacketID = 3000 // 道具兑换
SPacketID_PACKET_ExchangeList SPacketID = 3001 // 兑换列表
SPacketID_PACKET_CS_DollChange SPacketID = 3002 //娃娃卡兑换
SPacketID_PACKET_SC_DollChange SPacketID = 3003 //娃娃卡兑换返回
SPacketID_PACKET_CS_DollChangeLog SPacketID = 3004 //娃娃卡兑换记录
SPacketID_PACKET_SC_DollChangeLog SPacketID = 3005 //娃娃卡兑换记录返回
)
// Enum value maps for SPacketID.
@ -111,6 +115,10 @@ var (
2549: "PACKET_ALL_BAG_END",
3000: "PACKET_PropExchange",
3001: "PACKET_ExchangeList",
3002: "PACKET_CS_DollChange",
3003: "PACKET_SC_DollChange",
3004: "PACKET_CS_DollChangeLog",
3005: "PACKET_SC_DollChangeLog",
}
SPacketID_value = map[string]int32{
"PACKET_BAG_ZERO": 0,
@ -121,6 +129,10 @@ var (
"PACKET_ALL_BAG_END": 2549,
"PACKET_PropExchange": 3000,
"PACKET_ExchangeList": 3001,
"PACKET_CS_DollChange": 3002,
"PACKET_SC_DollChange": 3003,
"PACKET_CS_DollChangeLog": 3004,
"PACKET_SC_DollChangeLog": 3005,
}
)
@ -972,6 +984,334 @@ func (x *SCExchangeList) GetTp() int32 {
return 0
}
//娃娃卡兑换
//PACKET_CS_DollChange
type CSDollChange struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ItemId int32 `protobuf:"varint,1,opt,name=ItemId,proto3" json:"ItemId,omitempty"`
ItemNum int32 `protobuf:"varint,2,opt,name=ItemNum,proto3" json:"ItemNum,omitempty"`
UserName string `protobuf:"bytes,3,opt,name=UserName,proto3" json:"UserName,omitempty"` //姓名
UserTel string `protobuf:"bytes,4,opt,name=UserTel,proto3" json:"UserTel,omitempty"` //电话
Addr string `protobuf:"bytes,5,opt,name=Addr,proto3" json:"Addr,omitempty"` //地址
}
func (x *CSDollChange) Reset() {
*x = CSDollChange{}
if protoimpl.UnsafeEnabled {
mi := &file_bag_proto_msgTypes[13]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CSDollChange) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CSDollChange) ProtoMessage() {}
func (x *CSDollChange) ProtoReflect() protoreflect.Message {
mi := &file_bag_proto_msgTypes[13]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CSDollChange.ProtoReflect.Descriptor instead.
func (*CSDollChange) Descriptor() ([]byte, []int) {
return file_bag_proto_rawDescGZIP(), []int{13}
}
func (x *CSDollChange) GetItemId() int32 {
if x != nil {
return x.ItemId
}
return 0
}
func (x *CSDollChange) GetItemNum() int32 {
if x != nil {
return x.ItemNum
}
return 0
}
func (x *CSDollChange) GetUserName() string {
if x != nil {
return x.UserName
}
return ""
}
func (x *CSDollChange) GetUserTel() string {
if x != nil {
return x.UserTel
}
return ""
}
func (x *CSDollChange) GetAddr() string {
if x != nil {
return x.Addr
}
return ""
}
//PACKET_SC_DollChange
type SCDollChange struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
RetCode OpResultCode `protobuf:"varint,1,opt,name=RetCode,proto3,enum=bag.OpResultCode" json:"RetCode,omitempty"`
}
func (x *SCDollChange) Reset() {
*x = SCDollChange{}
if protoimpl.UnsafeEnabled {
mi := &file_bag_proto_msgTypes[14]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SCDollChange) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SCDollChange) ProtoMessage() {}
func (x *SCDollChange) ProtoReflect() protoreflect.Message {
mi := &file_bag_proto_msgTypes[14]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SCDollChange.ProtoReflect.Descriptor instead.
func (*SCDollChange) Descriptor() ([]byte, []int) {
return file_bag_proto_rawDescGZIP(), []int{14}
}
func (x *SCDollChange) GetRetCode() OpResultCode {
if x != nil {
return x.RetCode
}
return OpResultCode_OPRC_Sucess
}
//娃娃卡兑换记录
//PACKET_CS_DollChangeLog
type CSDollChangeLog struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *CSDollChangeLog) Reset() {
*x = CSDollChangeLog{}
if protoimpl.UnsafeEnabled {
mi := &file_bag_proto_msgTypes[15]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CSDollChangeLog) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CSDollChangeLog) ProtoMessage() {}
func (x *CSDollChangeLog) ProtoReflect() protoreflect.Message {
mi := &file_bag_proto_msgTypes[15]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CSDollChangeLog.ProtoReflect.Descriptor instead.
func (*CSDollChangeLog) Descriptor() ([]byte, []int) {
return file_bag_proto_rawDescGZIP(), []int{15}
}
//PACKET_SC_DollChangeLog
type SCDillChangeLog struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Info []*DillChangeLogInfo `protobuf:"bytes,1,rep,name=Info,proto3" json:"Info,omitempty"`
}
func (x *SCDillChangeLog) Reset() {
*x = SCDillChangeLog{}
if protoimpl.UnsafeEnabled {
mi := &file_bag_proto_msgTypes[16]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SCDillChangeLog) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SCDillChangeLog) ProtoMessage() {}
func (x *SCDillChangeLog) ProtoReflect() protoreflect.Message {
mi := &file_bag_proto_msgTypes[16]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SCDillChangeLog.ProtoReflect.Descriptor instead.
func (*SCDillChangeLog) Descriptor() ([]byte, []int) {
return file_bag_proto_rawDescGZIP(), []int{16}
}
func (x *SCDillChangeLog) GetInfo() []*DillChangeLogInfo {
if x != nil {
return x.Info
}
return nil
}
type DillChangeLogInfo struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ItemId int32 `protobuf:"varint,1,opt,name=ItemId,proto3" json:"ItemId,omitempty"`
ItemNum int32 `protobuf:"varint,2,opt,name=ItemNum,proto3" json:"ItemNum,omitempty"`
State int32 `protobuf:"varint,3,opt,name=State,proto3" json:"State,omitempty"`
UserName string `protobuf:"bytes,4,opt,name=UserName,proto3" json:"UserName,omitempty"`
UserTel string `protobuf:"bytes,5,opt,name=UserTel,proto3" json:"UserTel,omitempty"`
Addr string `protobuf:"bytes,6,opt,name=Addr,proto3" json:"Addr,omitempty"`
CreateTs string `protobuf:"bytes,7,opt,name=CreateTs,proto3" json:"CreateTs,omitempty"`
OpTs string `protobuf:"bytes,8,opt,name=OpTs,proto3" json:"OpTs,omitempty"`
Remark string `protobuf:"bytes,9,opt,name=Remark,proto3" json:"Remark,omitempty"` //备注信息
}
func (x *DillChangeLogInfo) Reset() {
*x = DillChangeLogInfo{}
if protoimpl.UnsafeEnabled {
mi := &file_bag_proto_msgTypes[17]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DillChangeLogInfo) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DillChangeLogInfo) ProtoMessage() {}
func (x *DillChangeLogInfo) ProtoReflect() protoreflect.Message {
mi := &file_bag_proto_msgTypes[17]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DillChangeLogInfo.ProtoReflect.Descriptor instead.
func (*DillChangeLogInfo) Descriptor() ([]byte, []int) {
return file_bag_proto_rawDescGZIP(), []int{17}
}
func (x *DillChangeLogInfo) GetItemId() int32 {
if x != nil {
return x.ItemId
}
return 0
}
func (x *DillChangeLogInfo) GetItemNum() int32 {
if x != nil {
return x.ItemNum
}
return 0
}
func (x *DillChangeLogInfo) GetState() int32 {
if x != nil {
return x.State
}
return 0
}
func (x *DillChangeLogInfo) GetUserName() string {
if x != nil {
return x.UserName
}
return ""
}
func (x *DillChangeLogInfo) GetUserTel() string {
if x != nil {
return x.UserTel
}
return ""
}
func (x *DillChangeLogInfo) GetAddr() string {
if x != nil {
return x.Addr
}
return ""
}
func (x *DillChangeLogInfo) GetCreateTs() string {
if x != nil {
return x.CreateTs
}
return ""
}
func (x *DillChangeLogInfo) GetOpTs() string {
if x != nil {
return x.OpTs
}
return ""
}
func (x *DillChangeLogInfo) GetRemark() string {
if x != nil {
return x.Remark
}
return ""
}
var File_bag_proto protoreflect.FileDescriptor
var file_bag_proto_rawDesc = []byte{
@ -1057,33 +1397,73 @@ var file_bag_proto_rawDesc = []byte{
0x49, 0x6e, 0x66, 0x6f, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x62, 0x61,
0x67, 0x2e, 0x45, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05,
0x49, 0x6e, 0x66, 0x6f, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x54, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28,
0x05, 0x52, 0x02, 0x54, 0x70, 0x2a, 0x99, 0x01, 0x0a, 0x0c, 0x4f, 0x70, 0x52, 0x65, 0x73, 0x75,
0x6c, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x53,
0x75, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x4f, 0x50, 0x52, 0x43, 0x5f,
0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x4f, 0x50, 0x52, 0x43, 0x5f,
0x55, 0x73, 0x65, 0x55, 0x70, 0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x4f, 0x50, 0x52, 0x43, 0x5f,
0x49, 0x64, 0x45, 0x72, 0x72, 0x10, 0x03, 0x12, 0x0e, 0x0a, 0x0a, 0x4f, 0x50, 0x52, 0x43, 0x5f,
0x44, 0x62, 0x45, 0x72, 0x72, 0x10, 0x04, 0x12, 0x10, 0x0a, 0x0c, 0x4f, 0x50, 0x52, 0x43, 0x5f,
0x42, 0x61, 0x67, 0x46, 0x75, 0x6c, 0x6c, 0x10, 0x05, 0x12, 0x12, 0x0a, 0x0e, 0x4f, 0x50, 0x52,
0x43, 0x5f, 0x4e, 0x6f, 0x74, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x10, 0x06, 0x12, 0x12, 0x0a,
0x0e, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x4e, 0x6f, 0x74, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x10,
0x07, 0x2a, 0xde, 0x01, 0x0a, 0x09, 0x53, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x49, 0x44, 0x12,
0x13, 0x0a, 0x0f, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x42, 0x41, 0x47, 0x5f, 0x5a, 0x45,
0x52, 0x4f, 0x10, 0x00, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x41,
0x4c, 0x4c, 0x5f, 0x42, 0x41, 0x47, 0x5f, 0x49, 0x4e, 0x46, 0x4f, 0x10, 0xe2, 0x13, 0x12, 0x17,
0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x41, 0x4c, 0x4c, 0x5f, 0x42, 0x41, 0x47,
0x5f, 0x55, 0x53, 0x45, 0x10, 0xe3, 0x13, 0x12, 0x1a, 0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b, 0x45,
0x54, 0x5f, 0x53, 0x43, 0x5f, 0x53, 0x59, 0x4e, 0x43, 0x42, 0x41, 0x47, 0x44, 0x41, 0x54, 0x41,
0x10, 0xe4, 0x13, 0x12, 0x20, 0x0a, 0x1b, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43,
0x5f, 0x49, 0x54, 0x45, 0x4d, 0x5f, 0x45, 0x58, 0x43, 0x48, 0x41, 0x4e, 0x47, 0x45, 0x5f, 0x52,
0x45, 0x53, 0x10, 0xe5, 0x13, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f,
0x41, 0x4c, 0x4c, 0x5f, 0x42, 0x41, 0x47, 0x5f, 0x45, 0x4e, 0x44, 0x10, 0xf5, 0x13, 0x12, 0x18,
0x0a, 0x13, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x50, 0x72, 0x6f, 0x70, 0x45, 0x78, 0x63,
0x68, 0x61, 0x6e, 0x67, 0x65, 0x10, 0xb8, 0x17, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x41, 0x43, 0x4b,
0x45, 0x54, 0x5f, 0x45, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x10,
0xb9, 0x17, 0x42, 0x23, 0x5a, 0x21, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x67, 0x61, 0x6d, 0x65,
0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x63, 0x6f, 0x6c, 0x2f, 0x62, 0x61, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x05, 0x52, 0x02, 0x54, 0x70, 0x22, 0x8a, 0x01, 0x0a, 0x0c, 0x43, 0x53, 0x44, 0x6f, 0x6c, 0x6c,
0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64, 0x12, 0x18,
0x0a, 0x07, 0x49, 0x74, 0x65, 0x6d, 0x4e, 0x75, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52,
0x07, 0x49, 0x74, 0x65, 0x6d, 0x4e, 0x75, 0x6d, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72,
0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x55, 0x73, 0x65, 0x72,
0x4e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x55, 0x73, 0x65, 0x72, 0x54, 0x65, 0x6c, 0x18,
0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x55, 0x73, 0x65, 0x72, 0x54, 0x65, 0x6c, 0x12, 0x12,
0x0a, 0x04, 0x41, 0x64, 0x64, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x41, 0x64,
0x64, 0x72, 0x22, 0x3b, 0x0a, 0x0c, 0x53, 0x43, 0x44, 0x6f, 0x6c, 0x6c, 0x43, 0x68, 0x61, 0x6e,
0x67, 0x65, 0x12, 0x2b, 0x0a, 0x07, 0x52, 0x65, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20,
0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x62, 0x61, 0x67, 0x2e, 0x4f, 0x70, 0x52, 0x65, 0x73, 0x75,
0x6c, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x07, 0x52, 0x65, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x22,
0x11, 0x0a, 0x0f, 0x43, 0x53, 0x44, 0x6f, 0x6c, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x4c,
0x6f, 0x67, 0x22, 0x3d, 0x0a, 0x0f, 0x53, 0x43, 0x44, 0x69, 0x6c, 0x6c, 0x43, 0x68, 0x61, 0x6e,
0x67, 0x65, 0x4c, 0x6f, 0x67, 0x12, 0x2a, 0x0a, 0x04, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20,
0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x62, 0x61, 0x67, 0x2e, 0x44, 0x69, 0x6c, 0x6c, 0x43, 0x68,
0x61, 0x6e, 0x67, 0x65, 0x4c, 0x6f, 0x67, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x49, 0x6e, 0x66,
0x6f, 0x22, 0xed, 0x01, 0x0a, 0x11, 0x44, 0x69, 0x6c, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65,
0x4c, 0x6f, 0x67, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x49, 0x74, 0x65, 0x6d, 0x49,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64, 0x12,
0x18, 0x0a, 0x07, 0x49, 0x74, 0x65, 0x6d, 0x4e, 0x75, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05,
0x52, 0x07, 0x49, 0x74, 0x65, 0x6d, 0x4e, 0x75, 0x6d, 0x12, 0x14, 0x0a, 0x05, 0x53, 0x74, 0x61,
0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12,
0x1a, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28,
0x09, 0x52, 0x08, 0x55, 0x73, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x55,
0x73, 0x65, 0x72, 0x54, 0x65, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x55, 0x73,
0x65, 0x72, 0x54, 0x65, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x41, 0x64, 0x64, 0x72, 0x18, 0x06, 0x20,
0x01, 0x28, 0x09, 0x52, 0x04, 0x41, 0x64, 0x64, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x43, 0x72, 0x65,
0x61, 0x74, 0x65, 0x54, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x43, 0x72, 0x65,
0x61, 0x74, 0x65, 0x54, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x4f, 0x70, 0x54, 0x73, 0x18, 0x08, 0x20,
0x01, 0x28, 0x09, 0x52, 0x04, 0x4f, 0x70, 0x54, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x52, 0x65, 0x6d,
0x61, 0x72, 0x6b, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x52, 0x65, 0x6d, 0x61, 0x72,
0x6b, 0x2a, 0x99, 0x01, 0x0a, 0x0c, 0x4f, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x43, 0x6f,
0x64, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x53, 0x75, 0x63, 0x65, 0x73,
0x73, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x45, 0x72, 0x72, 0x6f,
0x72, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x55, 0x73, 0x65, 0x55,
0x70, 0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x49, 0x64, 0x45, 0x72,
0x72, 0x10, 0x03, 0x12, 0x0e, 0x0a, 0x0a, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x44, 0x62, 0x45, 0x72,
0x72, 0x10, 0x04, 0x12, 0x10, 0x0a, 0x0c, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x42, 0x61, 0x67, 0x46,
0x75, 0x6c, 0x6c, 0x10, 0x05, 0x12, 0x12, 0x0a, 0x0e, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x4e, 0x6f,
0x74, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x10, 0x06, 0x12, 0x12, 0x0a, 0x0e, 0x4f, 0x50, 0x52,
0x43, 0x5f, 0x4e, 0x6f, 0x74, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x10, 0x07, 0x2a, 0xd0, 0x02,
0x0a, 0x09, 0x53, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x49, 0x44, 0x12, 0x13, 0x0a, 0x0f, 0x50,
0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x42, 0x41, 0x47, 0x5f, 0x5a, 0x45, 0x52, 0x4f, 0x10, 0x00,
0x12, 0x18, 0x0a, 0x13, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x41, 0x4c, 0x4c, 0x5f, 0x42,
0x41, 0x47, 0x5f, 0x49, 0x4e, 0x46, 0x4f, 0x10, 0xe2, 0x13, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x41,
0x43, 0x4b, 0x45, 0x54, 0x5f, 0x41, 0x4c, 0x4c, 0x5f, 0x42, 0x41, 0x47, 0x5f, 0x55, 0x53, 0x45,
0x10, 0xe3, 0x13, 0x12, 0x1a, 0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43,
0x5f, 0x53, 0x59, 0x4e, 0x43, 0x42, 0x41, 0x47, 0x44, 0x41, 0x54, 0x41, 0x10, 0xe4, 0x13, 0x12,
0x20, 0x0a, 0x1b, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x49, 0x54, 0x45,
0x4d, 0x5f, 0x45, 0x58, 0x43, 0x48, 0x41, 0x4e, 0x47, 0x45, 0x5f, 0x52, 0x45, 0x53, 0x10, 0xe5,
0x13, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x41, 0x4c, 0x4c, 0x5f,
0x42, 0x41, 0x47, 0x5f, 0x45, 0x4e, 0x44, 0x10, 0xf5, 0x13, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x41,
0x43, 0x4b, 0x45, 0x54, 0x5f, 0x50, 0x72, 0x6f, 0x70, 0x45, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67,
0x65, 0x10, 0xb8, 0x17, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x45,
0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x10, 0xb9, 0x17, 0x12, 0x19,
0x0a, 0x14, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, 0x5f, 0x44, 0x6f, 0x6c, 0x6c,
0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x10, 0xba, 0x17, 0x12, 0x19, 0x0a, 0x14, 0x50, 0x41, 0x43,
0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x44, 0x6f, 0x6c, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x67,
0x65, 0x10, 0xbb, 0x17, 0x12, 0x1c, 0x0a, 0x17, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43,
0x53, 0x5f, 0x44, 0x6f, 0x6c, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x4c, 0x6f, 0x67, 0x10,
0xbc, 0x17, 0x12, 0x1c, 0x0a, 0x17, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f,
0x44, 0x6f, 0x6c, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x4c, 0x6f, 0x67, 0x10, 0xbd, 0x17,
0x42, 0x23, 0x5a, 0x21, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x67, 0x61, 0x6d, 0x65, 0x73, 0x2e,
0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f,
0x6c, 0x2f, 0x62, 0x61, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -1099,7 +1479,7 @@ func file_bag_proto_rawDescGZIP() []byte {
}
var file_bag_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
var file_bag_proto_msgTypes = make([]protoimpl.MessageInfo, 13)
var file_bag_proto_msgTypes = make([]protoimpl.MessageInfo, 18)
var file_bag_proto_goTypes = []interface{}{
(OpResultCode)(0), // 0: bag.OpResultCode
(SPacketID)(0), // 1: bag.SPacketID
@ -1116,6 +1496,11 @@ var file_bag_proto_goTypes = []interface{}{
(*ExchangeInfo)(nil), // 12: bag.ExchangeInfo
(*CSExchangeList)(nil), // 13: bag.CSExchangeList
(*SCExchangeList)(nil), // 14: bag.SCExchangeList
(*CSDollChange)(nil), // 15: bag.CSDollChange
(*SCDollChange)(nil), // 16: bag.SCDollChange
(*CSDollChangeLog)(nil), // 17: bag.CSDollChangeLog
(*SCDillChangeLog)(nil), // 18: bag.SCDillChangeLog
(*DillChangeLogInfo)(nil), // 19: bag.DillChangeLogInfo
}
var file_bag_proto_depIdxs = []int32{
0, // 0: bag.SCBagInfo.RetCode:type_name -> bag.OpResultCode
@ -1130,11 +1515,13 @@ var file_bag_proto_depIdxs = []int32{
9, // 9: bag.ExchangeInfo.CostItems:type_name -> bag.PropInfo
9, // 10: bag.ExchangeInfo.GainItems:type_name -> bag.PropInfo
12, // 11: bag.SCExchangeList.Infos:type_name -> bag.ExchangeInfo
12, // [12:12] is the sub-list for method output_type
12, // [12:12] is the sub-list for method input_type
12, // [12:12] is the sub-list for extension type_name
12, // [12:12] is the sub-list for extension extendee
0, // [0:12] is the sub-list for field type_name
0, // 12: bag.SCDollChange.RetCode:type_name -> bag.OpResultCode
19, // 13: bag.SCDillChangeLog.Info:type_name -> bag.DillChangeLogInfo
14, // [14:14] is the sub-list for method output_type
14, // [14:14] is the sub-list for method input_type
14, // [14:14] is the sub-list for extension type_name
14, // [14:14] is the sub-list for extension extendee
0, // [0:14] is the sub-list for field type_name
}
func init() { file_bag_proto_init() }
@ -1299,6 +1686,66 @@ func file_bag_proto_init() {
return nil
}
}
file_bag_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CSDollChange); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_bag_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SCDollChange); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_bag_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CSDollChangeLog); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_bag_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SCDillChangeLog); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_bag_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DillChangeLogInfo); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
@ -1306,7 +1753,7 @@ func file_bag_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_bag_proto_rawDesc,
NumEnums: 2,
NumMessages: 13,
NumMessages: 18,
NumExtensions: 0,
NumServices: 0,
},

View File

@ -23,6 +23,10 @@ enum SPacketID {
//3000~3099
PACKET_PropExchange = 3000; //
PACKET_ExchangeList = 3001; //
PACKET_CS_DollChange = 3002;//
PACKET_SC_DollChange = 3003;//
PACKET_CS_DollChangeLog = 3004;//
PACKET_SC_DollChangeLog = 3005;//
}
//
message ItemInfo{
@ -119,4 +123,37 @@ message CSExchangeList{
message SCExchangeList{
repeated ExchangeInfo Infos = 1; //
int32 Tp = 2; //
}
//
//PACKET_CS_DollChange
message CSDollChange{
int32 ItemId = 1;
int32 ItemNum = 2;
string UserName = 3;//
string UserTel = 4;//
string Addr = 5;//
}
//PACKET_SC_DollChange
message SCDollChange{
OpResultCode RetCode = 1;
}
//
//PACKET_CS_DollChangeLog
message CSDollChangeLog{
}
//PACKET_SC_DollChangeLog
message SCDillChangeLog{
repeated DillChangeLogInfo Info =1;
}
message DillChangeLogInfo{
int32 ItemId = 1;
int32 ItemNum = 2;
int32 State = 3;
string UserName = 4;
string UserTel = 5;
string Addr = 6;
string CreateTs = 7;
string OpTs =8;
string Remark = 9;//
}

View File

@ -915,6 +915,7 @@ message MachineInfo{
int32 CostItemNum = 5; //
int32 ItemId = 6; //Id
int32 ItemNum = 7; //
string IconAddr = 8;//
}
// etcd /game/match_audience
message MatchAudience {

View File

@ -506,6 +506,76 @@ func CSPropExchange(s *netlib.Session, packetid int, data interface{}, sid int64
return nil
}
// 兑换娃娃
func CSDollChange(s *netlib.Session, packetid int, data interface{}, sid int64) error {
msg, ok := data.(*bag.CSDollChange)
if !ok {
return nil
}
p := PlayerMgrSington.GetPlayer(sid)
if p == nil {
return nil
}
bagInfo, _, isF := BagMgrSingleton.AddItemsV2(&model.AddItemParam{
P: p.PlayerData,
Change: []*model.Item{
{
ItemId: msg.GetItemId(),
ItemNum: -1,
},
},
GainWay: common.GainWayItemBagChangeDoll,
Operator: "system",
Remark: "背包内使用兑换娃娃卡",
NoLog: false,
})
logger.Logger.Trace("背包内使用兑换娃娃卡 bagInfo = ", bagInfo)
pack := &bag.SCDollChange{}
pack.RetCode = bag.OpResultCode_OPRC_UseUp
if isF {
pack.RetCode = bag.OpResultCode_OPRC_Sucess
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
dollLog := model.NewDbBagChangeDoll(p.Platform, p.SnId, msg.ItemId, msg.ItemNum, 0, "", msg.Addr, msg.UserName, msg.UserTel)
return model.InsertDbBagChangeDollLog(dollLog)
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
if data != nil {
logger.Logger.Errorf("CSDollChange err: %v", data)
}
}), "CSDollChange").Start()
}
p.SendToClient(int(bag.SPacketID_PACKET_SC_DollChange), pack)
return nil
}
// 兑换娃娃记录
func CSDollChangeLog(s *netlib.Session, packetid int, data interface{}, sid int64) error {
p := PlayerMgrSington.GetPlayer(sid)
if p == nil {
return nil
}
pack := &bag.SCDillChangeLog{}
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
return model.GetDbBagChangeDollLog(p.Platform, p.SnId)
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
for _, log := range data.([]*model.BagChangeDollLog) {
info := &bag.DillChangeLogInfo{}
info.ItemId = log.ItemId
info.ItemNum = log.ItemNum
info.State = log.State
info.UserName = log.UserName
info.UserTel = log.UserTel
info.Addr = log.Addr
info.CreateTs = log.CreateTs.String()
info.OpTs = log.OpTs.String()
info.Remark = log.Remark
pack.Info = append(pack.Info, info)
}
}), "CSDollChange").Start()
p.SendToClient(int(bag.SPacketID_PACKET_SC_DollChangeLog), pack)
return nil
}
func init() {
// 查看背包
common.Register(int(bag.SPacketID_PACKET_ALL_BAG_INFO), &bag.CSBagInfo{}, CSBagInfo)
@ -515,4 +585,8 @@ func init() {
common.Register(int(bag.SPacketID_PACKET_ExchangeList), &bag.CSExchangeList{}, CSExchangeList)
// 道具兑换
common.Register(int(bag.SPacketID_PACKET_PropExchange), &bag.CSPropExchange{}, CSPropExchange)
//兑换娃娃
common.Register(int(bag.SPacketID_PACKET_CS_DollChange), &bag.CSDollChange{}, CSDollChange)
//兑换娃娃记录
common.Register(int(bag.SPacketID_PACKET_CS_DollChangeLog), &bag.CSDollChangeLog{}, CSDollChangeLog)
}

View File

@ -886,7 +886,7 @@ func (this *ShopMgr) Exchange(p *Player, goodsId int32, username, mobile, commen
ItemId: common.ItemDollCard,
ItemNum: int64(info.JPrice * num),
}
_, _, isF := BagMgrSingleton.AddItem(p, int64(item.ItemId), -item.ItemNum, 0, common.GainWayItemChangeDoll,
_, _, isF := BagMgrSingleton.AddItem(p, int64(item.ItemId), -item.ItemNum, 0, common.GainWayItemShopChangeDoll,
"sys", fmt.Sprintf("兑换娃娃扣除%v", item.ItemId), 0, 0, false)
if !isF { // 扣掉金券
pack.RetCode = shop.OpResultCode_OPRC_DCoinNotEnough