Compare commits
2 Commits
e318c85c26
...
a7a25ef028
Author | SHA1 | Date |
---|---|---|
|
a7a25ef028 | |
|
7b05295d67 |
|
@ -2,7 +2,6 @@ package svc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"github.com/globalsign/mgo"
|
|
||||||
"github.com/globalsign/mgo/bson"
|
"github.com/globalsign/mgo/bson"
|
||||||
"mongo.games.com/game/dbproxy/mongo"
|
"mongo.games.com/game/dbproxy/mongo"
|
||||||
"mongo.games.com/game/model"
|
"mongo.games.com/game/model"
|
||||||
|
@ -25,67 +24,33 @@ func AwardLogCollection(plt string) *mongo.Collection {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func InsertAwardLog(logs ...*model.AwardLog) (err error) {
|
func FetchAwardLog(plt string) (recs model.AwardLog, err error) {
|
||||||
clog := AwardLogCollection(logs[0].Platform)
|
err = AwardLogCollection(plt).Find(bson.M{}).One(&recs)
|
||||||
if clog == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
switch len(logs) {
|
|
||||||
case 0:
|
|
||||||
return errors.New("no data")
|
|
||||||
case 1:
|
|
||||||
err = clog.Insert(logs[0])
|
|
||||||
if err != nil {
|
|
||||||
logger.Logger.Info("svc.UpdateAllPlayerPackageTag error ", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
docs := make([]interface{}, 0, len(logs))
|
|
||||||
for _, log := range logs {
|
|
||||||
docs = append(docs, log)
|
|
||||||
}
|
|
||||||
err = clog.Insert(docs...)
|
|
||||||
}
|
|
||||||
if err != nil {
|
|
||||||
logger.Logger.Warn("InsertAwardLog error:", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func FetchAwardLog(plt string) (recs []model.AwardLog, err error) {
|
|
||||||
err = AwardLogCollection(plt).Find(bson.M{}).All(&recs)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
type AwardLogSvc struct {
|
type AwardLogSvc struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (svc *AwardLogSvc) InsertAwardLog(args []*model.AwardLog, ret *bool) (err error) {
|
func (svc *AwardLogSvc) FetchAwardLog(args *model.FetchAwardLogArgs, ret *model.AwardLog) (err error) {
|
||||||
err = InsertAwardLog(args...)
|
|
||||||
if err == nil {
|
|
||||||
*ret = true
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (svc *AwardLogSvc) FetchAwardLog(args *model.FetchAwardLogArgs, ret *[]model.AwardLog) (err error) {
|
|
||||||
*ret, err = FetchAwardLog(args.Plt)
|
*ret, err = FetchAwardLog(args.Plt)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (svc *AwardLogSvc) UpsertAwardLog(args *model.FetchAwardLogArgs, ret *model.AwardLog) error {
|
func (svc *AwardLogSvc) UpsertAwardLog(args *model.FetchAwardLogArgs, ret *model.AwardLog) error {
|
||||||
cc := AwardLogCollection(args.Plt)
|
cc := AwardLogCollection(args.Plt)
|
||||||
if cc == nil {
|
if cc == nil {
|
||||||
return ChatColError
|
return AwardLogDBErr
|
||||||
}
|
}
|
||||||
_, err := cc.Upsert(bson.M{"platform": args.Plt}, args.Data)
|
_, err := cc.Upsert(bson.M{}, args.Data)
|
||||||
if err != nil && err != mgo.ErrNotFound {
|
if err != nil {
|
||||||
logger.Logger.Error("UpsertChat is err: ", err)
|
logger.Logger.Error("UpsertAwardLog is err: ", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
ret = args.Data
|
ret = args.Data
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
rpc.Register(new(AwardLogSvc))
|
rpc.Register(new(AwardLogSvc))
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,8 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type AwardLog struct {
|
type AwardLog struct {
|
||||||
Platform string
|
AwardMap map[int32]int64 //key1:1话费 2实物 key2 itemId value:数量
|
||||||
AwardMap map[int32]map[int32]int32 //key1:1话费 2实物 key2 itemId value:数量
|
Ts int64
|
||||||
Ts time.Time
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -18,14 +17,6 @@ var (
|
||||||
AwardLogCollName = "log_award"
|
AwardLogCollName = "log_award"
|
||||||
)
|
)
|
||||||
|
|
||||||
func InsertAwardLog(logs ...*AwardLog) (err error) {
|
|
||||||
if rpcCli == nil {
|
|
||||||
return ErrRPClientNoConn
|
|
||||||
}
|
|
||||||
var ret bool
|
|
||||||
return rpcCli.CallWithTimeout("AwardLogSvc.InsertAwardLog", logs, &ret, time.Second*30)
|
|
||||||
}
|
|
||||||
|
|
||||||
type FetchAwardLogArgs struct {
|
type FetchAwardLogArgs struct {
|
||||||
Plt string
|
Plt string
|
||||||
Data *AwardLog
|
Data *AwardLog
|
||||||
|
@ -34,9 +25,9 @@ type AwardLogRes struct {
|
||||||
Data *AwardLog
|
Data *AwardLog
|
||||||
}
|
}
|
||||||
|
|
||||||
func FetchAwardLog(plt string) (recs []AwardLog, err error) {
|
func FetchAwardLog(plt string) (recs AwardLog, err error) {
|
||||||
if rpcCli == nil {
|
if rpcCli == nil {
|
||||||
return nil, ErrRPClientNoConn
|
return recs, ErrRPClientNoConn
|
||||||
}
|
}
|
||||||
args := &FetchAwardLogArgs{
|
args := &FetchAwardLogArgs{
|
||||||
Plt: plt,
|
Plt: plt,
|
||||||
|
@ -47,7 +38,7 @@ func FetchAwardLog(plt string) (recs []AwardLog, err error) {
|
||||||
|
|
||||||
func UpsertAwardLog(platform string, data *AwardLog) {
|
func UpsertAwardLog(platform string, data *AwardLog) {
|
||||||
if rpcCli == nil {
|
if rpcCli == nil {
|
||||||
logger.Logger.Error("model.UpsertApplyList rpcCli == nil")
|
logger.Logger.Error("model.UpsertAwardLog rpcCli == nil")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"mongo.games.com/game/common"
|
"mongo.games.com/game/common"
|
||||||
"mongo.games.com/game/protocol/shop"
|
"mongo.games.com/game/protocol/shop"
|
||||||
"mongo.games.com/game/protocol/webapi"
|
"mongo.games.com/game/protocol/webapi"
|
||||||
|
"strconv"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -134,6 +134,8 @@ type AllConfig struct {
|
||||||
*webapi.RankTypeConfig
|
*webapi.RankTypeConfig
|
||||||
//获奖记录配置
|
//获奖记录配置
|
||||||
*webapi.AwardLogConfig
|
*webapi.AwardLogConfig
|
||||||
|
// 获得道具总数
|
||||||
|
AwardItem AwardLog
|
||||||
}
|
}
|
||||||
|
|
||||||
type GlobalConfig struct {
|
type GlobalConfig struct {
|
||||||
|
@ -355,3 +357,12 @@ func (cm *ConfigMgr) GetSkinSkillMaxLevel(plt string, skinId int32) int32 {
|
||||||
}
|
}
|
||||||
return level
|
return level
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (cm *ConfigMgr) AddAwardItem(plt string, id int32, num int64) {
|
||||||
|
cfg := cm.GetConfig(plt).AwardItem
|
||||||
|
if cfg.AwardMap == nil {
|
||||||
|
cfg.AwardMap = make(map[int32]int64)
|
||||||
|
}
|
||||||
|
cfg.AwardMap[id] += num
|
||||||
|
cfg.Ts = time.Now().Unix()
|
||||||
|
}
|
||||||
|
|
2
public
2
public
|
@ -1 +1 @@
|
||||||
Subproject commit d789cca81a36ddbaf30e5414b6c4fe530e0631f6
|
Subproject commit 06d6be8fa6d928f7eb30a4c567abfc43e571cbc4
|
|
@ -2900,9 +2900,9 @@ func CSAwardLog(s *netlib.Session, packetId int, data interface{}, sid int64) er
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
awardLogConfig := PlatformMgrSingleton.GetConfig("1").AwardLogConfig
|
awardLogConfig := PlatformMgrSingleton.GetConfig(p.Platform).AwardLogConfig
|
||||||
|
|
||||||
AwardLog := AwardLogMgr.GetAwardLog(msg.TypeId)
|
AwardLog := AwardLogMgr.GetAwardLog(p.Platform, msg.TypeId)
|
||||||
ret := &player_proto.SCAwardLog{}
|
ret := &player_proto.SCAwardLog{}
|
||||||
awardData := &player_proto.AwardLogData{}
|
awardData := &player_proto.AwardLogData{}
|
||||||
ret.TypeId = msg.TypeId
|
ret.TypeId = msg.TypeId
|
||||||
|
@ -2943,7 +2943,7 @@ func CSAwardLog(s *netlib.Session, packetId int, data interface{}, sid int64) er
|
||||||
}
|
}
|
||||||
ret.AwardLog = awardData
|
ret.AwardLog = awardData
|
||||||
//实时播报数据
|
//实时播报数据
|
||||||
AnnouncerLog := AwardLogMgr.GetAnnouncerLog(msg.TypeId)
|
AnnouncerLog := AwardLogMgr.GetAnnouncerLog(p.Platform, msg.TypeId)
|
||||||
for _, logInfo := range AnnouncerLog {
|
for _, logInfo := range AnnouncerLog {
|
||||||
infoData := &player_proto.AnnouncerLogInfo{}
|
infoData := &player_proto.AnnouncerLogInfo{}
|
||||||
//infoData.Snid = logInfo.Snid
|
//infoData.Snid = logInfo.Snid
|
||||||
|
|
|
@ -1,88 +1,123 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"mongo.games.com/game/model"
|
|
||||||
"mongo.games.com/goserver/core/basic"
|
|
||||||
"mongo.games.com/goserver/core/logger"
|
|
||||||
"mongo.games.com/goserver/core/task"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"mongo.games.com/game/common"
|
||||||
|
"mongo.games.com/game/model"
|
||||||
|
"mongo.games.com/game/srvdata"
|
||||||
|
"mongo.games.com/goserver/core/basic"
|
||||||
|
"mongo.games.com/goserver/core/logger"
|
||||||
"mongo.games.com/goserver/core/module"
|
"mongo.games.com/goserver/core/module"
|
||||||
|
"mongo.games.com/goserver/core/task"
|
||||||
)
|
)
|
||||||
|
|
||||||
type AwardLogManager struct {
|
type AwardLogManager struct {
|
||||||
BaseClockSinker
|
BaseClockSinker
|
||||||
AwardMap map[int32]map[int32]int32 //key1:1话费 2实物 key2 itemId value:数量
|
AnnouncerLog map[string]map[int32][]model.AnnouncerLog //key:1话费 2实物
|
||||||
AnnouncerLog map[int32][]model.AnnouncerLog //key:1话费 2实物
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var AwardLogMgr = &AwardLogManager{}
|
var AwardLogMgr = &AwardLogManager{
|
||||||
|
AnnouncerLog: make(map[string]map[int32][]model.AnnouncerLog),
|
||||||
|
}
|
||||||
|
|
||||||
func (this *AwardLogManager) ModuleName() string {
|
func (this *AwardLogManager) ModuleName() string {
|
||||||
return "AwardLogManager"
|
return "AwardLogManager"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *AwardLogManager) GetAwardLog(typeId int32) map[int32]int32 {
|
// GetAwardLog 获取总数量
|
||||||
return this.AwardMap[typeId]
|
// typeId 1 话费 2实物
|
||||||
|
func (this *AwardLogManager) GetAwardLog(plt string, typeId int32) map[int32]int64 {
|
||||||
|
d := PlatformMgrSingleton.GetConfig(plt).AwardItem
|
||||||
|
ret := make(map[int32]int64)
|
||||||
|
// 1 话费 2实物
|
||||||
|
switch typeId {
|
||||||
|
case 1:
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
for _, v := range srvdata.GameItemMgr.GetArr(plt) {
|
||||||
|
if v.GetType() == common.ItemTypeObjective {
|
||||||
|
if d.AwardMap[v.GetId()] > 0 {
|
||||||
|
ret[v.GetId()] += d.AwardMap[v.GetId()]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *AwardLogManager) GetAnnouncerLog(typeId int32) []model.AnnouncerLog {
|
func (this *AwardLogManager) GetAnnouncerLog(plt string, typeId int32) []model.AnnouncerLog {
|
||||||
log := this.AnnouncerLog[typeId]
|
data := this.AnnouncerLog[plt]
|
||||||
|
if data == nil {
|
||||||
|
data = make(map[int32][]model.AnnouncerLog)
|
||||||
|
this.AnnouncerLog[plt] = data
|
||||||
|
}
|
||||||
|
log := data[typeId]
|
||||||
if len(log) > 100 {
|
if len(log) > 100 {
|
||||||
return log[len(log)-100:]
|
return log[len(log)-100:]
|
||||||
}
|
}
|
||||||
return this.AnnouncerLog[typeId]
|
return log
|
||||||
}
|
}
|
||||||
|
|
||||||
// 已兑换数据
|
// 已兑换数据
|
||||||
func (this *AwardLogManager) UpdateAwardLog(itemId, num, itemType int32) {
|
func (this *AwardLogManager) UpdateAwardLog(plt string, itemId int32, num int64) {
|
||||||
typeID := int32(1)
|
PlatformMgrSingleton.AddAwardItem(plt, itemId, num)
|
||||||
if itemType == 16 {
|
|
||||||
typeID = 2
|
|
||||||
}
|
|
||||||
if this.AwardMap == nil {
|
|
||||||
this.AwardMap = make(map[int32]map[int32]int32)
|
|
||||||
}
|
|
||||||
if this.AwardMap[typeID] == nil {
|
|
||||||
this.AwardMap[typeID] = make(map[int32]int32)
|
|
||||||
}
|
|
||||||
|
|
||||||
this.AwardMap[typeID][itemId] += num
|
|
||||||
logger.Logger.Trace("更新已兑换数据数据 this.AwardMap = ", this.AwardMap)
|
|
||||||
this.Save()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 实时播报数据
|
// 实时播报数据
|
||||||
func (this *AwardLogManager) UpdateAnnouncerLog(data model.AnnouncerLog) {
|
func (this *AwardLogManager) UpdateAnnouncerLog(data model.AnnouncerLog) {
|
||||||
if this.AnnouncerLog == nil {
|
|
||||||
this.AnnouncerLog = make(map[int32][]model.AnnouncerLog)
|
|
||||||
}
|
|
||||||
this.AnnouncerLog[data.TypeId] = append(this.AnnouncerLog[data.TypeId], data)
|
|
||||||
logger.Logger.Trace("更新实时播报数据 this.AnnouncerLog = ", this.AnnouncerLog)
|
|
||||||
data.Ts = time.Now()
|
data.Ts = time.Now()
|
||||||
|
if this.AnnouncerLog == nil {
|
||||||
|
this.AnnouncerLog = make(map[string]map[int32][]model.AnnouncerLog)
|
||||||
|
}
|
||||||
|
if this.AnnouncerLog[data.Platform] == nil {
|
||||||
|
this.AnnouncerLog[data.Platform] = make(map[int32][]model.AnnouncerLog)
|
||||||
|
}
|
||||||
|
this.AnnouncerLog[data.Platform][data.TypeId] = append(this.AnnouncerLog[data.Platform][data.TypeId], data)
|
||||||
|
if len(this.AnnouncerLog[data.Platform][data.TypeId]) > 100 {
|
||||||
|
this.AnnouncerLog[data.Platform][data.TypeId] = this.AnnouncerLog[data.Platform][data.TypeId][len(this.AnnouncerLog[data.Platform][data.TypeId])-100:]
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.Logger.Trace("更新实时播报数据 this.AnnouncerLog = ", this.AnnouncerLog)
|
||||||
|
|
||||||
|
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
||||||
err := model.InsertAnnouncerLog(&data)
|
err := model.InsertAnnouncerLog(&data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Logger.Error("UpdateAnnouncerLog InsertAnnouncerLog err :", err)
|
logger.Logger.Error("UpdateAnnouncerLog InsertAnnouncerLog err :", err)
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
|
}), task.CompleteNotifyWrapper(func(i interface{}, t task.Task) {
|
||||||
|
}), "save_announcer").Start()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *AwardLogManager) Init() {
|
func (this *AwardLogManager) Init() {
|
||||||
//初始化数据
|
for _, v := range PlatformMgrSingleton.platforms {
|
||||||
this.AwardMap = make(map[int32]map[int32]int32)
|
if v != nil {
|
||||||
this.AnnouncerLog = make(map[int32][]model.AnnouncerLog)
|
// 获取道具获得总数
|
||||||
AwardMap, err := model.FetchAwardLog("1")
|
res, err := model.FetchAwardLog(v.IdStr)
|
||||||
if err == nil {
|
if err != nil {
|
||||||
for _, log := range AwardMap {
|
logger.Logger.Errorf("fetch award log error: %v", err)
|
||||||
this.AwardMap = log.AwardMap
|
} else {
|
||||||
|
PlatformMgrSingleton.GetConfig(v.IdStr).AwardItem = res
|
||||||
|
}
|
||||||
|
// 获取实时播报数据
|
||||||
|
arr, err := model.FetchAnnouncerLog(v.IdStr)
|
||||||
|
if err != nil {
|
||||||
|
logger.Logger.Errorf("fetch announcer log error: %v", err)
|
||||||
|
} else {
|
||||||
|
for _, v := range arr {
|
||||||
|
if this.AnnouncerLog[v.Platform] == nil {
|
||||||
|
this.AnnouncerLog[v.Platform] = make(map[int32][]model.AnnouncerLog)
|
||||||
|
}
|
||||||
|
if this.AnnouncerLog[v.Platform][v.TypeId] == nil {
|
||||||
|
this.AnnouncerLog[v.Platform][v.TypeId] = make([]model.AnnouncerLog, 0)
|
||||||
|
}
|
||||||
|
this.AnnouncerLog[v.Platform][v.TypeId] = append(this.AnnouncerLog[v.Platform][v.TypeId], v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AnnouncerLog, err := model.FetchAnnouncerLog("1")
|
|
||||||
if err == nil {
|
|
||||||
for _, log := range AnnouncerLog {
|
|
||||||
this.AnnouncerLog[log.TypeId] = append(this.AnnouncerLog[log.TypeId], log)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logger.Logger.Tracef("AwardLog初始化数据 this.AwardMap = %v,this.AnnouncerLog = %v", this.AwardMap, this.AnnouncerLog)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *AwardLogManager) Update() {
|
func (this *AwardLogManager) Update() {
|
||||||
|
@ -94,25 +129,21 @@ func (this *AwardLogManager) Shutdown() {
|
||||||
|
|
||||||
func (this *AwardLogManager) OnHourTimer() {
|
func (this *AwardLogManager) OnHourTimer() {
|
||||||
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
||||||
awardData := &model.AwardLog{}
|
this.Save()
|
||||||
awardData.Platform = "1"
|
|
||||||
awardData.AwardMap = this.AwardMap
|
|
||||||
awardData.Ts = time.Now()
|
|
||||||
model.UpsertAwardLog("1", awardData)
|
|
||||||
return nil
|
return nil
|
||||||
}), task.CompleteNotifyWrapper(func(data interface{}, tt task.Task) {
|
}), task.CompleteNotifyWrapper(func(i interface{}, t task.Task) {
|
||||||
})).StartByFixExecutor("AwardLogTask")
|
}), "save_awarditem").Start()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *AwardLogManager) Save() {
|
func (this *AwardLogManager) Save() {
|
||||||
awardData := &model.AwardLog{}
|
for _, v := range PlatformMgrSingleton.platforms {
|
||||||
awardData.Platform = "1"
|
if v != nil {
|
||||||
awardData.AwardMap = this.AwardMap
|
model.UpsertAwardLog(v.IdStr, &PlatformMgrSingleton.GetConfig(v.IdStr).AwardItem)
|
||||||
awardData.Ts = time.Now()
|
}
|
||||||
model.UpsertAwardLog("1", awardData)
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
module.RegisteModule(AwardLogMgr, time.Minute*3, 0)
|
module.RegisteModule(AwardLogMgr, time.Hour, 0)
|
||||||
ClockMgrSington.RegisteSinker(AwardLogMgr)
|
ClockMgrSington.RegisteSinker(AwardLogMgr)
|
||||||
}
|
}
|
||||||
|
|
|
@ -327,6 +327,30 @@ func (this *BagMgr) AddItems(p *Player, addItems []*Item, add int64, gainWay int
|
||||||
LogChannelSingleton.WriteLog(log)
|
LogChannelSingleton.WriteLog(log)
|
||||||
logId = log.LogId.Hex()
|
logId = log.LogId.Hex()
|
||||||
}
|
}
|
||||||
|
//获奖记录log
|
||||||
|
if logType == ItemObtain && v.ItemNum > 0 {
|
||||||
|
AwardLogMgr.UpdateAwardLog(p.Platform, item.Id, v.ItemNum)
|
||||||
|
|
||||||
|
awardLogType := 0
|
||||||
|
if item.Type == common.ItemTypeChange {
|
||||||
|
//话费
|
||||||
|
awardLogType = 1
|
||||||
|
} else if item.Type == common.ItemTypeObjective {
|
||||||
|
//实物
|
||||||
|
awardLogType = 2
|
||||||
|
}
|
||||||
|
if awardLogType != 0 {
|
||||||
|
data := model.AnnouncerLog{
|
||||||
|
Platform: p.Platform,
|
||||||
|
Snid: p.SnId,
|
||||||
|
Name: p.Name,
|
||||||
|
Phone: p.Tel,
|
||||||
|
ItemId: item.Id, //获得物品ID
|
||||||
|
TypeId: int32(awardLogType),
|
||||||
|
}
|
||||||
|
AwardLogMgr.UpdateAnnouncerLog(data)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if v.ItemId == common.ItemIDWeekScore && v.ItemNum > 0 {
|
if v.ItemId == common.ItemIDWeekScore && v.ItemNum > 0 {
|
||||||
|
@ -358,28 +382,6 @@ func (this *BagMgr) AddItems(p *Player, addItems []*Item, add int64, gainWay int
|
||||||
if v.ItemId == common.ItemIDLong && v.ItemNum > 0 {
|
if v.ItemId == common.ItemIDLong && v.ItemNum > 0 {
|
||||||
long += v.ItemNum
|
long += v.ItemNum
|
||||||
}
|
}
|
||||||
//获奖记录log
|
|
||||||
if v.ItemNum > 0 && (item.Type == common.ItemTypeChange || item.Type == common.ItemTypeObjective) {
|
|
||||||
awardLogType := 1
|
|
||||||
if item.Type == common.ItemTypeChange {
|
|
||||||
//话费
|
|
||||||
awardLogType = 1
|
|
||||||
} else if item.Type == common.ItemTypeObjective {
|
|
||||||
//实物
|
|
||||||
awardLogType = 2
|
|
||||||
//实物进背包就算已兑换
|
|
||||||
AwardLogMgr.UpdateAwardLog(item.Id, int32(v.ItemNum), item.Type)
|
|
||||||
}
|
|
||||||
data := model.AnnouncerLog{
|
|
||||||
Platform: p.Platform,
|
|
||||||
Snid: p.SnId,
|
|
||||||
Name: p.Name,
|
|
||||||
Phone: p.Tel,
|
|
||||||
ItemId: item.Id, //获得物品ID
|
|
||||||
TypeId: int32(awardLogType),
|
|
||||||
}
|
|
||||||
AwardLogMgr.UpdateAnnouncerLog(data)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(changeItems) > 0 {
|
if len(changeItems) > 0 {
|
||||||
|
@ -498,17 +500,18 @@ func (this *BagMgr) AddItemsOffline(platform string, snid int32, addItems []*Ite
|
||||||
}
|
}
|
||||||
|
|
||||||
//获奖记录log
|
//获奖记录log
|
||||||
if v.ItemNum > 0 && (itemData.Type == common.ItemTypeChange || itemData.Type == common.ItemTypeObjective) {
|
if logType == ItemObtain && v.ItemNum > 0 {
|
||||||
awardLogType := 1
|
AwardLogMgr.UpdateAwardLog(findPlayer.Platform, itemData.Id, v.ItemNum)
|
||||||
|
|
||||||
|
awardLogType := 0
|
||||||
if itemData.Type == common.ItemTypeChange {
|
if itemData.Type == common.ItemTypeChange {
|
||||||
//话费
|
//话费
|
||||||
awardLogType = 1
|
awardLogType = 1
|
||||||
} else if itemData.Type == common.ItemTypeObjective {
|
} else if itemData.Type == common.ItemTypeObjective {
|
||||||
//实物
|
//实物
|
||||||
awardLogType = 2
|
awardLogType = 2
|
||||||
//实物进背包就算已兑换
|
|
||||||
AwardLogMgr.UpdateAwardLog(itemData.Id, int32(v.ItemNum), itemData.Type)
|
|
||||||
}
|
}
|
||||||
|
if awardLogType > 0 {
|
||||||
logData := model.AnnouncerLog{
|
logData := model.AnnouncerLog{
|
||||||
Platform: findPlayer.Platform,
|
Platform: findPlayer.Platform,
|
||||||
Snid: findPlayer.SnId,
|
Snid: findPlayer.SnId,
|
||||||
|
@ -520,6 +523,7 @@ func (this *BagMgr) AddItemsOffline(platform string, snid int32, addItems []*Ite
|
||||||
AwardLogMgr.UpdateAnnouncerLog(logData)
|
AwardLogMgr.UpdateAnnouncerLog(logData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
callback(errors.New("AddItemsOffline failed"))
|
callback(errors.New("AddItemsOffline failed"))
|
||||||
}
|
}
|
||||||
|
@ -757,8 +761,8 @@ func (this *BagMgr) ItemExchangeCard(p *Player, itemId int32, money, cardType in
|
||||||
if p != nil {
|
if p != nil {
|
||||||
p.AddMessage(newMsg)
|
p.AddMessage(newMsg)
|
||||||
//已兑换log
|
//已兑换log
|
||||||
itemData := srvdata.GameItemMgr.Get(p.Platform, itemId)
|
//itemData := srvdata.GameItemMgr.Get(p.Platform, itemId)
|
||||||
AwardLogMgr.UpdateAwardLog(itemData.Id, int32(1), itemData.Type)
|
//AwardLogMgr.UpdateAwardLog(itemData.Id, int32(1), itemData.Type)
|
||||||
}
|
}
|
||||||
p.SendToClient(int(bag.SPacketID_PACKET_SC_ITEM_EXCHANGE_RES), pack)
|
p.SendToClient(int(bag.SPacketID_PACKET_SC_ITEM_EXCHANGE_RES), pack)
|
||||||
}), fmt.Sprintf("ItemExChange%d", p.SnId)).Start()
|
}), fmt.Sprintf("ItemExChange%d", p.SnId)).Start()
|
||||||
|
|
|
@ -924,7 +924,7 @@ func (this *ShopMgr) Exchange(p *Player, goodsId int32, username, mobile, commen
|
||||||
}*/
|
}*/
|
||||||
item := srvdata.GameItemMgr.Get(p.Platform, cdata.ItemId)
|
item := srvdata.GameItemMgr.Get(p.Platform, cdata.ItemId)
|
||||||
//已兑换记录
|
//已兑换记录
|
||||||
AwardLogMgr.UpdateAwardLog(item.Id, int32(1), item.Type)
|
//AwardLogMgr.UpdateAwardLog(item.Id, int32(1), item.Type)
|
||||||
awardLog := model.AnnouncerLog{
|
awardLog := model.AnnouncerLog{
|
||||||
Platform: p.Platform,
|
Platform: p.Platform,
|
||||||
Snid: p.SnId,
|
Snid: p.SnId,
|
||||||
|
@ -940,7 +940,7 @@ func (this *ShopMgr) Exchange(p *Player, goodsId int32, username, mobile, commen
|
||||||
item := srvdata.GameItemMgr.Get(p.Platform, cdata.ItemId)
|
item := srvdata.GameItemMgr.Get(p.Platform, cdata.ItemId)
|
||||||
if item.Type == common.ItemTypeObjective {
|
if item.Type == common.ItemTypeObjective {
|
||||||
//已兑换记录
|
//已兑换记录
|
||||||
AwardLogMgr.UpdateAwardLog(item.Id, int32(1), item.Type)
|
//AwardLogMgr.UpdateAwardLog(item.Id, int32(1), item.Type)
|
||||||
awardLog := model.AnnouncerLog{
|
awardLog := model.AnnouncerLog{
|
||||||
Platform: p.Platform,
|
Platform: p.Platform,
|
||||||
Snid: p.SnId,
|
Snid: p.SnId,
|
||||||
|
|
Loading…
Reference in New Issue