Compare commits
No commits in common. "151a739dab201f7bbbb9cdf49647248a52cf2917" and "03cd5dda2bdf8494a9656783062f428485a64860" have entirely different histories.
151a739dab
...
03cd5dda2b
|
@ -29,7 +29,6 @@ const (
|
||||||
TIenLenTianhuTimeout = time.Second * 2 // 天胡动画时长
|
TIenLenTianhuTimeout = time.Second * 2 // 天胡动画时长
|
||||||
TienLenHandNotExceedTimeLimit = time.Second * 3 //玩家没有牌可以接上家的牌,出牌时间上限
|
TienLenHandNotExceedTimeLimit = time.Second * 3 //玩家没有牌可以接上家的牌,出牌时间上限
|
||||||
TienLenHandAutoStateTimeOut = time.Second * 1 //玩家托管出牌时间上限
|
TienLenHandAutoStateTimeOut = time.Second * 1 //玩家托管出牌时间上限
|
||||||
TienLenCustomWaiteStatTimeout = time.Millisecond * 1500
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// 场景状态
|
// 场景状态
|
||||||
|
|
|
@ -3,8 +3,6 @@ package base
|
||||||
import (
|
import (
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"mongo.games.com/goserver/core/logger"
|
|
||||||
|
|
||||||
"mongo.games.com/game/model"
|
"mongo.games.com/game/model"
|
||||||
"mongo.games.com/game/mq"
|
"mongo.games.com/game/mq"
|
||||||
)
|
)
|
||||||
|
@ -40,7 +38,6 @@ func (c *LogChannel) WriteLog(log interface{}) {
|
||||||
if cname == "" {
|
if cname == "" {
|
||||||
cname = "_null_"
|
cname = "_null_"
|
||||||
}
|
}
|
||||||
logger.Logger.Tracef("LogChannel ==> %#v", log)
|
|
||||||
mq.Send(cname, log)
|
mq.Send(cname, log)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2114,7 +2114,6 @@ func (this *TienLenSceneData) SaveCustomLog() {
|
||||||
state = 1
|
state = 1
|
||||||
}
|
}
|
||||||
log := &model.CustomLog{
|
log := &model.CustomLog{
|
||||||
Platform: this.Platform,
|
|
||||||
CycleId: this.CycleID,
|
CycleId: this.CycleID,
|
||||||
RoomConfigId: this.GetCustom().GetRoomConfigId(),
|
RoomConfigId: this.GetCustom().GetRoomConfigId(),
|
||||||
RoomId: this.SceneId,
|
RoomId: this.SceneId,
|
||||||
|
|
|
@ -825,7 +825,7 @@ func (this *SceneWaitStartStateTienLen) OnEnter(s *base.Scene) {
|
||||||
if sceneEx, ok := s.GetExtraData().(*TienLenSceneData); ok {
|
if sceneEx, ok := s.GetExtraData().(*TienLenSceneData); ok {
|
||||||
sceneEx.Clear()
|
sceneEx.Clear()
|
||||||
sceneEx.SetGaming(false)
|
sceneEx.SetGaming(false)
|
||||||
this.BroadcastRoomState(s, this.GetState(), int64(sceneEx.NumOfGames))
|
this.BroadcastRoomState(s, this.GetState())
|
||||||
logger.Logger.Trace("(this *SceneWaitStartStateTienLen) OnEnter", this.GetState())
|
logger.Logger.Trace("(this *SceneWaitStartStateTienLen) OnEnter", this.GetState())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -914,12 +914,10 @@ func (this *SceneWaitStartStateTienLen) OnTick(s *base.Scene) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if sceneEx.IsCustom() {
|
if sceneEx.IsCustom() {
|
||||||
if time.Now().Sub(sceneEx.StateStartTime) > rule.TienLenCustomWaiteStatTimeout {
|
if sceneEx.CanStart() {
|
||||||
if sceneEx.CanStart() {
|
s.ChangeSceneState(rule.TienLenSceneStateHandCard)
|
||||||
s.ChangeSceneState(rule.TienLenSceneStateHandCard)
|
} else {
|
||||||
} else {
|
s.ChangeSceneState(rule.TienLenSceneStateWaitPlayer)
|
||||||
s.ChangeSceneState(rule.TienLenSceneStateWaitPlayer)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2610,7 +2608,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
|
||||||
if p != nil {
|
if p != nil {
|
||||||
var items []*model.Item
|
var items []*model.Item
|
||||||
for _, v := range packBilled.List[0].Award {
|
for _, v := range packBilled.List[0].Award {
|
||||||
itemData := srvdata.GameItemMgr.Get(p.Platform, v.GetId())
|
itemData := srvdata.GameItemMgr.Get(p.Platform, p.SnId)
|
||||||
if itemData != nil {
|
if itemData != nil {
|
||||||
items = append(items, &model.Item{
|
items = append(items, &model.Item{
|
||||||
ItemId: v.GetId(),
|
ItemId: v.GetId(),
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/globalsign/mgo/bson"
|
||||||
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
DbCustomLogDBName = "log"
|
DbCustomLogDBName = "log"
|
||||||
DbCustomLogCollName = "log_custom"
|
DbCustomLogCollName = "log_custom"
|
||||||
|
@ -18,18 +22,19 @@ type RoundInfo struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type CustomLog struct {
|
type CustomLog struct {
|
||||||
Platform string `bson:"-"`
|
Id bson.ObjectId `bson:"_id"`
|
||||||
CycleId string // 本轮id,多局游戏属于同一轮
|
Platform string `bson:"-"`
|
||||||
RoomConfigId int32 // 房间配置id
|
CycleId string // 本轮id,多局游戏属于同一轮
|
||||||
GameFreeId int32 // 场次id
|
RoomConfigId int32 // 房间配置id
|
||||||
TotalRound int32 // 总局数
|
GameFreeId int32 // 场次id
|
||||||
PlayerNum int32 // 最大人数
|
TotalRound int32 // 总局数
|
||||||
Password string // 密码
|
PlayerNum int32 // 最大人数
|
||||||
CostType int32 // 付费方式 1房主 2AA
|
Password string // 密码
|
||||||
Voice int32 // 是否开启语音 1开启
|
CostType int32 // 付费方式 1房主 2AA
|
||||||
RoomId int32 // 房间id
|
Voice int32 // 是否开启语音 1开启
|
||||||
SnId []PlayerInfo // 所有玩家
|
RoomId int32 // 房间id
|
||||||
List []RoundInfo // 对局记录
|
SnId []PlayerInfo // 所有玩家
|
||||||
StartTs, EndTs int64 // 开始,结束时间
|
List []RoundInfo // 对局记录
|
||||||
State int32 // 0正常结束 1后台中途解散
|
StartTs, EndTs int64 // 开始,结束时间
|
||||||
|
State int32 // 0正常结束 1后台中途解散
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,6 @@ func NewGamePlayerListLogEx(snid int32, gamedetailedlogid string, platform, chan
|
||||||
cl.Time = tNow
|
cl.Time = tNow
|
||||||
cl.MatchId = matchid
|
cl.MatchId = matchid
|
||||||
cl.MatchType = matchType
|
cl.MatchType = matchType
|
||||||
cl.CycleId = cycleId
|
|
||||||
return cl
|
return cl
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1319,10 +1319,6 @@ func CSCreatePrivateRoomHandler(s *netlib.Session, packetId int, data interface{
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if cfg.GetCostType() == 1 {
|
|
||||||
sp.CostPayment(scene, p)
|
|
||||||
}
|
|
||||||
|
|
||||||
pack = &gamehall.SCCreatePrivateRoom{
|
pack = &gamehall.SCCreatePrivateRoom{
|
||||||
OpRetCode: gamehall.OpResultCode_Game_OPRC_Sucess_Game,
|
OpRetCode: gamehall.OpResultCode_Game_OPRC_Sucess_Game,
|
||||||
GameFreeId: msg.GetGameFreeId(),
|
GameFreeId: msg.GetGameFreeId(),
|
||||||
|
@ -1352,8 +1348,6 @@ func CSGetPrivateRoomListHandler(s *netlib.Session, packetId int, data interface
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerNotifySingle.AddTime(p.SnId, common.NotifyPrivateRoomList, time.Second*15)
|
|
||||||
|
|
||||||
pack := &gamehall.SCGetPrivateRoomList{}
|
pack := &gamehall.SCGetPrivateRoomList{}
|
||||||
scenes := SceneMgrSingleton.FindRoomList(&FindRoomParam{
|
scenes := SceneMgrSingleton.FindRoomList(&FindRoomParam{
|
||||||
Platform: p.Platform,
|
Platform: p.Platform,
|
||||||
|
|
|
@ -450,7 +450,7 @@ func (this *BagMgr) AddItem(p *Player, itemId, itemNum int64, add int64, gainWay
|
||||||
return this.AddItems(p, []*Item{{ItemId: int32(itemId), ItemNum: itemNum}}, add, gainWay, operator, remark, gameId, gameFreeId, noLog, params...)
|
return this.AddItems(p, []*Item{{ItemId: int32(itemId), ItemNum: itemNum}}, add, gainWay, operator, remark, gameId, gameFreeId, noLog, params...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *BagMgr) AddItemsOffline(platform string, snid int32, addItems []*model.Item, gainWay int32, operator, remark string,
|
func (this *BagMgr) AddItemsOffline(platform string, snid int32, addItems []*Item, gainWay int32, operator, remark string,
|
||||||
gameId, gameFreeId int64, noLog bool, callback func(err error)) {
|
gameId, gameFreeId int64, noLog bool, callback func(err error)) {
|
||||||
var findPlayer *model.PlayerBaseInfo
|
var findPlayer *model.PlayerBaseInfo
|
||||||
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
||||||
|
|
|
@ -3,8 +3,6 @@ package main
|
||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"mongo.games.com/goserver/core/logger"
|
|
||||||
|
|
||||||
"mongo.games.com/game/common"
|
"mongo.games.com/game/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -78,5 +76,4 @@ func (p *PlayerNotify) GetPlayers(tp common.NotifyType) []int32 {
|
||||||
func (p *PlayerNotify) SendToClient(tp common.NotifyType, packetId int, pack interface{}) {
|
func (p *PlayerNotify) SendToClient(tp common.NotifyType, packetId int, pack interface{}) {
|
||||||
ids := p.GetPlayers(tp)
|
ids := p.GetPlayers(tp)
|
||||||
PlayerMgrSington.BroadcastMessageToTarget(ids, packetId, pack)
|
PlayerMgrSington.BroadcastMessageToTarget(ids, packetId, pack)
|
||||||
logger.Logger.Tracef("PlayerNotify SendToClient tp:%v ids:%v", tp, ids)
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,12 +135,6 @@ func NewScene(args *CreateSceneParam) *Scene {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if s.MatchParam == nil {
|
|
||||||
s.MatchParam = new(serverproto.MatchParam)
|
|
||||||
}
|
|
||||||
if s.CustomParam == nil {
|
|
||||||
s.CustomParam = new(serverproto.CustomParam)
|
|
||||||
}
|
|
||||||
s.sp.OnStart(s)
|
s.sp.OnStart(s)
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
@ -428,7 +422,6 @@ func (this *Scene) PlayerEnter(p *Player, pos int, ischangeroom bool) bool {
|
||||||
}
|
}
|
||||||
this.gameSess.AddPlayer(p)
|
this.gameSess.AddPlayer(p)
|
||||||
FirePlayerEnterScene(p, this)
|
FirePlayerEnterScene(p, this)
|
||||||
this.sp.OnPlayerEnter(this, p)
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -514,8 +507,6 @@ func (this *Scene) lastScene(p *Player) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Scene) DelPlayer(p *Player) bool {
|
func (this *Scene) DelPlayer(p *Player) bool {
|
||||||
FirePlayerLeaveScene(p, this)
|
|
||||||
this.sp.OnPlayerLeave(this, p)
|
|
||||||
if p.scene != this {
|
if p.scene != this {
|
||||||
roomId := 0
|
roomId := 0
|
||||||
if p.scene != nil {
|
if p.scene != nil {
|
||||||
|
|
|
@ -85,7 +85,7 @@ func (m *SceneMgr) GenOneMatchSceneId() int {
|
||||||
|
|
||||||
func (m *SceneMgr) GenPassword() string {
|
func (m *SceneMgr) GenPassword() string {
|
||||||
for i := 0; i < 100; i++ {
|
for i := 0; i < 100; i++ {
|
||||||
s := strconv.Itoa(common.RandInt(100000, 1000000))
|
s := strconv.Itoa(common.RandInt(10000, 100000))
|
||||||
if _, ok := m.password[s]; !ok {
|
if _, ok := m.password[s]; !ok {
|
||||||
m.password[s] = struct{}{}
|
m.password[s] = struct{}{}
|
||||||
return s
|
return s
|
||||||
|
@ -155,7 +155,7 @@ func (m *SceneMgr) GetScenesByGameFreeId(gameFreeId int32) []*Scene {
|
||||||
func (m *SceneMgr) GetMatchRoom(sortId int64) []*Scene {
|
func (m *SceneMgr) GetMatchRoom(sortId int64) []*Scene {
|
||||||
var scenes []*Scene
|
var scenes []*Scene
|
||||||
for _, value := range m.scenes {
|
for _, value := range m.scenes {
|
||||||
if value.GetMatchSortId() == sortId {
|
if value.MatchSortId == sortId {
|
||||||
s := m.GetScene(value.sceneId)
|
s := m.GetScene(value.sceneId)
|
||||||
if s != nil {
|
if s != nil {
|
||||||
scenes = append(scenes, value)
|
scenes = append(scenes, value)
|
||||||
|
|
|
@ -2,8 +2,6 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"math"
|
"math"
|
||||||
"mongo.games.com/goserver/core/logger"
|
|
||||||
|
|
||||||
"mongo.games.com/game/common"
|
"mongo.games.com/game/common"
|
||||||
"mongo.games.com/game/model"
|
"mongo.games.com/game/model"
|
||||||
hallproto "mongo.games.com/game/protocol/gamehall"
|
hallproto "mongo.games.com/game/protocol/gamehall"
|
||||||
|
@ -31,10 +29,6 @@ func (spd *ScenePolicyData) OnStart(s *Scene) {
|
||||||
// 场景关闭事件
|
// 场景关闭事件
|
||||||
func (spd *ScenePolicyData) OnStop(s *Scene) {
|
func (spd *ScenePolicyData) OnStop(s *Scene) {
|
||||||
s.NotifyPrivateRoom(common.ListDel)
|
s.NotifyPrivateRoom(common.ListDel)
|
||||||
// 房主付费,房间没有玩就解散了,返还房主建房费用
|
|
||||||
if s.IsCustom() && s.GetCostType() == 1 && s.currRound == 0 {
|
|
||||||
spd.GiveCostPayment(s, s.creator)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 场景心跳事件
|
// 场景心跳事件
|
||||||
|
@ -66,10 +60,8 @@ func (spd *ScenePolicyData) OnSceneState(s *Scene, state int) {
|
||||||
case common.SceneStateStart:
|
case common.SceneStateStart:
|
||||||
s.NotifyPrivateRoom(common.ListModify)
|
s.NotifyPrivateRoom(common.ListModify)
|
||||||
if s.IsCustom() {
|
if s.IsCustom() {
|
||||||
if s.GetCostType() == 2 {
|
for _, v := range s.players {
|
||||||
for _, v := range s.players {
|
spd.CostPayment(s, v)
|
||||||
spd.CostPayment(s, v)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,13 +85,13 @@ func (spd *ScenePolicyData) CanEnter(s *Scene, p *Player) int {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (spd *ScenePolicyData) costEnough(costType, playerNum int, roomConfig *webapi.RoomConfig, snid int32, f func(items []*model.Item)) bool {
|
func (spd *ScenePolicyData) costEnough(costType, playerNum int, roomConfig *webapi.RoomConfig, p *Player, f func(items []*model.Item)) bool {
|
||||||
isEnough := true
|
isEnough := true
|
||||||
var items []*model.Item
|
var items []*model.Item
|
||||||
if costType == 1 {
|
if costType == 1 {
|
||||||
// 房主
|
// 房主
|
||||||
for _, v := range roomConfig.GetCost() {
|
for _, v := range roomConfig.GetCost() {
|
||||||
if item := BagMgrSingleton.GetItem(snid, v.GetItemId()); item == nil || item.ItemNum < v.GetItemNum() {
|
if item := BagMgrSingleton.GetItem(p.SnId, v.GetItemId()); item == nil || item.ItemNum < v.GetItemNum() {
|
||||||
isEnough = false
|
isEnough = false
|
||||||
break
|
break
|
||||||
} else {
|
} else {
|
||||||
|
@ -113,7 +105,7 @@ func (spd *ScenePolicyData) costEnough(costType, playerNum int, roomConfig *weba
|
||||||
// AA
|
// AA
|
||||||
for _, v := range roomConfig.GetCost() {
|
for _, v := range roomConfig.GetCost() {
|
||||||
n := int64(math.Ceil(float64(v.GetItemNum()) / float64(playerNum)))
|
n := int64(math.Ceil(float64(v.GetItemNum()) / float64(playerNum)))
|
||||||
if item := BagMgrSingleton.GetItem(snid, v.GetItemId()); item == nil || item.ItemNum < n {
|
if item := BagMgrSingleton.GetItem(p.SnId, v.GetItemId()); item == nil || item.ItemNum < n {
|
||||||
isEnough = false
|
isEnough = false
|
||||||
break
|
break
|
||||||
} else {
|
} else {
|
||||||
|
@ -134,7 +126,7 @@ func (spd *ScenePolicyData) CostEnough(costType, playerNum int, roomConfig *weba
|
||||||
if roomConfig == nil {
|
if roomConfig == nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return spd.costEnough(costType, playerNum, roomConfig, p.SnId, func(items []*model.Item) {})
|
return spd.costEnough(costType, playerNum, roomConfig, p, func(items []*model.Item) {})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (spd *ScenePolicyData) CostPayment(s *Scene, p *Player) bool {
|
func (spd *ScenePolicyData) CostPayment(s *Scene, p *Player) bool {
|
||||||
|
@ -142,10 +134,7 @@ func (spd *ScenePolicyData) CostPayment(s *Scene, p *Player) bool {
|
||||||
if roomConfig == nil {
|
if roomConfig == nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return spd.costEnough(int(roomConfig.GetCostType()), s.playerNum, roomConfig, p.SnId, func(items []*model.Item) {
|
return spd.costEnough(int(roomConfig.GetCostType()), s.playerNum, roomConfig, p, func(items []*model.Item) {
|
||||||
for _, v := range items {
|
|
||||||
v.ItemNum = -v.ItemNum
|
|
||||||
}
|
|
||||||
BagMgrSingleton.AddItemsV2(&model.AddItemParam{
|
BagMgrSingleton.AddItemsV2(&model.AddItemParam{
|
||||||
P: p.PlayerData,
|
P: p.PlayerData,
|
||||||
Change: items,
|
Change: items,
|
||||||
|
@ -159,47 +148,6 @@ func (spd *ScenePolicyData) CostPayment(s *Scene, p *Player) bool {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// GiveCostPayment 退房费
|
|
||||||
func (spd *ScenePolicyData) GiveCostPayment(s *Scene, snid int32) bool {
|
|
||||||
roomConfig := PlatformMgrSingleton.GetConfig(s.limitPlatform.IdStr).RoomConfig[s.GetRoomConfigId()]
|
|
||||||
if roomConfig == nil {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
if roomConfig.GetCostType() != 1 { // 只有房主付费才有返还
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
var items []*model.Item
|
|
||||||
for _, v := range roomConfig.GetCost() {
|
|
||||||
items = append(items, &model.Item{
|
|
||||||
ItemId: v.GetItemId(),
|
|
||||||
ItemNum: v.GetItemNum(),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
p := PlayerMgrSington.GetPlayerBySnId(snid)
|
|
||||||
if p != nil {
|
|
||||||
BagMgrSingleton.AddItemsV2(&model.AddItemParam{
|
|
||||||
P: p.PlayerData,
|
|
||||||
Change: items,
|
|
||||||
GainWay: common.GainWayRoomCost,
|
|
||||||
Operator: "system",
|
|
||||||
Remark: "竞技场房间费用返还",
|
|
||||||
GameId: int64(s.gameId),
|
|
||||||
GameFreeId: int64(s.dbGameFree.GetId()),
|
|
||||||
NoLog: false,
|
|
||||||
RoomConfigId: roomConfig.GetId(),
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
BagMgrSingleton.AddItemsOffline(s.limitPlatform.IdStr, snid, items, common.GainWayRoomCost, "system",
|
|
||||||
"竞技场费用返还", int64(s.gameId), int64(s.dbGameFree.GetId()), false, func(err error) {
|
|
||||||
logger.Logger.Errorf("竞技场房间费用返还失败, err: %v", err)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func (spd *ScenePolicyData) GetBetState() int32 {
|
func (spd *ScenePolicyData) GetBetState() int32 {
|
||||||
return spd.BetState
|
return spd.BetState
|
||||||
}
|
}
|
||||||
|
|
|
@ -3375,25 +3375,19 @@ func init() {
|
||||||
}
|
}
|
||||||
addvcoin := msg.NeedNum
|
addvcoin := msg.NeedNum
|
||||||
jPrice := msg.JPrice
|
jPrice := msg.JPrice
|
||||||
var items []*model.Item
|
var items []*Item
|
||||||
//V卡
|
//V卡
|
||||||
if addvcoin > 0 {
|
if addvcoin > 0 {
|
||||||
items = append(items, &model.Item{ItemId: common.ItemIDVCard, ItemNum: int64(addvcoin)})
|
items = append(items, &Item{ItemId: common.ItemIDVCard, ItemNum: int64(addvcoin)})
|
||||||
}
|
}
|
||||||
//金券
|
//金券
|
||||||
if jPrice > 0 {
|
if jPrice > 0 {
|
||||||
items = append(items, &model.Item{ItemId: common.ItemIDJCard, ItemNum: int64(jPrice)})
|
items = append(items, &Item{ItemId: common.ItemIDJCard, ItemNum: int64(jPrice)})
|
||||||
}
|
}
|
||||||
remark := fmt.Sprintf("兑换撤单 %v-%v", msg.GoodsId, msg.Name)
|
remark := fmt.Sprintf("兑换撤单 %v-%v", msg.GoodsId, msg.Name)
|
||||||
if player != nil {
|
if player != nil {
|
||||||
// 在线
|
// 在线
|
||||||
if _, code, _ := BagMgrSingleton.AddItemsV2(&model.AddItemParam{
|
if _, code, _ := BagMgrSingleton.AddItems(player, items, 0, common.GainWay_Exchange, "system", remark, 0, 0, false); code != bag.OpResultCode_OPRC_Sucess { // 领取失败
|
||||||
P: player.PlayerData,
|
|
||||||
Change: items,
|
|
||||||
GainWay: common.GainWay_Exchange,
|
|
||||||
Operator: "system",
|
|
||||||
Remark: remark,
|
|
||||||
}); code != bag.OpResultCode_OPRC_Sucess { // 领取失败
|
|
||||||
logger.Logger.Errorf("UpExchangeStatus AddItems err", code)
|
logger.Logger.Errorf("UpExchangeStatus AddItems err", code)
|
||||||
pack.Msg = "AddItems err"
|
pack.Msg = "AddItems err"
|
||||||
return common.ResponseTag_ParamError, pack
|
return common.ResponseTag_ParamError, pack
|
||||||
|
@ -3750,9 +3744,9 @@ func init() {
|
||||||
pack.Msg = "参数错误"
|
pack.Msg = "参数错误"
|
||||||
return common.ResponseTag_ParamError, pack
|
return common.ResponseTag_ParamError, pack
|
||||||
}
|
}
|
||||||
var items []*model.Item
|
var items []*Item
|
||||||
for _, info := range msg.ItemInfo {
|
for _, info := range msg.ItemInfo {
|
||||||
items = append(items, &model.Item{
|
items = append(items, &Item{
|
||||||
ItemId: info.ItemId, // 物品id
|
ItemId: info.ItemId, // 物品id
|
||||||
ItemNum: info.ItemNum, // 数量
|
ItemNum: info.ItemNum, // 数量
|
||||||
ObtainTime: time.Now().Unix(),
|
ObtainTime: time.Now().Unix(),
|
||||||
|
@ -3761,13 +3755,7 @@ func init() {
|
||||||
p := PlayerMgrSington.GetPlayerBySnId(msg.GetSnid())
|
p := PlayerMgrSington.GetPlayerBySnId(msg.GetSnid())
|
||||||
if p != nil {
|
if p != nil {
|
||||||
//获取道具Id
|
//获取道具Id
|
||||||
BagMgrSingleton.AddItemsV2(&model.AddItemParam{
|
BagMgrSingleton.AddItems(p, items, 0, msg.GetTypeId(), "system", msg.GetRemark(), 0, 0, false)
|
||||||
P: p.PlayerData,
|
|
||||||
Change: items,
|
|
||||||
GainWay: msg.GetTypeId(),
|
|
||||||
Operator: "system",
|
|
||||||
Remark: msg.GetRemark(),
|
|
||||||
})
|
|
||||||
pack.Tag = webapiproto.TagCode_SUCCESS
|
pack.Tag = webapiproto.TagCode_SUCCESS
|
||||||
pack.Msg = "AddItem success"
|
pack.Msg = "AddItem success"
|
||||||
return common.ResponseTag_Ok, pack
|
return common.ResponseTag_Ok, pack
|
||||||
|
|
Loading…
Reference in New Issue