Merge remote-tracking branch 'origin/develop' into dev_slots
This commit is contained in:
commit
29e9c7bfe8
|
@ -1,50 +0,0 @@
|
|||
package common
|
||||
|
||||
import (
|
||||
"mongo.games.com/goserver/core/logger"
|
||||
)
|
||||
|
||||
const (
|
||||
A_USER_BLACK = 1 //增加黑名单
|
||||
)
|
||||
|
||||
type Action struct {
|
||||
ActionID int //执行id
|
||||
ActionParamInt64 []int //整形参数
|
||||
ActionParamFloat []float64 //浮点参数
|
||||
ActionParamString []string //字符串参数
|
||||
}
|
||||
|
||||
var ActionMgrSington = &ActionMgr{
|
||||
pool: make(map[int]ActionBase),
|
||||
}
|
||||
|
||||
type ActionMgr struct {
|
||||
pool map[int]ActionBase
|
||||
}
|
||||
|
||||
func (this *ActionMgr) ActionGroup(need interface{}, action []*Action) bool {
|
||||
for i := 0; i < len(action); i++ {
|
||||
this.action(need, action[i])
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func (this *ActionMgr) action(need interface{}, action *Action) bool {
|
||||
a, ok := this.pool[action.ActionID]
|
||||
if !ok {
|
||||
logger.Logger.Warnf("no this action %v", action.ActionID)
|
||||
return false
|
||||
}
|
||||
|
||||
return a.Action(need, action)
|
||||
}
|
||||
|
||||
func (this *ActionMgr) Register(cid int, c ActionBase) {
|
||||
this.pool[cid] = c
|
||||
}
|
||||
|
||||
type ActionBase interface {
|
||||
Action(need interface{}, action *Action) bool
|
||||
}
|
|
@ -1,54 +1,55 @@
|
|||
package common
|
||||
|
||||
import (
|
||||
"mongo.games.com/game/protocol/server"
|
||||
"mongo.games.com/goserver/core/logger"
|
||||
"mongo.games.com/goserver/core/module"
|
||||
"mongo.games.com/goserver/core/mongo"
|
||||
"mongo.games.com/goserver/core/netlib"
|
||||
|
||||
"mongo.games.com/game/protocol/server"
|
||||
)
|
||||
|
||||
// GameSessState 服务状态
|
||||
type GameSessState int
|
||||
|
||||
const (
|
||||
GAME_SESS_STATE_OFF GameSessState = iota //关闭状态
|
||||
GAME_SESS_STATE_ON //开启状态
|
||||
GameSessStateOff GameSessState = iota //关闭状态
|
||||
GameSessStateOn //开启状态
|
||||
)
|
||||
|
||||
var ServerCtrlCallback func(int32)
|
||||
var SrvIsMaintaining = true
|
||||
|
||||
func RegisteServerCtrlCallback(cb func(int32)) {
|
||||
var ServerCtrlCallback func(msg *server.ServerCtrl)
|
||||
|
||||
func RegisterServerCtrlCallback(cb func(msg *server.ServerCtrl)) {
|
||||
ServerCtrlCallback = cb
|
||||
}
|
||||
|
||||
type ServerCtrlPacketFactory struct {
|
||||
func init() {
|
||||
netlib.Register(int(server.SSPacketID_PACKET_MS_SRVCTRL), &server.ServerCtrl{}, ServerCtrlHandler)
|
||||
}
|
||||
|
||||
type ServerCtrlHandler struct {
|
||||
}
|
||||
// ServerCtrlHandler 服务器控制,通用事件
|
||||
func ServerCtrlHandler(s *netlib.Session, packetid int, data interface{}) error {
|
||||
logger.Logger.Infof("ServerCtrlHandler %v", data)
|
||||
msg, ok := data.(*server.ServerCtrl)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
switch msg.GetCtrlCode() {
|
||||
case SrvCtrlCloseCode:
|
||||
module.Stop()
|
||||
|
||||
func (this *ServerCtrlPacketFactory) CreatePacket() interface{} {
|
||||
pack := &server.ServerCtrl{}
|
||||
return pack
|
||||
}
|
||||
case SrvCtrlResetMgoSession:
|
||||
mongo.ResetAllSession()
|
||||
|
||||
func (this *ServerCtrlHandler) Process(s *netlib.Session, packetid int, data interface{}) error {
|
||||
default:
|
||||
logger.Logger.Errorf("unknow server ctrl %v", msg)
|
||||
}
|
||||
|
||||
if sc, ok := data.(*server.ServerCtrl); ok {
|
||||
logger.Logger.Trace("ServerCtrlHandler.Process== ", *sc)
|
||||
switch sc.GetCtrlCode() {
|
||||
case SrvCtrlCloseCode:
|
||||
module.Stop()
|
||||
}
|
||||
|
||||
//回调
|
||||
if ServerCtrlCallback != nil {
|
||||
ServerCtrlCallback(sc.GetCtrlCode())
|
||||
}
|
||||
// 服务自己处理的特殊事件
|
||||
if ServerCtrlCallback != nil {
|
||||
ServerCtrlCallback(msg)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
netlib.RegisterHandler(int(server.SSPacketID_PACKET_MS_SRVCTRL), &ServerCtrlHandler{})
|
||||
netlib.RegisterFactory(int(server.SSPacketID_PACKET_MS_SRVCTRL), &ServerCtrlPacketFactory{})
|
||||
}
|
||||
|
|
172
common/aes.go
172
common/aes.go
|
@ -1,172 +0,0 @@
|
|||
package common
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/aes"
|
||||
"crypto/cipher"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"mongo.games.com/goserver/core/logger"
|
||||
"regexp"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
var key = []byte("kjh-vgjhhionoommmkokmokoo$%JH")
|
||||
|
||||
// 加密
|
||||
func EnCrypt(orig []byte) (str string) {
|
||||
defer func() {
|
||||
err := recover()
|
||||
if err != nil {
|
||||
logger.Logger.Errorf("EnCrypt %v Error %v", string(orig), err)
|
||||
str = string(orig)
|
||||
}
|
||||
}()
|
||||
//将秘钥中的每个字节累加,通过sum实现orig的加密工作
|
||||
sum := 0
|
||||
for i := 0; i < len(key); i++ {
|
||||
sum += int(key[0])
|
||||
}
|
||||
|
||||
//给明文补码
|
||||
var pkcs_code = PKCS5Padding(orig, 8)
|
||||
|
||||
//通过秘钥,对补码后的明文进行加密
|
||||
for j := 0; j < len(pkcs_code); j++ {
|
||||
pkcs_code[j] += byte(sum)
|
||||
}
|
||||
//base64.URLEncoding.EncodeToString()
|
||||
return base64.URLEncoding.EncodeToString(pkcs_code)
|
||||
}
|
||||
|
||||
// 补码
|
||||
func PKCS5Padding(orig []byte, size int) []byte {
|
||||
//计算明文的长度
|
||||
length := len(orig)
|
||||
padding := size - length%size
|
||||
//向byte类型的数组中重复添加padding
|
||||
repeats := bytes.Repeat([]byte{byte(padding)}, padding)
|
||||
return append(orig, repeats...)
|
||||
}
|
||||
|
||||
// 解密
|
||||
func DeCrypt(text string) (str string) {
|
||||
defer func() {
|
||||
err := recover()
|
||||
if err != nil {
|
||||
logger.Logger.Errorf("DeCrypt %v Error %v", text, err)
|
||||
str = text
|
||||
}
|
||||
}()
|
||||
//orig, err := base64.StdEncoding.DecodeString(text)
|
||||
orig, err := base64.URLEncoding.DecodeString(text)
|
||||
if err != nil {
|
||||
return "密文类型错误"
|
||||
}
|
||||
sum := 0
|
||||
for i := 0; i < len(key); i++ {
|
||||
sum += int(key[0])
|
||||
}
|
||||
|
||||
//解密
|
||||
for j := 0; j < len(orig); j++ {
|
||||
orig[j] -= byte(sum)
|
||||
}
|
||||
|
||||
//去码
|
||||
var pkcs_unCode = PKCS5UnPadding(orig)
|
||||
return string(pkcs_unCode)
|
||||
}
|
||||
|
||||
// 去码
|
||||
func PKCS5UnPadding(orig []byte) []byte {
|
||||
//获取最后一位补码的数字
|
||||
var tail = int(orig[len(orig)-1])
|
||||
return orig[:(len(orig) - tail)]
|
||||
}
|
||||
|
||||
var aesRule, _ = regexp.Compile(`^[0-9]+$`)
|
||||
|
||||
const (
|
||||
aeskey = "DoNotEditThisKeyDoNotEditThisKey" // 加密的密钥,绝不可以更改
|
||||
)
|
||||
|
||||
// 下面的字符串,也绝不可以更改
|
||||
var defaultLetters = []rune("idjGfiRogsFnkdKgokdfgdow07u6978uxcvvLiPiDfjafOd2fuFJYYGBJuykbvfk")
|
||||
|
||||
func AesEncrypt(origDataStr string) (str string) {
|
||||
defer func() {
|
||||
err := recover()
|
||||
if err != nil {
|
||||
logger.Logger.Errorf("AesEncrypt %v Error %v", origDataStr, err)
|
||||
str = origDataStr
|
||||
}
|
||||
}()
|
||||
strlen := len(origDataStr)
|
||||
b := aesRule.MatchString(origDataStr)
|
||||
//不全是数字,或长度为零,不加密
|
||||
if !b || strlen == 0 {
|
||||
return origDataStr
|
||||
}
|
||||
phonenum, errint := strconv.Atoi(origDataStr)
|
||||
if errint != nil {
|
||||
return origDataStr
|
||||
}
|
||||
|
||||
text := []byte(origDataStr)
|
||||
//指定加密、解密算法为AES,返回一个AES的Block接口对象
|
||||
block, err := aes.NewCipher([]byte(aeskey))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
//指定计数器,长度必须等于block的块尺寸
|
||||
iv := string(defaultLetters[phonenum%(len(defaultLetters))])
|
||||
count := []byte(fmt.Sprintf("%016v", iv))
|
||||
//指定分组模式
|
||||
blockMode := cipher.NewCTR(block, count)
|
||||
//执行加密、解密操作
|
||||
message := make([]byte, len(text))
|
||||
blockMode.XORKeyStream(message, text)
|
||||
//返回明文或密文
|
||||
return fmt.Sprintf("%v%v", iv, base64.StdEncoding.EncodeToString(message))
|
||||
//return base64.StdEncoding.EncodeToString(message)
|
||||
}
|
||||
|
||||
func AesDecrypt(cryptedstr string) (str string) {
|
||||
defer func() {
|
||||
err := recover()
|
||||
if err != nil {
|
||||
logger.Logger.Errorf("AesDecrypt %v Error %v", cryptedstr, err)
|
||||
str = cryptedstr
|
||||
}
|
||||
}()
|
||||
strlen := len(cryptedstr)
|
||||
b := aesRule.MatchString(cryptedstr)
|
||||
//全是数字,或长度为零,不解密
|
||||
if b || strlen == 0 {
|
||||
return cryptedstr
|
||||
}
|
||||
|
||||
iv := cryptedstr[:1]
|
||||
str = cryptedstr[1:]
|
||||
text, err := base64.StdEncoding.DecodeString(str)
|
||||
if err != nil {
|
||||
logger.Logger.Errorf("AesDecrypt %v Err:%v", cryptedstr, err)
|
||||
return cryptedstr
|
||||
}
|
||||
|
||||
//指定加密、解密算法为AES,返回一个AES的Block接口对象
|
||||
block, err := aes.NewCipher([]byte(aeskey))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
//指定计数器,长度必须等于block的块尺寸
|
||||
count := []byte(fmt.Sprintf("%016v", iv))
|
||||
//指定分组模式
|
||||
blockMode := cipher.NewCTR(block, count)
|
||||
//执行加密、解密操作
|
||||
message := make([]byte, len(text))
|
||||
blockMode.XORKeyStream(message, text)
|
||||
//返回明文或密文
|
||||
return string(message)
|
||||
}
|
|
@ -6,6 +6,14 @@ import (
|
|||
"mongo.games.com/goserver/core/module"
|
||||
)
|
||||
|
||||
/*
|
||||
时钟
|
||||
*/
|
||||
|
||||
func init() {
|
||||
module.RegisteModule(ClockMgrSingleton, time.Millisecond*500, 0)
|
||||
}
|
||||
|
||||
var ClockMgrSingleton = &ClockMgr{
|
||||
LastHour: -1,
|
||||
LastDay: -1,
|
||||
|
@ -99,9 +107,9 @@ func (this *ClockMgr) Update() {
|
|||
this.LastSec = sec
|
||||
this.fireSecondEvent()
|
||||
|
||||
min := tNow.Minute()
|
||||
if min != this.LastMini {
|
||||
this.LastMini = min
|
||||
minute := tNow.Minute()
|
||||
if minute != this.LastMini {
|
||||
this.LastMini = minute
|
||||
this.fireMinuteEvent()
|
||||
|
||||
hour := tNow.Hour()
|
||||
|
@ -182,6 +190,87 @@ func (this *ClockMgr) GetLast() (int, int, int, int, int, int) {
|
|||
return this.LastSec, this.LastMini, this.LastHour, this.LastDay, this.LastWeek, int(this.LastMonth)
|
||||
}
|
||||
|
||||
func init() {
|
||||
module.RegisteModule(ClockMgrSingleton, time.Millisecond*500, 0)
|
||||
type ClockFunc struct {
|
||||
event int
|
||||
OnSecTimerFunc func()
|
||||
OnMiniTimerFunc func()
|
||||
OnHourTimerFunc func()
|
||||
OnDayTimerFunc func()
|
||||
OnWeekTimerFunc func()
|
||||
OnMonthTimerFunc func()
|
||||
OnShutdownFunc func()
|
||||
}
|
||||
|
||||
func (s *ClockFunc) InterestClockEvent() int { return s.event }
|
||||
|
||||
func (s *ClockFunc) OnSecTimer() {
|
||||
if s.OnSecTimerFunc != nil {
|
||||
s.OnSecTimerFunc()
|
||||
}
|
||||
}
|
||||
|
||||
func (s *ClockFunc) OnMiniTimer() {
|
||||
if s.OnMiniTimerFunc != nil {
|
||||
s.OnMiniTimerFunc()
|
||||
}
|
||||
}
|
||||
|
||||
func (s *ClockFunc) OnHourTimer() {
|
||||
if s.OnHourTimerFunc != nil {
|
||||
s.OnHourTimerFunc()
|
||||
}
|
||||
}
|
||||
|
||||
func (s *ClockFunc) OnDayTimer() {
|
||||
if s.OnDayTimerFunc != nil {
|
||||
s.OnDayTimerFunc()
|
||||
}
|
||||
}
|
||||
|
||||
func (s *ClockFunc) OnWeekTimer() {
|
||||
if s.OnWeekTimerFunc != nil {
|
||||
s.OnWeekTimerFunc()
|
||||
}
|
||||
}
|
||||
|
||||
func (s *ClockFunc) OnMonthTimer() {
|
||||
if s.OnMonthTimerFunc != nil {
|
||||
s.OnMonthTimerFunc()
|
||||
}
|
||||
}
|
||||
|
||||
func (s *ClockFunc) OnShutdown() {
|
||||
if s.OnShutdownFunc != nil {
|
||||
s.OnShutdownFunc()
|
||||
}
|
||||
}
|
||||
|
||||
// RegisterClockFunc 注册时钟事件
|
||||
func RegisterClockFunc(fs *ClockFunc) {
|
||||
if fs == nil {
|
||||
return
|
||||
}
|
||||
if fs.OnSecTimerFunc != nil {
|
||||
fs.event = fs.event | ClockEventSecond
|
||||
}
|
||||
if fs.OnMiniTimerFunc != nil {
|
||||
fs.event = fs.event | ClockEventMinute
|
||||
}
|
||||
if fs.OnHourTimerFunc != nil {
|
||||
fs.event = fs.event | ClockEventHour
|
||||
}
|
||||
if fs.OnDayTimerFunc != nil {
|
||||
fs.event = fs.event | ClockEventDay
|
||||
}
|
||||
if fs.OnWeekTimerFunc != nil {
|
||||
fs.event = fs.event | ClockEventWeek
|
||||
}
|
||||
if fs.OnMonthTimerFunc != nil {
|
||||
fs.event = fs.event | ClockEventMonth
|
||||
}
|
||||
if fs.OnShutdownFunc != nil {
|
||||
fs.event = fs.event | ClockEventShutdown
|
||||
}
|
||||
|
||||
ClockMgrSingleton.RegisterSinker(fs)
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ import (
|
|||
protocol_game "mongo.games.com/game/protocol/server"
|
||||
"mongo.games.com/goserver/core/logger"
|
||||
"mongo.games.com/goserver/core/netlib"
|
||||
"mongo.games.com/goserver/srvlib"
|
||||
"mongo.games.com/goserver/srvlib/protocol"
|
||||
)
|
||||
|
||||
|
@ -45,11 +44,11 @@ func createMulticastPacket(packetid int, data interface{}, sis ...*protocol.MCSe
|
|||
return pack, nil
|
||||
}
|
||||
|
||||
func SendToGate(sid int64, packetid int, rawpack interface{}, s *netlib.Session) bool {
|
||||
if s == nil || rawpack == nil || sid == 0 {
|
||||
func SendToGate(sid int64, packetId int, pack interface{}, s *netlib.Session) bool {
|
||||
if s == nil || pack == nil || sid == 0 {
|
||||
return false
|
||||
}
|
||||
pack, err := createMulticastPacket(packetid, rawpack,
|
||||
pack, err := createMulticastPacket(packetId, pack,
|
||||
&protocol.MCSessionUnion{
|
||||
Mccs: &protocol.MCClientSession{
|
||||
SId: proto.Int64(sid)}})
|
||||
|
@ -63,25 +62,17 @@ func SendToGate(sid int64, packetid int, rawpack interface{}, s *netlib.Session)
|
|||
return false
|
||||
}
|
||||
|
||||
func SendToActThrSrv(packetid int, rawpack interface{}) bool {
|
||||
if rawpack == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
replaySess := srvlib.ServerSessionMgrSington.GetSession(GetSelfAreaId(), ActThrServerType, ActThrServerID)
|
||||
if replaySess != nil {
|
||||
return replaySess.Send(int(packetid), rawpack)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func TransmitToServer(sid int64, packetid int, rawpack interface{}, s *netlib.Session) bool {
|
||||
if d, err := netlib.MarshalPacket(packetid, rawpack); err == nil {
|
||||
// TransmitToServer 转发消息到指定服务器
|
||||
// sid: 客户端连接标识
|
||||
// packetId: 消息id
|
||||
// pack: 消息内容
|
||||
// s: 接收消息的服务器连接
|
||||
func TransmitToServer(sid int64, packetId int, pack interface{}, s *netlib.Session) bool {
|
||||
if d, err := netlib.MarshalPacket(packetId, pack); err == nil {
|
||||
pack := &protocol_game.SSTransmit{
|
||||
PacketData: d,
|
||||
SessionId: sid,
|
||||
}
|
||||
proto.SetDefaults(pack)
|
||||
return s.Send(int(protocol_game.TransmitPacketID_PACKET_SS_PACKET_TRANSMIT), pack, true)
|
||||
} else {
|
||||
logger.Logger.Warn("TransmitToServer err:", err)
|
||||
|
|
|
@ -807,9 +807,10 @@ var (
|
|||
)
|
||||
|
||||
const (
|
||||
AttributeGuideStep = 1 // 引导步骤
|
||||
AttributeGuideSkip = 2 // 跳过引导
|
||||
AttributeGuideTest = 3 // 测试引导
|
||||
AttributeGuideStep = 1 // 引导步骤
|
||||
AttributeGuideSkip = 2 // 跳过引导
|
||||
AttributeGuideTest = 3 // 测试引导
|
||||
AttributeGuideCustom = 4 // 竞技馆引导页
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -861,3 +862,8 @@ const (
|
|||
PlayerChangeTypeCoin = 0 // 金币
|
||||
PlayerChangeTypeNum = 1 // 积分
|
||||
)
|
||||
|
||||
// 玩家状态标记
|
||||
const (
|
||||
PlayerFlagsGuideCustom = 1 << iota // 竞技馆引导页关闭状态
|
||||
)
|
||||
|
|
Binary file not shown.
|
@ -486,13 +486,13 @@
|
|||
"Id": 40003,
|
||||
"Name": "娃娃卡",
|
||||
"ShowLocation": [
|
||||
1,
|
||||
1,
|
||||
0
|
||||
0,
|
||||
0,
|
||||
1
|
||||
],
|
||||
"Classify": [
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"Type": 23,
|
||||
|
@ -6270,9 +6270,8 @@
|
|||
1
|
||||
],
|
||||
"SaleType": 1,
|
||||
"SaleGold": 5000,
|
||||
"SaleGold": 30,
|
||||
"CompositionMax": 1,
|
||||
"Time": 360,
|
||||
"Location": "0",
|
||||
"Describe": "可联系客服兑换实物奖励",
|
||||
"Gain": {
|
||||
|
@ -6308,9 +6307,8 @@
|
|||
1
|
||||
],
|
||||
"SaleType": 1,
|
||||
"SaleGold": 5000,
|
||||
"SaleGold": 30,
|
||||
"CompositionMax": 1,
|
||||
"Time": 360,
|
||||
"Location": "0",
|
||||
"Describe": "可联系客服兑换实物奖励",
|
||||
"Gain": {
|
||||
|
|
Binary file not shown.
BIN
data/DB_Task.dat
BIN
data/DB_Task.dat
Binary file not shown.
|
@ -116,23 +116,33 @@ func (svc *ItemLogSvc) UpdateState(req *model.UpdateParam, res *model.UpdateRes)
|
|||
}
|
||||
|
||||
func (svc *ItemLogSvc) GetClawdollItemLog(args *model.ClawdollItemLogReq, ret *model.GetClawdollItemLogRet) (err error) {
|
||||
//itemTypeIds := []int32{common.GainWayClawdollCostItem, common.GainWayItemShopChangeDoll}
|
||||
var sql []bson.M
|
||||
|
||||
cond := bson.M{"snid": args.Snid, "typeid": bson.M{"$in": args.TypeIds}}
|
||||
c := ItemLogsCollection(args.Platform)
|
||||
if c == nil {
|
||||
return
|
||||
var Logs []model.RetClawdollItemLog
|
||||
for _, typeId := range args.TypeIds {
|
||||
var SubLogs []model.RetClawdollItemLog
|
||||
sql = append(sql, bson.M{"snid": args.Snid, "typeid": typeId})
|
||||
|
||||
switch typeId {
|
||||
case common.GainWay_Shop_Buy: // 商城兑换
|
||||
sql = append(sql, bson.M{"itemid": common.ItemIDClawdoll})
|
||||
case common.GainWayItemShopChangeDoll: // 积分支出
|
||||
sql = append(sql, bson.M{"itemid": common.ItemDollCard})
|
||||
case common.GainWayItemFenGain: // 积分获取
|
||||
sql = append(sql, bson.M{"itemid": common.ItemDollCard})
|
||||
}
|
||||
|
||||
c := ItemLogsCollection(args.Platform)
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = c.Find(bson.M{"$and": sql}).Select(bson.M{"itemid": 1, "createts": 1, "typeid": 1, "count": 1, "logtype": 1}).All(&SubLogs)
|
||||
|
||||
Logs = append(Logs, SubLogs...)
|
||||
}
|
||||
|
||||
type RetClawdollItemLog struct {
|
||||
ItemId int32 //道具ID
|
||||
Time int64 //时间
|
||||
TypeId int32 //道具记录类型
|
||||
Num int64 //数量
|
||||
LogType int32 //记录类型 0.获取 1.消耗
|
||||
}
|
||||
|
||||
err = c.Find(cond).Limit(1000).Select(bson.M{"itemid": 1, "createts": 1, "typeid": 1, "count": 1, "logtype": 1}).All(&ret.Logs)
|
||||
ret.Logs = Logs
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -146,7 +156,7 @@ func (svc *ItemLogSvc) GetClawdollSuccessItemLog(args *model.ClawdollSuccessItem
|
|||
}
|
||||
|
||||
var datas []model.ItemLog
|
||||
err = c.Find(cond).Limit(1000).All(&datas)
|
||||
err = c.Find(cond).All(&datas)
|
||||
if err != nil {
|
||||
logger.Logger.Error("GetClawdollSuccessItemLog error: ", err)
|
||||
return err
|
||||
|
|
|
@ -1844,7 +1844,7 @@ func (this *Scene) RandInt(args ...int) int {
|
|||
|
||||
func (this *Scene) CheckNeedDestroy() bool {
|
||||
//if common.IsLocalGame(this.GameId) {
|
||||
return ServerStateMgr.GetState() == common.GAME_SESS_STATE_OFF || this.graceDestroy
|
||||
return ServerStateMgr.GetState() == common.GameSessStateOff || this.graceDestroy
|
||||
//} else {
|
||||
// return (ServerStateMgr.GetState() == common.GAME_SESS_STATE_OFF || this.graceDestroy) || (this.IsPrivateScene() && this.NumOfGames >= this.TotalOfGames)
|
||||
//}
|
||||
|
|
|
@ -1,25 +1,26 @@
|
|||
package base
|
||||
|
||||
import (
|
||||
"mongo.games.com/goserver/core/logger"
|
||||
"mongo.games.com/goserver/srvlib"
|
||||
|
||||
"mongo.games.com/game/common"
|
||||
"mongo.games.com/game/proto"
|
||||
"mongo.games.com/game/protocol/server"
|
||||
"mongo.games.com/goserver/core/mongo"
|
||||
"mongo.games.com/goserver/srvlib"
|
||||
)
|
||||
|
||||
func init() {
|
||||
common.RegisteServerCtrlCallback(func(code int32) {
|
||||
switch code {
|
||||
common.RegisterServerCtrlCallback(func(msg *server.ServerCtrl) {
|
||||
switch msg.GetCtrlCode() {
|
||||
case common.SrvCtrlStateSwitchCode:
|
||||
pack := &server.ServerStateSwitch{
|
||||
SrvType: proto.Int(common.GetSelfSrvType()),
|
||||
SrvId: proto.Int(common.GetSelfSrvId()),
|
||||
}
|
||||
proto.SetDefaults(pack)
|
||||
srvlib.ServerSessionMgrSington.Broadcast(int(server.SSPacketID_PACKET_GB_STATE_SWITCH), pack, common.GetSelfAreaId(), srvlib.WorldServerType)
|
||||
case common.SrvCtrlResetMgoSession:
|
||||
mongo.ResetAllSession()
|
||||
|
||||
default:
|
||||
logger.Logger.Errorf("unknow server ctrl code:%d", msg.GetCtrlCode())
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
)
|
||||
|
||||
var ServerStateMgr = &ServerStateManager{
|
||||
State: common.GAME_SESS_STATE_ON,
|
||||
State: common.GameSessStateOn,
|
||||
}
|
||||
|
||||
type ServerStateManager struct {
|
||||
|
@ -13,7 +13,7 @@ type ServerStateManager struct {
|
|||
}
|
||||
|
||||
func (this *ServerStateManager) Init() {
|
||||
this.State = common.GAME_SESS_STATE_ON
|
||||
this.State = common.GameSessStateOn
|
||||
}
|
||||
|
||||
func (this *ServerStateManager) SetState(state common.GameSessState) {
|
||||
|
|
|
@ -1968,7 +1968,7 @@ func (this *TienLenSceneData) TrySmallGameBilled() {
|
|||
score = losePlayerCoin
|
||||
}
|
||||
//判断宠物技能生不生效
|
||||
if losePlayer.PetUseSkill() {
|
||||
if losePlayer.PetUseSkill() && !this.IsCustom() && !this.IsMatchScene() {
|
||||
score = 0
|
||||
//通知客户端宠物技能生效 炸弹不扣分
|
||||
pack := &tienlen.SCTienLenPetSkillRes{}
|
||||
|
@ -1997,7 +1997,7 @@ func (this *TienLenSceneData) TrySmallGameBilled() {
|
|||
winPlayer.bombRankScore += rankScore * rule.RankBaseScore
|
||||
}
|
||||
//lose
|
||||
if this.IsMatchScene() && this.IsCustom() {
|
||||
if this.IsMatchScene() || this.IsCustom() {
|
||||
losePlayer.AddCoinNoLog(-score, 0)
|
||||
} else {
|
||||
losePlayer.AddCoin(-score, common.GainWay_CoinSceneLost, 0, "system", this.GetSceneName())
|
||||
|
|
|
@ -1,25 +1,26 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"mongo.games.com/goserver/core/logger"
|
||||
"mongo.games.com/goserver/srvlib"
|
||||
|
||||
"mongo.games.com/game/common"
|
||||
"mongo.games.com/game/proto"
|
||||
"mongo.games.com/game/protocol/server"
|
||||
"mongo.games.com/goserver/core/mongo"
|
||||
"mongo.games.com/goserver/srvlib"
|
||||
)
|
||||
|
||||
func init() {
|
||||
common.RegisteServerCtrlCallback(func(code int32) {
|
||||
switch code {
|
||||
common.RegisterServerCtrlCallback(func(msg *server.ServerCtrl) {
|
||||
switch msg.GetCtrlCode() {
|
||||
case common.SrvCtrlStateSwitchCode:
|
||||
pack := &server.ServerStateSwitch{
|
||||
SrvType: proto.Int(common.GetSelfSrvType()),
|
||||
SrvId: proto.Int(common.GetSelfSrvId()),
|
||||
}
|
||||
proto.SetDefaults(pack)
|
||||
srvlib.ServerSessionMgrSington.Broadcast(int(server.SSPacketID_PACKET_GB_STATE_SWITCH), pack, common.GetSelfAreaId(), srvlib.WorldServerType)
|
||||
case common.SrvCtrlResetMgoSession:
|
||||
mongo.ResetAllSession()
|
||||
|
||||
default:
|
||||
logger.Logger.Errorf("unknown server ctrl code:%d", msg.GetCtrlCode())
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -132,11 +132,19 @@ type ClawdollItemLogReq struct {
|
|||
TypeIds []int32
|
||||
}
|
||||
|
||||
type GetClawdollItemLogRet struct {
|
||||
Logs []ItemLog
|
||||
type RetClawdollItemLog struct {
|
||||
ItemId int32 //道具ID
|
||||
CreateTs int64 //记录时间
|
||||
TypeId int32 // 变化类型
|
||||
Count int64 //个数
|
||||
LogType int32 //记录类型 0.获取 1.消耗
|
||||
}
|
||||
|
||||
func GetClawdollItemLog(plt string, snid int32, typeIds []int32) (logs []ItemLog, err error) {
|
||||
type GetClawdollItemLogRet struct {
|
||||
Logs []RetClawdollItemLog
|
||||
}
|
||||
|
||||
func GetClawdollItemLog(plt string, snid int32, typeIds []int32) (logs []RetClawdollItemLog, err error) {
|
||||
|
||||
if rpcCli == nil {
|
||||
logger.Logger.Error("model.GetClawdollItemLog rpcCli == nil")
|
||||
|
|
|
@ -29,13 +29,6 @@ const (
|
|||
VER_PLAYER_MAX
|
||||
)
|
||||
|
||||
const (
|
||||
PLAYER_FLAGS_PRIVILEGE int64 = 1 << iota
|
||||
PLAYER_FLAGS_FIRSTGAME //首次游戏
|
||||
PLAYER_FLAGS_FIRSTBINDTEL //首次绑定账号
|
||||
PLAYER_FLAGS_CANREBATE //是否能够返利
|
||||
)
|
||||
|
||||
const (
|
||||
DEFAULT_PLAYER_SAFEBOX_PWD = "" //保险箱默认密码
|
||||
)
|
||||
|
@ -402,7 +395,7 @@ type PlayerData struct {
|
|||
InviterHead int32 //邀请人头像
|
||||
BeUnderAgentCode string //隶属经销商(推广人)
|
||||
SubBeUnderAgentCode string //经销商子id
|
||||
Flags int64 //标记
|
||||
Flags int //标记
|
||||
GameCoinTs int64 //游服金币对账时间戳
|
||||
Ver int32 //数据版本号
|
||||
CheckSum uint32 //校验码(预防暴库修改数据)
|
||||
|
@ -501,7 +494,7 @@ type PlayerData struct {
|
|||
DiamondLotteryScore int64 //钻石抽奖幸运值
|
||||
VCardCost int64 // 消耗v卡数量
|
||||
MoneyTotal int64 // 现金总充值金额,不包含api加币时的现金
|
||||
GuideStep int32 // 引导步骤;跳过引导后,该值会置为-1
|
||||
GuideStep int32 // tienlen游戏引导步骤;跳过引导后,该值会置为-1
|
||||
}
|
||||
|
||||
// 七日签到数据
|
||||
|
@ -802,15 +795,15 @@ func ConvertPlayerDataToWebData(param *WebPlayerDataParam) *webapi.PlayerData {
|
|||
return pdfw
|
||||
}
|
||||
func (this *PlayerData) IsMarkFlag(flag int) bool {
|
||||
return this.Flags&(1<<flag) != 0
|
||||
return this.Flags&flag != 0
|
||||
}
|
||||
|
||||
func (this *PlayerData) MarkFlag(flag int) {
|
||||
this.Flags |= (1 << flag)
|
||||
this.Flags |= flag
|
||||
}
|
||||
|
||||
func (this *PlayerData) UnmarkFlag(flag int) {
|
||||
this.Flags &= ^(1 << flag)
|
||||
this.Flags &= ^flag
|
||||
}
|
||||
|
||||
func (this *PlayerData) GetSnId() int32 {
|
||||
|
|
|
@ -10746,7 +10746,7 @@ type CSUpdateAttribute struct {
|
|||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Tp int32 `protobuf:"varint,1,opt,name=Tp,proto3" json:"Tp,omitempty"` // 1.更新新手引导阶段 2.跳过新手引导 3.更新新手引导状态(测试用)
|
||||
Tp int32 `protobuf:"varint,1,opt,name=Tp,proto3" json:"Tp,omitempty"` // 1.更新新手引导阶段 2.跳过新手引导 3.更新新手引导状态(测试用) 4.竞技馆引导结束
|
||||
Param []int64 `protobuf:"varint,2,rep,packed,name=Param,proto3" json:"Param,omitempty"`
|
||||
}
|
||||
|
||||
|
|
|
@ -1337,7 +1337,7 @@ message WindowsInfo{
|
|||
|
||||
//PACKET_CSUpdateAttribute
|
||||
message CSUpdateAttribute{
|
||||
int32 Tp = 1; // 1.更新新手引导阶段 2.跳过新手引导 3.更新新手引导状态(测试用)
|
||||
int32 Tp = 1; // 1.更新新手引导阶段 2.跳过新手引导 3.更新新手引导状态(测试用) 4.竞技馆引导结束
|
||||
repeated int64 Param = 2;
|
||||
}
|
||||
//PACKET_SCUpdateAttribute
|
||||
|
|
|
@ -139,7 +139,7 @@ func (this *CSLoginHandler) Process(s *netlib.Session, packetid int, data interf
|
|||
}
|
||||
|
||||
// 是否正在维护
|
||||
if model.GameParamData.SrvMaintain && SrvIsMaintaining {
|
||||
if model.GameParamData.SrvMaintain && common.SrvIsMaintaining {
|
||||
inWhiteList := false
|
||||
for i := 0; i < len(model.GMACData.WhiteList); i++ {
|
||||
if model.GMACData.WhiteList[i] == csl.GetUsername() {
|
||||
|
|
|
@ -3159,6 +3159,11 @@ func CSUpdateAttribute(s *netlib.Session, packetId int, data interface{}, sid in
|
|||
pack.OpRetCode = player_proto.OpResultCode_OPRC_Sucess
|
||||
send()
|
||||
return nil
|
||||
case common.AttributeGuideCustom:
|
||||
p.MarkFlag(common.PlayerFlagsGuideCustom)
|
||||
pack.OpRetCode = player_proto.OpResultCode_OPRC_Sucess
|
||||
send()
|
||||
return nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -3180,7 +3185,7 @@ func CSClawdollItemLog(s *netlib.Session, packetId int, data interface{}, sid in
|
|||
ret.TypeIds = append(ret.TypeIds, msg.TypeIds...)
|
||||
|
||||
var err error
|
||||
var ItemUseLogs []model.ItemLog
|
||||
var ItemUseLogs []model.RetClawdollItemLog
|
||||
|
||||
//娃娃机道具使用日志
|
||||
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
||||
|
|
|
@ -296,18 +296,18 @@ func init() {
|
|||
srvid := int(sr.GetSrvId())
|
||||
gameSess := GameSessMgrSington.GetGameSess(srvid)
|
||||
if gameSess != nil {
|
||||
if gameSess.state == common.GAME_SESS_STATE_ON {
|
||||
gameSess.SwitchState(common.GAME_SESS_STATE_OFF)
|
||||
if gameSess.state == common.GameSessStateOn {
|
||||
gameSess.SwitchState(common.GameSessStateOff)
|
||||
} else {
|
||||
gameSess.SwitchState(common.GAME_SESS_STATE_ON)
|
||||
gameSess.SwitchState(common.GameSessStateOn)
|
||||
}
|
||||
} else {
|
||||
gateSess := GameSessMgrSington.GetGateSess(srvid)
|
||||
if gateSess != nil {
|
||||
if gateSess.state == common.GAME_SESS_STATE_ON {
|
||||
gateSess.SwitchState(common.GAME_SESS_STATE_OFF)
|
||||
if gateSess.state == common.GameSessStateOn {
|
||||
gateSess.SwitchState(common.GameSessStateOff)
|
||||
} else {
|
||||
gateSess.SwitchState(common.GAME_SESS_STATE_ON)
|
||||
gateSess.SwitchState(common.GameSessStateOn)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -615,13 +615,7 @@ func (this *CSPMCmdHandler) Process(s *netlib.Session, packetid int, data interf
|
|||
}
|
||||
}
|
||||
case common.PMCmd_Privilege:
|
||||
if p.GMLevel >= 3 {
|
||||
if p.Flags&model.PLAYER_FLAGS_PRIVILEGE == 0 {
|
||||
p.Flags |= model.PLAYER_FLAGS_PRIVILEGE
|
||||
} else {
|
||||
p.Flags &= ^model.PLAYER_FLAGS_PRIVILEGE
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,13 +43,12 @@ type GameSession struct {
|
|||
gameIds []int32
|
||||
}
|
||||
|
||||
// 构造函数
|
||||
func NewGameSession(srvId, srvType int, s *netlib.Session) *GameSession {
|
||||
gs := &GameSession{
|
||||
Session: s,
|
||||
srvId: srvId,
|
||||
srvType: srvType,
|
||||
state: common.GAME_SESS_STATE_ON,
|
||||
state: common.GameSessStateOn,
|
||||
players: make(map[int32]*Player),
|
||||
scenes: make(map[int]*Scene),
|
||||
cps: make(map[string]*model.CoinPoolSetting),
|
||||
|
@ -57,13 +56,6 @@ func NewGameSession(srvId, srvType int, s *netlib.Session) *GameSession {
|
|||
return gs
|
||||
}
|
||||
|
||||
func (this *GameSession) RebindPlayerSnId(oldSnId, newSnId int32) {
|
||||
if p, exist := this.players[oldSnId]; exist {
|
||||
delete(this.players, oldSnId)
|
||||
this.players[newSnId] = p
|
||||
}
|
||||
}
|
||||
|
||||
func (this *GameSession) GetSrvId() int32 {
|
||||
if this.Session == nil {
|
||||
return 0
|
||||
|
@ -85,7 +77,6 @@ func (this *GameSession) CloseAllScene() {
|
|||
OpRetCode: gamehall_proto.OpResultCode_Game_OPRC_Sucess_Game,
|
||||
IsForce: proto.Int(1),
|
||||
}
|
||||
proto.SetDefaults(scDestroyRoom)
|
||||
scene.Broadcast(int(gamehall_proto.GameHallPacketID_PACKET_SC_DESTROYROOM), scDestroyRoom, 0)
|
||||
SceneMgrSingleton.DestroyScene(sceneId, true)
|
||||
}
|
||||
|
@ -105,11 +96,8 @@ func (this *GameSession) OnRegiste() {
|
|||
|
||||
// 注销事件
|
||||
func (this *GameSession) OnUnregiste() {
|
||||
//销毁比赛
|
||||
//MatchMgrSington.DestroyAllMatchByGameSession(this)
|
||||
//解散房间
|
||||
this.CloseAllScene()
|
||||
|
||||
GameSessionListenerSet.Range(func(key, val interface{}) bool {
|
||||
if lis, ok := val.(GameSessionListener); ok {
|
||||
lis.OnGameSessionUnregiste(this)
|
||||
|
@ -130,12 +118,13 @@ func (this *GameSession) SwitchState(state common.GameSessState) {
|
|||
}
|
||||
this.state = state
|
||||
switch state {
|
||||
case common.GAME_SESS_STATE_ON:
|
||||
case common.GameSessStateOn:
|
||||
this.OnStateOn()
|
||||
case common.GAME_SESS_STATE_OFF:
|
||||
case common.GameSessStateOff:
|
||||
this.OnStateOff()
|
||||
}
|
||||
}
|
||||
|
||||
func (this *GameSession) OnStateOn() {
|
||||
pack := &server_proto.ServerState{
|
||||
SrvState: proto.Int(int(this.state)),
|
||||
|
@ -143,6 +132,7 @@ func (this *GameSession) OnStateOn() {
|
|||
proto.SetDefaults(pack)
|
||||
this.Send(int(server_proto.SSPacketID_PACKET_WG_SERVER_STATE), pack)
|
||||
}
|
||||
|
||||
func (this *GameSession) OnStateOff() {
|
||||
pack := &server_proto.ServerState{
|
||||
SrvState: proto.Int(int(this.state)),
|
||||
|
|
|
@ -2,21 +2,18 @@ package main
|
|||
|
||||
import (
|
||||
"math"
|
||||
"mongo.games.com/game/protocol/webapi"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"mongo.games.com/game/common"
|
||||
"mongo.games.com/goserver/core/logger"
|
||||
"mongo.games.com/goserver/core/netlib"
|
||||
"mongo.games.com/goserver/srvlib"
|
||||
"mongo.games.com/goserver/srvlib/protocol"
|
||||
)
|
||||
|
||||
//const (
|
||||
// ReplayServerType int = 8
|
||||
// ReplayServerId = 801
|
||||
//)
|
||||
"mongo.games.com/game/common"
|
||||
"mongo.games.com/game/model"
|
||||
"mongo.games.com/game/protocol/webapi"
|
||||
)
|
||||
|
||||
var GameSessMgrSington = &GameSessMgr{
|
||||
servers: make(map[int]*GameSession),
|
||||
|
@ -25,9 +22,9 @@ var GameSessMgrSington = &GameSessMgr{
|
|||
}
|
||||
|
||||
type GameSessMgr struct {
|
||||
servers map[int]*GameSession
|
||||
gamesrvs map[int][]*GameSession
|
||||
gates map[int]*GameSession
|
||||
servers map[int]*GameSession // 游戏服务id
|
||||
gamesrvs map[int][]*GameSession // 游戏id
|
||||
gates map[int]*GameSession // 网关id
|
||||
}
|
||||
|
||||
// 注册事件
|
||||
|
@ -134,6 +131,7 @@ func (this *GameSessMgr) OnUnregiste(s *netlib.Session) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (this *GameSessMgr) GetGameServerSess(gameid int) []*GameSession {
|
||||
return this.gamesrvs[gameid]
|
||||
}
|
||||
|
@ -146,7 +144,7 @@ func (this *GameSessMgr) GetMinLoadSess(gameid int) *GameSession {
|
|||
if gss, exist := this.gamesrvs[gameid]; exist {
|
||||
if gss != nil {
|
||||
for _, s := range gss {
|
||||
if s.state == common.GAME_SESS_STATE_ON {
|
||||
if s.state == common.GameSessStateOn {
|
||||
loadFactor = s.GetLoadFactor()
|
||||
if minLoad > loadFactor {
|
||||
minLoad = loadFactor
|
||||
|
@ -162,7 +160,7 @@ func (this *GameSessMgr) GetMinLoadSess(gameid int) *GameSession {
|
|||
if gss, exist := this.gamesrvs[0]; exist {
|
||||
if gss != nil {
|
||||
for _, s := range gss {
|
||||
if s.state == common.GAME_SESS_STATE_ON {
|
||||
if s.state == common.GameSessStateOn {
|
||||
loadFactor = s.GetLoadFactor()
|
||||
if minLoad > loadFactor {
|
||||
minLoad = loadFactor
|
||||
|
@ -184,6 +182,7 @@ func (this *GameSessMgr) GetGameSess(srvId int) *GameSession {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *GameSessMgr) GetAllGameSess() []*GameSession {
|
||||
servers := make([]*GameSession, 0)
|
||||
for _, v := range this.servers {
|
||||
|
@ -191,17 +190,13 @@ func (this *GameSessMgr) GetAllGameSess() []*GameSession {
|
|||
}
|
||||
return servers
|
||||
}
|
||||
|
||||
func (this *GameSessMgr) GetGateSess(srvId int) *GameSession {
|
||||
if gs, exist := this.gates[srvId]; exist {
|
||||
return gs
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *GameSessMgr) RebindPlayerSnId(oldSnId, newSnId int32) {
|
||||
for _, gs := range this.servers {
|
||||
gs.RebindPlayerSnId(oldSnId, newSnId)
|
||||
}
|
||||
}
|
||||
|
||||
func (this *GameSessMgr) ListServerState(srvId, srvType int) []*webapi.ServerInfo {
|
||||
_createGateServerInfo := func(srvId, srvType int, s *GameSession) *webapi.ServerInfo {
|
||||
|
@ -299,15 +294,17 @@ func (this *GameSessMgr) ListServerState(srvId, srvType int) []*webapi.ServerInf
|
|||
myInfo := &webapi.ServerInfo{
|
||||
SrvId: int32(common.GetSelfSrvId()),
|
||||
SrvType: int32(common.GetSelfSrvType()),
|
||||
State: int32(common.GAME_SESS_STATE_ON),
|
||||
State: int32(common.GameSessStateOn),
|
||||
PlayerNum: int32(len(PlayerMgrSington.players)),
|
||||
RobotNum: int32(len(PlayerMgrSington.snidMap) - len(PlayerMgrSington.players)),
|
||||
SceneNum: int32(len(SceneMgrSingleton.scenes)),
|
||||
}
|
||||
if SrvIsMaintaining {
|
||||
myInfo.State = int32(common.GAME_SESS_STATE_ON)
|
||||
} else {
|
||||
myInfo.State = int32(common.GAME_SESS_STATE_OFF)
|
||||
if model.GameParamData.SrvMaintain {
|
||||
if !common.SrvIsMaintaining {
|
||||
myInfo.State = int32(common.GameSessStateOn)
|
||||
} else {
|
||||
myInfo.State = int32(common.GameSessStateOff)
|
||||
}
|
||||
}
|
||||
//把自己加进去
|
||||
datas = append(datas, myInfo)
|
||||
|
|
|
@ -3161,25 +3161,6 @@ func (this *Player) AddCoinPayTotal(coin int64) {
|
|||
this.CoinPayTotal += coin
|
||||
}
|
||||
|
||||
// 当用户充值
|
||||
func OnPlayerPay(pd *model.PlayerData, coin int64) {
|
||||
if pd == nil {
|
||||
return
|
||||
}
|
||||
|
||||
buf, err := pd.GetPlayerDataEncoder()
|
||||
if err == nil {
|
||||
pack := &serverproto.WTPlayerPay{
|
||||
AddCoin: proto.Int64(coin),
|
||||
PlayerData: buf.Bytes(),
|
||||
}
|
||||
proto.SetDefaults(pack)
|
||||
common.SendToActThrSrv(int(serverproto.SSPacketID_PACKET_WT_PLAYERPAY), pack)
|
||||
}
|
||||
|
||||
//ActFPayMgrSington.OnPlayerPay(pd.SnId, pd.Platform, coin)
|
||||
}
|
||||
|
||||
func (this *Player) SendPlatformCanUsePromoterBind() {
|
||||
state := int32(0)
|
||||
plt := PlatformMgrSingleton.GetPlatform(this.Platform)
|
||||
|
|
|
@ -1,19 +1,23 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"mongo.games.com/goserver/core/logger"
|
||||
|
||||
"mongo.games.com/game/common"
|
||||
"mongo.games.com/goserver/core/mongo"
|
||||
"mongo.games.com/game/model"
|
||||
"mongo.games.com/game/protocol/server"
|
||||
)
|
||||
|
||||
var SrvIsMaintaining = true
|
||||
|
||||
func init() {
|
||||
common.RegisteServerCtrlCallback(func(code int32) {
|
||||
switch code {
|
||||
common.RegisterServerCtrlCallback(func(msg *server.ServerCtrl) {
|
||||
switch msg.GetCtrlCode() {
|
||||
case common.SrvCtrlStateSwitchCode:
|
||||
SrvIsMaintaining = !SrvIsMaintaining
|
||||
case common.SrvCtrlResetMgoSession:
|
||||
mongo.ResetAllSession()
|
||||
if model.GameParamData.SrvMaintain {
|
||||
common.SrvIsMaintaining = !common.SrvIsMaintaining
|
||||
}
|
||||
|
||||
default:
|
||||
logger.Logger.Errorf("unknown server ctrl code:%d", msg.GetCtrlCode())
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue