增加日志分析工具
This commit is contained in:
parent
0e391bc071
commit
a33320065c
@ -9,6 +9,7 @@ import (
|
|||||||
"server/game/mod/endless"
|
"server/game/mod/endless"
|
||||||
limitedTimeEvent "server/game/mod/limited_time_event"
|
limitedTimeEvent "server/game/mod/limited_time_event"
|
||||||
"server/game/mod/mail"
|
"server/game/mod/mail"
|
||||||
|
"server/game/mod/order"
|
||||||
"server/game/mod/playroom"
|
"server/game/mod/playroom"
|
||||||
sevenLogin "server/game/mod/seven_login"
|
sevenLogin "server/game/mod/seven_login"
|
||||||
)
|
)
|
||||||
@ -52,3 +53,7 @@ func (p *Player) GetMailMod() *mail.MailMod {
|
|||||||
func (p *Player) GetSevenLoginMod() *sevenLogin.SevenLoginMod {
|
func (p *Player) GetSevenLoginMod() *sevenLogin.SevenLoginMod {
|
||||||
return p.PlayMod.getSevenLoginMod()
|
return p.PlayMod.getSevenLoginMod()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *Player) GetOrderMod() *order.OrderMod {
|
||||||
|
return p.PlayMod.getOrderMod()
|
||||||
|
}
|
||||||
|
|||||||
@ -118,6 +118,39 @@ func (p *PlayerBaseData) LoadDataFromDB(UserName interface{}) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *PlayerBaseData) LoadDataFromDBByUid(Uid int) bool {
|
||||||
|
sqlStr := "SELECT * FROM t_player_baseinfo WHERE DwUin = ?"
|
||||||
|
sqlStruck := db.ResPlayerBaseInfo{}
|
||||||
|
if err := db.SqlDb.Get(&sqlStruck, sqlStr, Uid); err != nil {
|
||||||
|
log.Debug("PlayerBaseData get data failed, err:%v\n", err)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
p.Data.Diamond = sqlStruck.Diamond
|
||||||
|
p.Data.DwUin = sqlStruck.DwUin
|
||||||
|
p.Data.Energy = sqlStruck.Energy
|
||||||
|
p.Data.Star = sqlStruck.Star
|
||||||
|
p.Data.RecoverTime = sqlStruck.RecoverTime
|
||||||
|
p.Data.Level = sqlStruck.Level
|
||||||
|
p.Data.Exp = sqlStruck.Exp
|
||||||
|
p.Data.StartOrderId = sqlStruck.StartOrderId
|
||||||
|
p.Data.MusicCode = sqlStruck.MusicCode
|
||||||
|
p.Data.Guild = sqlStruck.Guild
|
||||||
|
p.Data.PackUnlockCount = sqlStruck.PackUnlockCount
|
||||||
|
p.Data.LastPlayTime = sqlStruck.LastPlayTime
|
||||||
|
p.Data.Ban = sqlStruck.Ban
|
||||||
|
p.Data.UserName = sqlStruck.UserName
|
||||||
|
p.Data.LogoutTime = sqlStruck.LogoutTime
|
||||||
|
p.Data.Node = sqlStruck.Node
|
||||||
|
p.Data.Rolecreatetime = sqlStruck.Rolecreatetime
|
||||||
|
p.Data.LastChampGroupID = sqlStruck.LastChampGroupID
|
||||||
|
p.Data.ChampshipsGroupID = sqlStruck.ChampshipsGroupID
|
||||||
|
p.Data.NoAd = sqlStruck.NoAd
|
||||||
|
p.Data.FaceBookId = sqlStruck.FaceBookId
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
func (p *PlayerBaseData) SaveDataFromDB(Key interface{}) bool {
|
func (p *PlayerBaseData) SaveDataFromDB(Key interface{}) bool {
|
||||||
BaseMod := p.p.PlayMod.getBaseMod()
|
BaseMod := p.p.PlayMod.getBaseMod()
|
||||||
sqlStruck := db.ResPlayerBaseInfo{}
|
sqlStruck := db.ResPlayerBaseInfo{}
|
||||||
|
|||||||
@ -217,7 +217,7 @@ func (p *Player) InitPlayer(UserName string) error {
|
|||||||
// 玩家基础数据
|
// 玩家基础数据
|
||||||
ok := Base.LoadDataFromDB(UserName)
|
ok := Base.LoadDataFromDB(UserName)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.Debug("load PlayerBaseData failed:", UserName)
|
log.Debug("load PlayerBaseData failed:%s", UserName)
|
||||||
return errors.New("load PlayerBaseData failed")
|
return errors.New("load PlayerBaseData failed")
|
||||||
}
|
}
|
||||||
p.PlayerBaseMod = Base
|
p.PlayerBaseMod = Base
|
||||||
@ -229,7 +229,66 @@ func (p *Player) InitPlayer(UserName string) error {
|
|||||||
modData := &PlayerModData{PlayerData: NewPlayerData("PlayerModData", p)}
|
modData := &PlayerModData{PlayerData: NewPlayerData("PlayerModData", p)}
|
||||||
ok = modData.LoadDataFromDB(Base.Data.DwUin)
|
ok = modData.LoadDataFromDB(Base.Data.DwUin)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.Debug("load PlayerModData failed:", UserName)
|
log.Debug("load PlayerModData failed:%s", UserName)
|
||||||
|
return errors.New("load PlayerModData failed")
|
||||||
|
}
|
||||||
|
IsUpdate, err := modData.InitMod(p)
|
||||||
|
if err != nil {
|
||||||
|
log.Debug("InitMod failed:", err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
p.PlayMod.mod_list = modData.ModList
|
||||||
|
p.PlayMod.is_update = IsUpdate
|
||||||
|
// 启动定时器
|
||||||
|
p.DispatcherHandle()
|
||||||
|
p.McronSave = cron.New()
|
||||||
|
_, err = p.McronSave.AddFunc("@every 1m", p.AutoSaveData)
|
||||||
|
if err != nil {
|
||||||
|
log.Debug("AddFunc failed:", err)
|
||||||
|
}
|
||||||
|
p.McronSave.Start()
|
||||||
|
p.initAcitivity()
|
||||||
|
p.ZeroUpdate(nil)
|
||||||
|
p.NoonUpdate(nil)
|
||||||
|
p.Login()
|
||||||
|
p.OrderShip()
|
||||||
|
p.UpdateUserInfo()
|
||||||
|
// fix bug
|
||||||
|
ChargeMod := p.PlayMod.getChargeMod()
|
||||||
|
ChessMod := p.PlayMod.getChessMod()
|
||||||
|
ChargeMod.FixBug(ChessMod.GetEmitList())
|
||||||
|
p.FixOrderBug()
|
||||||
|
p.FixDecorate()
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *Player) InitPlayerByUid(Uid int) error {
|
||||||
|
p.lock.Lock()
|
||||||
|
defer p.lock.Unlock()
|
||||||
|
p.msgChan = make(chan *MsgMod.Msg, 100)
|
||||||
|
p.Msg = make([]PlayerMsg, 0)
|
||||||
|
p.args = make(map[string]interface{})
|
||||||
|
p.timerList = make(map[string]*timer.Timer)
|
||||||
|
p.MDispatr = timer.NewDispatcher(100)
|
||||||
|
p.stopSignal = make(chan bool)
|
||||||
|
Base := &PlayerBaseData{p: p}
|
||||||
|
|
||||||
|
// 玩家基础数据
|
||||||
|
ok := Base.LoadDataFromDBByUid(Uid)
|
||||||
|
if !ok {
|
||||||
|
log.Debug("load PlayerBaseData failed:%d", Uid)
|
||||||
|
return errors.New("load PlayerBaseData failed")
|
||||||
|
}
|
||||||
|
p.PlayerBaseMod = Base
|
||||||
|
p.M_DwUin = Base.Data.DwUin
|
||||||
|
|
||||||
|
// 棋盘数据
|
||||||
|
|
||||||
|
// 玩家模块数据
|
||||||
|
modData := &PlayerModData{PlayerData: NewPlayerData("PlayerModData", p)}
|
||||||
|
ok = modData.LoadDataFromDB(Base.Data.DwUin)
|
||||||
|
if !ok {
|
||||||
|
log.Debug("load PlayerModData failed:%d", Uid)
|
||||||
return errors.New("load PlayerModData failed")
|
return errors.New("load PlayerModData failed")
|
||||||
}
|
}
|
||||||
IsUpdate, err := modData.InitMod(p)
|
IsUpdate, err := modData.InitMod(p)
|
||||||
|
|||||||
@ -142,6 +142,7 @@ func (player *Player) TriggerShippingOrderOrigin(req *msg.ReqShippingOrder) {
|
|||||||
ProduceName := chargeCfg.GetProduceName(OrderData.ProductId)
|
ProduceName := chargeCfg.GetProduceName(OrderData.ProductId)
|
||||||
GoUtil.SendFeishuOrder(int(player.M_DwUin), OrderData.PayChannelOrderId, OrderData.Price, ProduceName, OrderData.PayTime, GoUtil.Now(), ChargeMod.Charge)
|
GoUtil.SendFeishuOrder(int(player.M_DwUin), OrderData.PayChannelOrderId, OrderData.Price, ProduceName, OrderData.PayTime, GoUtil.Now(), ChargeMod.Charge)
|
||||||
}
|
}
|
||||||
|
BaseMod := player.PlayMod.getBaseMod()
|
||||||
orderDataMap := map[string]interface{}{
|
orderDataMap := map[string]interface{}{
|
||||||
"AppId": conf.Server.AppID,
|
"AppId": conf.Server.AppID,
|
||||||
"ServerId": conf.Server.ServerID,
|
"ServerId": conf.Server.ServerID,
|
||||||
@ -153,6 +154,9 @@ func (player *Player) TriggerShippingOrderOrigin(req *msg.ReqShippingOrder) {
|
|||||||
"Token": req.Token,
|
"Token": req.Token,
|
||||||
"Price": OrderData.Price,
|
"Price": OrderData.Price,
|
||||||
"PayType": OrderData.PayType,
|
"PayType": OrderData.PayType,
|
||||||
|
"Level": BaseMod.GetLevel(),
|
||||||
|
"Energy": BaseMod.GetEnergy(),
|
||||||
|
"Star": BaseMod.GetStar(),
|
||||||
}
|
}
|
||||||
player.TeLog("pay", orderDataMap)
|
player.TeLog("pay", orderDataMap)
|
||||||
player.PushClientRes(&msg.ResShippingOrder{
|
player.PushClientRes(&msg.ResShippingOrder{
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user