比赛时间

This commit is contained in:
sk 2024-06-03 11:08:25 +08:00
parent 35c0e07004
commit 39b71ea93f
5 changed files with 130 additions and 49 deletions

View File

@ -88,6 +88,7 @@ type GameParam struct {
TestActSwitch bool // 开启所有活动开关 TestActSwitch bool // 开启所有活动开关
RankPlayerLevelMaxNum int //等级榜最大人数 RankPlayerLevelMaxNum int //等级榜最大人数
CloseChannelSwitch bool //关闭渠道开关功能 CloseChannelSwitch bool //关闭渠道开关功能
BackendTimeLocal int //后台时区
} }
var GameParamPath = "../data/gameparam.json" var GameParamPath = "../data/gameparam.json"
@ -238,4 +239,7 @@ func InitGameParam() {
if GameParamData.RankPlayerLevelMaxNum == 0 { if GameParamData.RankPlayerLevelMaxNum == 0 {
GameParamData.RankPlayerLevelMaxNum = 100 GameParamData.RankPlayerLevelMaxNum = 100
} }
if GameParamData.BackendTimeLocal == 0 {
GameParamData.BackendTimeLocal = 8
}
} }

View File

@ -8519,6 +8519,8 @@ type ASAddItemById struct {
Snid int32 `protobuf:"varint,1,opt,name=Snid,proto3" json:"Snid,omitempty"` // 玩家id Snid int32 `protobuf:"varint,1,opt,name=Snid,proto3" json:"Snid,omitempty"` // 玩家id
Platform string `protobuf:"bytes,2,opt,name=Platform,proto3" json:"Platform,omitempty"` // 平台id Platform string `protobuf:"bytes,2,opt,name=Platform,proto3" json:"Platform,omitempty"` // 平台id
ItemInfo []*ItemInfo `protobuf:"bytes,3,rep,name=ItemInfo,proto3" json:"ItemInfo,omitempty"` //道具 ItemInfo []*ItemInfo `protobuf:"bytes,3,rep,name=ItemInfo,proto3" json:"ItemInfo,omitempty"` //道具
TypeId int32 `protobuf:"varint,4,opt,name=TypeId,proto3" json:"TypeId,omitempty"` // 变化类型
Remark string `protobuf:"bytes,5,opt,name=Remark,proto3" json:"Remark,omitempty"` // 描述
} }
func (x *ASAddItemById) Reset() { func (x *ASAddItemById) Reset() {
@ -8574,6 +8576,20 @@ func (x *ASAddItemById) GetItemInfo() []*ItemInfo {
return nil return nil
} }
func (x *ASAddItemById) GetTypeId() int32 {
if x != nil {
return x.TypeId
}
return 0
}
func (x *ASAddItemById) GetRemark() string {
if x != nil {
return x.Remark
}
return ""
}
type SAAddItemById struct { type SAAddItemById struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
@ -9548,34 +9564,38 @@ var file_webapi_proto_rawDesc = []byte{
0x2e, 0x77, 0x65, 0x62, 0x61, 0x70, 0x69, 0x2e, 0x54, 0x61, 0x67, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x2e, 0x77, 0x65, 0x62, 0x61, 0x70, 0x69, 0x2e, 0x54, 0x61, 0x67, 0x43, 0x6f, 0x64, 0x65, 0x52,
0x03, 0x54, 0x61, 0x67, 0x12, 0x10, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x54, 0x61, 0x67, 0x12, 0x10, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28,
0x09, 0x52, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x4c, 0x69, 0x6e, 0x6b, 0x18, 0x03, 0x09, 0x52, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x4c, 0x69, 0x6e, 0x6b, 0x18, 0x03,
0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4c, 0x69, 0x6e, 0x6b, 0x22, 0x6d, 0x0a, 0x0d, 0x41, 0x53, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4c, 0x69, 0x6e, 0x6b, 0x22, 0x9d, 0x01, 0x0a, 0x0d, 0x41,
0x41, 0x64, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x42, 0x79, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x53, 0x41, 0x64, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x42, 0x79, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04,
0x6e, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x53, 0x6e, 0x69, 0x64, 0x12, 0x53, 0x6e, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x53, 0x6e, 0x69, 0x64,
0x1a, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x02, 0x20, 0x01,
0x09, 0x52, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x2c, 0x0a, 0x08, 0x49, 0x28, 0x09, 0x52, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x2c, 0x0a, 0x08,
0x74, 0x65, 0x6d, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10,
0x77, 0x65, 0x62, 0x61, 0x70, 0x69, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x2e, 0x77, 0x65, 0x62, 0x61, 0x70, 0x69, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x6e, 0x66, 0x6f,
0x08, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x44, 0x0a, 0x0d, 0x53, 0x41, 0x41, 0x52, 0x08, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x54, 0x79,
0x64, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x42, 0x79, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x03, 0x54, 0x61, 0x70, 0x65, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x54, 0x79, 0x70, 0x65,
0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x77, 0x65, 0x62, 0x61, 0x70, 0x69, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x52, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x18, 0x05, 0x20, 0x01,
0x2e, 0x54, 0x61, 0x67, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x03, 0x54, 0x61, 0x67, 0x12, 0x10, 0x0a, 0x28, 0x09, 0x52, 0x06, 0x52, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x22, 0x44, 0x0a, 0x0d, 0x53, 0x41,
0x03, 0x4d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x4d, 0x73, 0x67, 0x2a, 0x41, 0x64, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x42, 0x79, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x03, 0x54,
0xce, 0x01, 0x0a, 0x07, 0x54, 0x61, 0x67, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x77, 0x65, 0x62, 0x61, 0x70,
0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x55, 0x43, 0x43, 0x69, 0x2e, 0x54, 0x61, 0x67, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x03, 0x54, 0x61, 0x67, 0x12, 0x10,
0x45, 0x53, 0x53, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x4d, 0x73, 0x67,
0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x53, 0x49, 0x47, 0x4e, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x2a, 0xce, 0x01, 0x0a, 0x07, 0x54, 0x61, 0x67, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x0b, 0x0a, 0x07,
0x03, 0x12, 0x14, 0x0a, 0x10, 0x50, 0x52, 0x4f, 0x54, 0x4f, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x55, 0x43,
0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x04, 0x12, 0x12, 0x0a, 0x0e, 0x4a, 0x59, 0x42, 0x5f, 0x44, 0x43, 0x45, 0x53, 0x53, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44,
0x41, 0x54, 0x41, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x05, 0x12, 0x12, 0x0a, 0x0e, 0x4a, 0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x53, 0x49, 0x47, 0x4e, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52,
0x59, 0x42, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x45, 0x58, 0x49, 0x53, 0x54, 0x10, 0x06, 0x12, 0x10, 0x03, 0x12, 0x14, 0x0a, 0x10, 0x50, 0x52, 0x4f, 0x54, 0x4f, 0x5f, 0x44, 0x41, 0x54, 0x41,
0x11, 0x0a, 0x0d, 0x50, 0x6c, 0x61, 0x79, 0x5f, 0x4e, 0x6f, 0x74, 0x45, 0x58, 0x49, 0x53, 0x54, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x04, 0x12, 0x12, 0x0a, 0x0e, 0x4a, 0x59, 0x42, 0x5f,
0x10, 0x07, 0x12, 0x09, 0x0a, 0x05, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x10, 0x08, 0x12, 0x0c, 0x0a, 0x44, 0x41, 0x54, 0x41, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x05, 0x12, 0x12, 0x0a, 0x0e,
0x08, 0x54, 0x65, 0x6c, 0x45, 0x78, 0x69, 0x73, 0x74, 0x10, 0x09, 0x12, 0x13, 0x0a, 0x0f, 0x41, 0x4a, 0x59, 0x42, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x45, 0x58, 0x49, 0x53, 0x54, 0x10, 0x06,
0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x4e, 0x6f, 0x74, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0x0a, 0x12, 0x11, 0x0a, 0x0d, 0x50, 0x6c, 0x61, 0x79, 0x5f, 0x4e, 0x6f, 0x74, 0x45, 0x58, 0x49, 0x53,
0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x65, 0x6c, 0x4e, 0x6f, 0x74, 0x42, 0x69, 0x6e, 0x64, 0x10, 0x0b, 0x54, 0x10, 0x07, 0x12, 0x09, 0x0a, 0x05, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x10, 0x08, 0x12, 0x0c,
0x42, 0x26, 0x5a, 0x24, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x67, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x0a, 0x08, 0x54, 0x65, 0x6c, 0x45, 0x78, 0x69, 0x73, 0x74, 0x10, 0x09, 0x12, 0x13, 0x0a, 0x0f,
0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x4e, 0x6f, 0x74, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x10,
0x6c, 0x2f, 0x77, 0x65, 0x62, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x0a, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x65, 0x6c, 0x4e, 0x6f, 0x74, 0x42, 0x69, 0x6e, 0x64, 0x10,
0x0b, 0x42, 0x26, 0x5a, 0x24, 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, 0x77, 0x65, 0x62, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x33,
} }
var ( var (

View File

@ -914,6 +914,8 @@ message ASAddItemById{
int32 Snid = 1; // id int32 Snid = 1; // id
string Platform = 2; // id string Platform = 2; // id
repeated ItemInfo ItemInfo = 3;// repeated ItemInfo ItemInfo = 3;//
int32 TypeId = 4; //
string Remark = 5; //
} }
message SAAddItemById{ message SAAddItemById{

View File

@ -7,6 +7,7 @@ import (
"sync" "sync"
"time" "time"
nowtool "github.com/jinzhu/now"
"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"
@ -25,6 +26,7 @@ import (
func init() { func init() {
module.RegisteModule(TournamentMgr, time.Second, 0) module.RegisteModule(TournamentMgr, time.Second, 0)
ClockMgrSington.RegisteSinker(TournamentMgr)
} }
const ( const (
@ -78,6 +80,7 @@ type PlayerRoundInfo struct {
} }
type Tournament struct { type Tournament struct {
BaseClockSinker
GameMatchDateList map[string]map[int32]*webapiproto.GameMatchDate // 比赛配置platform:比赛场配置id:比赛配置 GameMatchDateList map[string]map[int32]*webapiproto.GameMatchDate // 比赛配置platform:比赛场配置id:比赛配置
singleSignupPlayers map[int32]*SignupInfo // 开启机器人时报名的玩家玩家Id:报名信息 singleSignupPlayers map[int32]*SignupInfo // 开启机器人时报名的玩家玩家Id:报名信息
signupPlayers map[string]map[int32]*SignInfo // 报名的玩家 platform:比赛配置id:报名人 signupPlayers map[string]map[int32]*SignInfo // 报名的玩家 platform:比赛配置id:报名人
@ -182,6 +185,7 @@ func (this *Tournament) UpdateData(init bool, data *webapiproto.GameMatchDateLis
configs := make(map[int32]*webapiproto.GameMatchDate) configs := make(map[int32]*webapiproto.GameMatchDate)
for _, v := range data.List { for _, v := range data.List {
if this.checkData(v) { if this.checkData(v) {
this.FixMatchTimeStamp(v)
configs[v.Id] = v configs[v.Id] = v
} else { } else {
logger.Logger.Error("GameMatchDate error: ", v) logger.Logger.Error("GameMatchDate error: ", v)
@ -274,17 +278,6 @@ func (this *Tournament) IsRobotOn(match *webapiproto.GameMatchDate) bool {
// IsTimeRange 判断是否在比赛时间段内 // IsTimeRange 判断是否在比赛时间段内
// 在时间段内才能报名 // 在时间段内才能报名
func (this *Tournament) IsTimeRange(gmd *webapiproto.GameMatchDate) bool { func (this *Tournament) IsTimeRange(gmd *webapiproto.GameMatchDate) bool {
getWeekNum := func(t time.Time) int {
strWeek := []string{"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}
week := t.Weekday()
for i, s := range strWeek {
if week.String() == s {
return i
}
}
return 0
}
if gmd == nil { if gmd == nil {
return false return false
} }
@ -299,17 +292,21 @@ func (this *Tournament) IsTimeRange(gmd *webapiproto.GameMatchDate) bool {
case 0: case 0:
return true return true
case 1: case 1:
nowWeek := getWeekNum(tNow) week := this.getWeekDay()
hms := int32(tNow.Hour()*10000 + tNow.Minute()*100 + tNow.Second()) for _, v := range gmd.MatchTimeWeek {
if gmd.MatchTimeWeek != nil && len(gmd.MatchTimeWeek) > 0 { if week == int(v) {
for _, week := range gmd.MatchTimeWeek { if gmd.MatchTimeStamp != nil && len(gmd.MatchTimeStamp) > 1 {
if nowWeek == int(week) { this.FixMatchTimeStamp(gmd)
if hms >= gmd.MatchTimeStartHMS && hms <= gmd.MatchTimeEndHMS { startStamp := gmd.MatchTimeStamp[0]
endStamp := gmd.MatchTimeStamp[1]
if tNow.Unix() >= startStamp && tNow.Unix() <= endStamp {
return true return true
} }
} }
return false
} }
} }
case 2: case 2:
if gmd.MatchTimeStamp != nil && len(gmd.MatchTimeStamp) > 1 { if gmd.MatchTimeStamp != nil && len(gmd.MatchTimeStamp) > 1 {
startStamp := gmd.MatchTimeStamp[0] startStamp := gmd.MatchTimeStamp[0]
@ -1201,7 +1198,7 @@ func (this *Tournament) sendPromotionInfo(mc *PlayerMatchContext, sortId int64,
title := i18n.Tr("languages", "MatchAwardTitle") title := i18n.Tr("languages", "MatchAwardTitle")
content := i18n.Tr("languages", "MatchAward", params) content := i18n.Tr("languages", "MatchAward", params)
newMsg = model.NewMessage("", 0, "", mc.p.SnId, model.MSGTYPE_RANK_REWARD, newMsg = model.NewMessage("", 0, "", mc.p.SnId, model.MSGTYPE_RANK_REWARD,
title, content, 0, 0, model.MSGSTATE_UNREAD, time.Now().Unix(), 0, "", nil, mc.p.Platform, model.HallTienlen) title, content, 0, 0, model.MSGSTATE_UNREAD, time.Now().Unix(), 0, "", nil, mc.p.Platform, model.HallTienlen, nil)
err := model.InsertMessage(mc.p.Platform, newMsg) err := model.InsertMessage(mc.p.Platform, newMsg)
if err != nil { if err != nil {
logger.Logger.Errorf("发送邮件失败 snid:%v itemID:%v err:%v", mc.p.SnId, data.Id, err) logger.Logger.Errorf("发送邮件失败 snid:%v itemID:%v err:%v", mc.p.SnId, data.Id, err)
@ -1534,3 +1531,61 @@ func (this *Tournament) Update() {
} }
func (this *Tournament) Shutdown() {} func (this *Tournament) Shutdown() {}
func (this *Tournament) getWeekDay() int {
getWeekNum := func(t time.Time) int {
strWeek := []string{"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}
week := t.Weekday()
for i, s := range strWeek {
if week.String() == s {
return i
}
}
return 0
}
l := time.FixedZone("CST", model.GameParamData.BackendTimeLocal*3600)
bTs := time.Now().In(l)
week := getWeekNum(bTs)
return week
}
func (this *Tournament) FixMatchTimeStamp(d *webapiproto.GameMatchDate) {
// 更新比赛时间
if d == nil || d.MatchTimeType != 1 {
return
}
if len(d.MatchTimeStamp) != 2 {
return
}
l := time.FixedZone("CST", model.GameParamData.BackendTimeLocal*3600)
bTs := time.Now().In(l)
week := this.getWeekDay()
st := time.Unix(d.MatchTimeStamp[0], 0).In(l)
et := time.Unix(d.MatchTimeStamp[1], 0).In(l)
logger.Logger.Tracef("FixMatchTimeStamp 1 id:%v now:%v week:%v start:%v end:%v", d.Id, bTs, bTs.Weekday(), st, et)
// 重复时间段比赛时间
for _, v := range d.MatchTimeWeek {
if v == int32(week) {
stSub := st.Unix() - nowtool.New(st).BeginningOfDay().Unix()
sub := d.MatchTimeStamp[1] - d.MatchTimeStamp[0]
d.MatchTimeStamp[0] = nowtool.New(bTs).BeginningOfDay().Add(time.Duration(stSub) * time.Second).Unix()
d.MatchTimeStamp[1] = d.MatchTimeStamp[0] + sub
st = time.Unix(d.MatchTimeStamp[0], 0).In(l)
et = time.Unix(d.MatchTimeStamp[1], 0).In(l)
logger.Logger.Tracef("FixMatchTimeStamp 2 id:%v now:%v week:%v start:%v end:%v", d.Id, bTs, bTs.Weekday(), st, et)
break
}
}
}
func (this *Tournament) OnHourTimer() {
for _, v := range this.GameMatchDateList {
for _, vv := range v {
this.FixMatchTimeStamp(vv)
}
}
}

View File

@ -4367,13 +4367,13 @@ func init() {
p := PlayerMgrSington.GetPlayerBySnId(msg.GetSnid()) p := PlayerMgrSington.GetPlayerBySnId(msg.GetSnid())
if p != nil { if p != nil {
//获取道具Id //获取道具Id
BagMgrSingleton.AddItems(p, items, 0, common.GainWayBackend, "system", "后台操作", 0, 0, false) BagMgrSingleton.AddItems(p, items, 0, msg.GetTypeId(), "system", msg.GetRemark(), 0, 0, false)
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
} else { } else {
BagMgrSingleton.AddItemsOffline(msg.Platform, msg.Snid, items, common.GainWayBackend, BagMgrSingleton.AddItemsOffline(msg.Platform, msg.Snid, items, msg.GetTypeId(),
"system", "后台操作", 0, 0, false, func(err error) { "system", msg.GetRemark(), 0, 0, false, func(err error) {
if err != nil { if err != nil {
pack.Tag = webapiproto.TagCode_FAILED pack.Tag = webapiproto.TagCode_FAILED
pack.Msg = "AddItem failed:" + err.Error() pack.Msg = "AddItem failed:" + err.Error()