Compare commits
3 Commits
e1812b5ecf
...
5e0b6139f9
Author | SHA1 | Date |
---|---|---|
|
5e0b6139f9 | |
|
39b71ea93f | |
|
35c0e07004 |
|
@ -1632,6 +1632,8 @@ func (this *Scene) NewBigCoinNotice(player *Player, num int64, msgType int64) {
|
|||
|
||||
type GameDetailedParam struct {
|
||||
Trend20Lately string //最近20局开奖结果
|
||||
CtrlType int
|
||||
PlayerPool map[int]int
|
||||
}
|
||||
|
||||
// 保存详细游戏日志
|
||||
|
@ -1651,7 +1653,8 @@ func (this *Scene) SaveGameDetailedLog(logid string, gamedetailednote string, ga
|
|||
log := model.NewGameDetailedLogEx(logid, int32(this.GameId), int32(this.SceneId),
|
||||
this.DbGameFree.GetGameMode(), this.DbGameFree.Id, int32(len(this.Players)),
|
||||
int32(time.Now().Unix()-this.GameNowTime.Unix()), baseScore,
|
||||
gamedetailednote, p.Platform, this.ClubId, this.RoomId, this.CpCtx, GameDetailedVer[this.GameId], trend20Lately)
|
||||
gamedetailednote, p.Platform, this.ClubId, this.RoomId, this.CpCtx, GameDetailedVer[this.GameId], trend20Lately,
|
||||
gameDetailedParam.CtrlType, gameDetailedParam.PlayerPool)
|
||||
if log != nil {
|
||||
if this.IsMatchScene() {
|
||||
log.MatchId = this.MatchId
|
||||
|
@ -1664,7 +1667,8 @@ func (this *Scene) SaveGameDetailedLog(logid string, gamedetailednote string, ga
|
|||
log := model.NewGameDetailedLogEx(logid, int32(this.GameId), int32(this.SceneId),
|
||||
this.DbGameFree.GetGameMode(), this.DbGameFree.Id, int32(len(this.Players)),
|
||||
int32(time.Now().Unix()-this.GameNowTime.Unix()), baseScore,
|
||||
gamedetailednote, this.Platform, this.ClubId, this.RoomId, this.CpCtx, GameDetailedVer[this.GameId], trend20Lately)
|
||||
gamedetailednote, this.Platform, this.ClubId, this.RoomId, this.CpCtx, GameDetailedVer[this.GameId], trend20Lately,
|
||||
gameDetailedParam.CtrlType, gameDetailedParam.PlayerPool)
|
||||
if log != nil {
|
||||
if this.IsMatchScene() {
|
||||
log.MatchId = this.MatchId
|
||||
|
|
|
@ -29,6 +29,7 @@ type TienLenPlayerData struct {
|
|||
curHandLimitTimeOut time.Duration // 出牌时间上限
|
||||
isNotOverLastHand bool //手牌不能压过上家出牌标志
|
||||
cardScore int // 手牌评分
|
||||
playerPool int // 个人水池分
|
||||
}
|
||||
|
||||
func (this *TienLenPlayerData) init() {
|
||||
|
@ -49,6 +50,7 @@ func (this *TienLenPlayerData) init() {
|
|||
this.curHandLimitTimeOut = rule.TienLenPlayerOpTimeout
|
||||
this.isNotOverLastHand = false
|
||||
this.cardScore = 0
|
||||
this.playerPool = 0
|
||||
}
|
||||
|
||||
func (this *TienLenPlayerData) Clear() {
|
||||
|
@ -67,6 +69,7 @@ func (this *TienLenPlayerData) Clear() {
|
|||
this.ThinkLongCnt = 0
|
||||
this.curHandLimitTimeOut = rule.TienLenPlayerOpTimeout
|
||||
this.isNotOverLastHand = false
|
||||
this.playerPool = 0
|
||||
|
||||
this.MarkFlag(base.PlayerState_WaitNext)
|
||||
this.TestLog = this.TestLog[:0]
|
||||
|
|
|
@ -55,6 +55,7 @@ type TienLenSceneData struct {
|
|||
cHintCards []int32 //客户端提示出牌记录
|
||||
isCardsKu bool //是否是牌库
|
||||
cardsKuId int32 //牌库ID
|
||||
ctrlType int // 1控赢 2控输 0不控
|
||||
}
|
||||
|
||||
func NewTienLenSceneData(s *base.Scene) *TienLenSceneData {
|
||||
|
@ -85,6 +86,7 @@ func (this *TienLenSceneData) init() bool {
|
|||
this.card_play_action_seq_int32 = [][]int32{}
|
||||
this.bombToEnd = 0
|
||||
this.allPlayerCards = [][]int32{}
|
||||
this.ctrlType = 0
|
||||
this.recordId, _ = model.AutoIncGameLogId()
|
||||
if this.GetPlayerNum() == 0 {
|
||||
this.SetPlayerNum(rule.MaxNumOfPlayer)
|
||||
|
@ -114,6 +116,7 @@ func (this *TienLenSceneData) Clear() {
|
|||
this.isAllRob = false
|
||||
this.robotGamingNum = 0
|
||||
this.allPlayerCards = [][]int32{}
|
||||
this.ctrlType = 0
|
||||
this.recordId, _ = model.AutoIncGameLogId()
|
||||
for _, player := range this.players {
|
||||
if player != nil {
|
||||
|
@ -1053,6 +1056,7 @@ func (this *TienLenSceneData) SendHandCardOdds() {
|
|||
robotPlayers = append(robotPlayers, seat)
|
||||
} else {
|
||||
seat.odds = this.GetPlayerOdds(seat.Player, this.GameId, this.robotGamingNum > 0)
|
||||
seat.playerPool = int(this.PlayerPoolOdds(seat.Player))
|
||||
if seat.odds > 0 {
|
||||
realPlayersGood = append(realPlayersGood, seat)
|
||||
G += seat.odds
|
||||
|
@ -1233,6 +1237,7 @@ func (this *TienLenSceneData) SendHandCardOdds() {
|
|||
logger.Logger.Tracef("TienLen SendHandCardOdds Good:%v G:%v Bad:%v B:%v", isGood, G, isBad, B)
|
||||
|
||||
if isBad && !isTestPoker && len(robotPlayers) > 0 && !noviceCtrl && !noviceTianHu {
|
||||
this.ctrlType = 2
|
||||
gf := base.ConfigMgrInst.GetConfig(this.Platform).GameConfig
|
||||
items := []int32{gf.GetTianHu(), gf.GetPaiKu(), gf.GetFenCha()}
|
||||
score := this.RandInt(int(gf.GetTianHu() + gf.GetPaiKu() + gf.GetFenCha()))
|
||||
|
@ -1495,7 +1500,8 @@ func (this *TienLenSceneData) SendHandCardOdds() {
|
|||
}
|
||||
|
||||
if !isBad && !isTestPoker && !noviceCtrl && !noviceTianHu { // 天胡调控没有生效
|
||||
if isGood || isBad {
|
||||
if isGood {
|
||||
this.ctrlType = 1
|
||||
// 牌平分,按从大到小排序
|
||||
// 使用分差配置,最好牌和最差牌的牌型分差大于分差配置
|
||||
for i := 0; i < 20; i++ { // 尝试20次,如果还不能满足分差配置,则直接发牌
|
||||
|
|
|
@ -1606,6 +1606,13 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
|
|||
BaseScore: s.GetBaseScore(),
|
||||
TaxRate: s.DbGameFree.GetTaxRate(),
|
||||
RoomMode: s.GetSceneMode(),
|
||||
PlayerPool: make(map[int]int),
|
||||
}
|
||||
for _, v := range sceneEx.seats {
|
||||
if v == nil || !v.IsGameing() {
|
||||
continue
|
||||
}
|
||||
tienlenType.PlayerPool[int(v.SnId)] = v.playerPool
|
||||
}
|
||||
|
||||
nGamingPlayerCount := sceneEx.GetGameingPlayerCnt()
|
||||
|
@ -2499,7 +2506,11 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
|
|||
}
|
||||
if isSave {
|
||||
// 牌局记录
|
||||
sceneEx.SaveGameDetailedLog(sceneEx.recordId, info, &base.GameDetailedParam{})
|
||||
sceneEx.SaveGameDetailedLog(sceneEx.recordId, info, &base.GameDetailedParam{
|
||||
Trend20Lately: "",
|
||||
CtrlType: sceneEx.ctrlType,
|
||||
PlayerPool: tienlenType.PlayerPool,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,6 +55,8 @@ type GameDetailedLog struct {
|
|||
Time time.Time //记录时间
|
||||
Trend20Lately string //最近游戏走势
|
||||
Ts int64 //时间戳
|
||||
CtrlType int // 1控赢 2控输 0不控
|
||||
PlayerPool map[int]int // 个人水池分
|
||||
}
|
||||
|
||||
func NewGameDetailedLog() *GameDetailedLog {
|
||||
|
@ -63,7 +65,7 @@ func NewGameDetailedLog() *GameDetailedLog {
|
|||
}
|
||||
|
||||
func NewGameDetailedLogEx(logid string, gameid, sceneid, gamemode, gamefreeid, playercount, gametiming, gamebasebet int32,
|
||||
gamedetailednote string, platform string, clubId int32, clubRoom string, cpCtx CoinPoolCtx, ver int32, trend20Lately string) *GameDetailedLog {
|
||||
gamedetailednote string, platform string, clubId int32, clubRoom string, cpCtx CoinPoolCtx, ver int32, trend20Lately string, ctrlType int, playerPool map[int]int) *GameDetailedLog {
|
||||
cl := NewGameDetailedLog()
|
||||
cl.LogId = logid
|
||||
cl.GameId = gameid
|
||||
|
@ -83,6 +85,8 @@ func NewGameDetailedLogEx(logid string, gameid, sceneid, gamemode, gamefreeid, p
|
|||
cl.GameDetailVer = ver
|
||||
cl.Trend20Lately = trend20Lately
|
||||
cl.Ts = time.Now().Unix()
|
||||
cl.CtrlType = ctrlType
|
||||
cl.PlayerPool = playerPool
|
||||
return cl
|
||||
}
|
||||
|
||||
|
|
|
@ -1521,6 +1521,8 @@ type TienLenType struct {
|
|||
TaxRate int32 //税率(万分比)
|
||||
PlayerData []TienLenPerson //玩家信息
|
||||
RoomMode int
|
||||
CtrlType int `json:"-"` // 1控赢 2控输 0不控
|
||||
PlayerPool map[int]int `json:"-"`
|
||||
}
|
||||
|
||||
type TienLenAddItem struct {
|
||||
|
|
|
@ -88,6 +88,7 @@ type GameParam struct {
|
|||
TestActSwitch bool // 开启所有活动开关
|
||||
RankPlayerLevelMaxNum int //等级榜最大人数
|
||||
CloseChannelSwitch bool //关闭渠道开关功能
|
||||
BackendTimeLocal int //后台时区
|
||||
}
|
||||
|
||||
var GameParamPath = "../data/gameparam.json"
|
||||
|
@ -238,4 +239,7 @@ func InitGameParam() {
|
|||
if GameParamData.RankPlayerLevelMaxNum == 0 {
|
||||
GameParamData.RankPlayerLevelMaxNum = 100
|
||||
}
|
||||
if GameParamData.BackendTimeLocal == 0 {
|
||||
GameParamData.BackendTimeLocal = 8
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,10 +74,11 @@ type Message struct {
|
|||
Params []int32 //额外参数
|
||||
Platform string //平台信息
|
||||
ShowId int64 //区分主子游戏大厅
|
||||
Channel []string //渠道
|
||||
}
|
||||
|
||||
func NewMessage(pid string, srcId int32, srcName string, snid, mType int32, title, content string, coin, diamond int64,
|
||||
state int32, addTime int64, attachState int32, giftId string, params []int32, platform string, showId int64) *Message {
|
||||
state int32, addTime int64, attachState int32, giftId string, params []int32, platform string, showId int64, channel []string) *Message {
|
||||
if srcName == "" {
|
||||
srcName = "{\"zh\":\"系统\",\"vi\":\"GM\",\"en\":\"GM\",\"kh\":\"GM\"}"
|
||||
}
|
||||
|
@ -99,6 +100,7 @@ func NewMessage(pid string, srcId int32, srcName string, snid, mType int32, titl
|
|||
Platform: platform,
|
||||
Diamond: diamond,
|
||||
ShowId: showId,
|
||||
Channel: channel,
|
||||
}
|
||||
if msg.Pid == "" {
|
||||
msg.Pid = msg.Id.Hex()
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -468,6 +468,7 @@ message ASCreateShortMessage{
|
|||
int64 Diamond = 8;
|
||||
int64 ShowId = 9;
|
||||
repeated int32 Params = 10;
|
||||
repeated string OnChannelName = 11;
|
||||
}
|
||||
message SACreateShortMessage{
|
||||
TagCode Tag = 1; //错误码
|
||||
|
@ -913,6 +914,8 @@ message ASAddItemById{
|
|||
int32 Snid = 1; // 玩家id
|
||||
string Platform = 2; // 平台id
|
||||
repeated ItemInfo ItemInfo = 3;//道具
|
||||
int32 TypeId = 4; // 变化类型
|
||||
string Remark = 5; // 描述
|
||||
}
|
||||
|
||||
message SAAddItemById{
|
||||
|
|
|
@ -86,7 +86,7 @@ func (this *CSInviteCodePlayerHandler) Process(s *netlib.Session, packetid int,
|
|||
//发送邮件
|
||||
var otherParams []int32
|
||||
newMsg := model.NewMessage("", p.SnId, "", p.SnId, model.MSGTYPE_INVITECODE, p.Name, inviteCode, coin, 0,
|
||||
model.MSGSTATE_UNREAD, time.Now().Unix(), 0, "", otherParams, p.Platform, model.HallAll)
|
||||
model.MSGSTATE_UNREAD, time.Now().Unix(), 0, "", otherParams, p.Platform, model.HallAll, nil)
|
||||
err = model.InsertMessage(p.Platform, newMsg)
|
||||
if err == nil {
|
||||
|
||||
|
|
|
@ -561,8 +561,7 @@ func (this *Player) SendGameConfig(gameId int32, plf, chl string) {
|
|||
}
|
||||
|
||||
func (this *Player) LoadMessage(lastLogoutTime int64, isFirstLogin, isSkipWeek bool) {
|
||||
task.New(nil,
|
||||
task.CallableWrapper(func(o *basic.Object) interface{} {
|
||||
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
||||
//msgs, err := model.GetMessageByNotState(this.SnId, model.MSGSTATE_REMOVEED)
|
||||
//if err == nil {
|
||||
// return msgs
|
||||
|
@ -612,7 +611,7 @@ func (this *Player) LoadMessage(lastLogoutTime int64, isFirstLogin, isSkipWeek b
|
|||
if bHasAddToPlayer == false {
|
||||
newMsg := model.NewMessage(msg.Id.Hex(), msg.SrcId, "", this.SnId, msg.MType, msg.Title,
|
||||
msg.Content, msg.Coin, msg.Diamond, model.MSGSTATE_UNREAD, msg.CreatTs, msg.AttachState,
|
||||
msg.GiftId, msg.Params, msg.Platform, msg.ShowId)
|
||||
msg.GiftId, msg.Params, msg.Platform, msg.ShowId, msg.Channel)
|
||||
dbMsgs = append(dbMsgs, newMsg)
|
||||
}
|
||||
}
|
||||
|
@ -661,6 +660,9 @@ func (this *Player) SendMessage(showId int64) {
|
|||
for _, msg := range this.msgs {
|
||||
|
||||
if msg.State != model.MSGSTATE_REMOVEED && (msg.ShowId == model.HallAll || msg.ShowId&showId != 0) {
|
||||
if len(msg.Channel) > 0 && !common.InSliceString(msg.Channel, this.LastChannel) {
|
||||
continue
|
||||
}
|
||||
|
||||
giftState := int32(0)
|
||||
//if len(msg.GiftId) > 0 {
|
||||
|
@ -846,6 +848,10 @@ func (this *Player) AddMessage(msg *model.Message) {
|
|||
return
|
||||
}
|
||||
|
||||
if len(msg.Channel) > 0 && !common.InSliceString(msg.Channel, this.LastChannel) {
|
||||
return
|
||||
}
|
||||
|
||||
if _, exist := this.msgs[msg.Id.Hex()]; !exist {
|
||||
this.msgs[msg.Id.Hex()] = msg
|
||||
|
||||
|
@ -1036,7 +1042,7 @@ func (this *Player) SendIosInstallStableMail() {
|
|||
var newMsg *model.Message
|
||||
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
||||
newMsg = model.NewMessage("", 0, "", this.SnId, model.MSGTYPE_IOSINSTALLSTABLE, "系统通知", fmt.Sprintf("感谢您下载稳定版本,额外奖励%d元,请查收", int(model.GameParamData.IosStableInstallPrize/100)),
|
||||
int64(model.GameParamData.IosStableInstallPrize), 0, 0, time.Now().Unix(), 0, "", nil, this.Platform, model.HallAll)
|
||||
int64(model.GameParamData.IosStableInstallPrize), 0, 0, time.Now().Unix(), 0, "", nil, this.Platform, model.HallAll, nil)
|
||||
return model.InsertMessage(this.Platform, newMsg)
|
||||
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
|
||||
if data == nil {
|
||||
|
@ -1055,7 +1061,7 @@ func (this *Player) TestMail() {
|
|||
otherParams = append(otherParams, 20001, 3)
|
||||
otherParams = append(otherParams, 20002, 3)
|
||||
newMsg = model.NewMessage("", 0, "", this.SnId, model.MSGTYPE_ITEM, "系统通知道具test", "测试",
|
||||
100000, 100, model.MSGSTATE_UNREAD, time.Now().Unix(), 0, "", otherParams, this.Platform, 0)
|
||||
100000, 100, model.MSGSTATE_UNREAD, time.Now().Unix(), 0, "", otherParams, this.Platform, 0, nil)
|
||||
return model.InsertMessage(this.Platform, newMsg)
|
||||
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
|
||||
if data == nil {
|
||||
|
@ -1075,7 +1081,7 @@ func (this *Player) TestSubMail() {
|
|||
otherParams = append(otherParams, 20001, 3)
|
||||
otherParams = append(otherParams, 20002, 3)
|
||||
newMsg = model.NewMessage("", 0, "", 0, model.MSGTYPE_ITEM, "系统", "测试",
|
||||
100000, 100, model.MSGSTATE_UNREAD, time.Now().Unix(), 0, "", otherParams, this.Platform, model.HallTienlen)
|
||||
100000, 100, model.MSGSTATE_UNREAD, time.Now().Unix(), 0, "", otherParams, this.Platform, model.HallTienlen, nil)
|
||||
return model.InsertMessage(this.Platform, newMsg)
|
||||
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
|
||||
if data == nil {
|
||||
|
|
|
@ -84,7 +84,7 @@ func (this *PlayerRankSeason) sendEmailAward(rankType int32) {
|
|||
content := i18n.Tr("languages", "RankAward")
|
||||
|
||||
newMsg = model.NewMessage("", 0, "", this.SnId, model.MSGTYPE_RANK_REWARD,
|
||||
title, content, coin, diamond, model.MSGSTATE_UNREAD, time.Now().Unix(), 0, "", otherParams, this.Platform, model.HallTienlen)
|
||||
title, content, coin, diamond, model.MSGSTATE_UNREAD, time.Now().Unix(), 0, "", otherParams, this.Platform, model.HallTienlen, nil)
|
||||
|
||||
return model.InsertMessage(this.Platform, newMsg)
|
||||
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
|
||||
|
|
|
@ -7,6 +7,7 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
nowtool "github.com/jinzhu/now"
|
||||
"mongo.games.com/goserver/core/basic"
|
||||
"mongo.games.com/goserver/core/i18n"
|
||||
"mongo.games.com/goserver/core/logger"
|
||||
|
@ -25,6 +26,7 @@ import (
|
|||
|
||||
func init() {
|
||||
module.RegisteModule(TournamentMgr, time.Second, 0)
|
||||
ClockMgrSington.RegisteSinker(TournamentMgr)
|
||||
}
|
||||
|
||||
const (
|
||||
|
@ -78,6 +80,7 @@ type PlayerRoundInfo struct {
|
|||
}
|
||||
|
||||
type Tournament struct {
|
||||
BaseClockSinker
|
||||
GameMatchDateList map[string]map[int32]*webapiproto.GameMatchDate // 比赛配置,platform:比赛场配置id:比赛配置
|
||||
singleSignupPlayers map[int32]*SignupInfo // 开启机器人时,报名的玩家,玩家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)
|
||||
for _, v := range data.List {
|
||||
if this.checkData(v) {
|
||||
this.FixMatchTimeStamp(v)
|
||||
configs[v.Id] = v
|
||||
} else {
|
||||
logger.Logger.Error("GameMatchDate error: ", v)
|
||||
|
@ -274,17 +278,6 @@ func (this *Tournament) IsRobotOn(match *webapiproto.GameMatchDate) bool {
|
|||
// IsTimeRange 判断是否在比赛时间段内
|
||||
// 在时间段内才能报名
|
||||
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 {
|
||||
return false
|
||||
}
|
||||
|
@ -299,17 +292,21 @@ func (this *Tournament) IsTimeRange(gmd *webapiproto.GameMatchDate) bool {
|
|||
case 0:
|
||||
return true
|
||||
case 1:
|
||||
nowWeek := getWeekNum(tNow)
|
||||
hms := int32(tNow.Hour()*10000 + tNow.Minute()*100 + tNow.Second())
|
||||
if gmd.MatchTimeWeek != nil && len(gmd.MatchTimeWeek) > 0 {
|
||||
for _, week := range gmd.MatchTimeWeek {
|
||||
if nowWeek == int(week) {
|
||||
if hms >= gmd.MatchTimeStartHMS && hms <= gmd.MatchTimeEndHMS {
|
||||
week := this.getWeekDay()
|
||||
for _, v := range gmd.MatchTimeWeek {
|
||||
if week == int(v) {
|
||||
if gmd.MatchTimeStamp != nil && len(gmd.MatchTimeStamp) > 1 {
|
||||
this.FixMatchTimeStamp(gmd)
|
||||
startStamp := gmd.MatchTimeStamp[0]
|
||||
endStamp := gmd.MatchTimeStamp[1]
|
||||
if tNow.Unix() >= startStamp && tNow.Unix() <= endStamp {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
case 2:
|
||||
if gmd.MatchTimeStamp != nil && len(gmd.MatchTimeStamp) > 1 {
|
||||
startStamp := gmd.MatchTimeStamp[0]
|
||||
|
@ -1201,7 +1198,7 @@ func (this *Tournament) sendPromotionInfo(mc *PlayerMatchContext, sortId int64,
|
|||
title := i18n.Tr("languages", "MatchAwardTitle")
|
||||
content := i18n.Tr("languages", "MatchAward", params)
|
||||
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)
|
||||
if err != nil {
|
||||
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) 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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3229,6 +3229,10 @@ func init() {
|
|||
diamond := msg.GetDiamond()
|
||||
otherParams := msg.GetParams()
|
||||
showId := msg.GetShowId()
|
||||
channel := msg.GetOnChannelName()
|
||||
if destSnid > 0 {
|
||||
channel = []string{}
|
||||
}
|
||||
|
||||
if messageType == model.MSGTYPE_ITEM && len(otherParams) != 0 && len(otherParams)%2 != 0 {
|
||||
pack.Tag = webapiproto.TagCode_FAILED
|
||||
|
@ -3243,6 +3247,9 @@ func init() {
|
|||
if p.IsRob == true { //排除掉机器人
|
||||
continue
|
||||
}
|
||||
if len(channel) > 0 && !common.InSliceString(channel, p.LastChannel) { // 渠道过滤
|
||||
continue
|
||||
}
|
||||
if platform == "" || p.Platform == platform {
|
||||
onlinePlayerSnid = append(onlinePlayerSnid, p.SnId)
|
||||
}
|
||||
|
@ -3265,7 +3272,7 @@ func init() {
|
|||
// var otherParams []int32
|
||||
|
||||
newMsg = model.NewMessage("", int32(srcSnid), "", int32(destSnid), int32(messageType), title, content, coin, diamond,
|
||||
model.MSGSTATE_UNREAD, time.Now().Unix(), model.MSGATTACHSTATE_DEFAULT, "", otherParams, platform, showId)
|
||||
model.MSGSTATE_UNREAD, time.Now().Unix(), model.MSGATTACHSTATE_DEFAULT, "", otherParams, platform, showId, channel)
|
||||
if newMsg != nil {
|
||||
err := model.InsertMessage(platform, newMsg)
|
||||
if err != nil {
|
||||
|
@ -3278,7 +3285,7 @@ func init() {
|
|||
if destSnid == 0 {
|
||||
for _, psnid := range onlinePlayerSnid {
|
||||
newMsg := model.NewMessage(newMsg.Id.Hex(), newMsg.SrcId, "", psnid, newMsg.MType, newMsg.Title, newMsg.Content, newMsg.Coin, newMsg.Diamond,
|
||||
newMsg.State, newMsg.CreatTs, newMsg.AttachState, newMsg.GiftId, otherParams, platform, newMsg.ShowId)
|
||||
newMsg.State, newMsg.CreatTs, newMsg.AttachState, newMsg.GiftId, otherParams, platform, newMsg.ShowId, channel)
|
||||
if newMsg != nil {
|
||||
dbMsgs = append(dbMsgs, newMsg)
|
||||
}
|
||||
|
@ -4360,13 +4367,13 @@ func init() {
|
|||
p := PlayerMgrSington.GetPlayerBySnId(msg.GetSnid())
|
||||
if p != nil {
|
||||
//获取道具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.Msg = "AddItem success"
|
||||
return common.ResponseTag_Ok, pack
|
||||
} else {
|
||||
BagMgrSingleton.AddItemsOffline(msg.Platform, msg.Snid, items, common.GainWayBackend,
|
||||
"system", "后台操作", 0, 0, false, func(err error) {
|
||||
BagMgrSingleton.AddItemsOffline(msg.Platform, msg.Snid, items, msg.GetTypeId(),
|
||||
"system", msg.GetRemark(), 0, 0, false, func(err error) {
|
||||
if err != nil {
|
||||
pack.Tag = webapiproto.TagCode_FAILED
|
||||
pack.Msg = "AddItem failed:" + err.Error()
|
||||
|
|
Loading…
Reference in New Issue