Compare commits
No commits in common. "a7a25ef0282ab9428dffe0446fce08b9f063e387" and "e318c85c265ca228b18067c9e3a086dc04123b8f" have entirely different histories.
a7a25ef028
...
e318c85c26
|
@ -2,6 +2,7 @@ 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"
|
||||||
|
@ -24,33 +25,67 @@ func AwardLogCollection(plt string) *mongo.Collection {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func FetchAwardLog(plt string) (recs model.AwardLog, err error) {
|
func InsertAwardLog(logs ...*model.AwardLog) (err error) {
|
||||||
err = AwardLogCollection(plt).Find(bson.M{}).One(&recs)
|
clog := AwardLogCollection(logs[0].Platform)
|
||||||
|
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) FetchAwardLog(args *model.FetchAwardLogArgs, ret *model.AwardLog) (err error) {
|
func (svc *AwardLogSvc) InsertAwardLog(args []*model.AwardLog, ret *bool) (err error) {
|
||||||
*ret, err = FetchAwardLog(args.Plt)
|
err = InsertAwardLog(args...)
|
||||||
|
if err == nil {
|
||||||
|
*ret = true
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (svc *AwardLogSvc) FetchAwardLog(args *model.FetchAwardLogArgs, ret *[]model.AwardLog) (err error) {
|
||||||
|
*ret, err = FetchAwardLog(args.Plt)
|
||||||
|
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 AwardLogDBErr
|
return ChatColError
|
||||||
}
|
}
|
||||||
_, err := cc.Upsert(bson.M{}, args.Data)
|
_, err := cc.Upsert(bson.M{"platform": args.Plt}, args.Data)
|
||||||
if err != nil {
|
if err != nil && err != mgo.ErrNotFound {
|
||||||
logger.Logger.Error("UpsertAwardLog is err: ", err)
|
logger.Logger.Error("UpsertChat 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,8 +8,9 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type AwardLog struct {
|
type AwardLog struct {
|
||||||
AwardMap map[int32]int64 //key1:1话费 2实物 key2 itemId value:数量
|
Platform string
|
||||||
Ts int64
|
AwardMap map[int32]map[int32]int32 //key1:1话费 2实物 key2 itemId value:数量
|
||||||
|
Ts time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -17,6 +18,14 @@ 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
|
||||||
|
@ -25,9 +34,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 recs, ErrRPClientNoConn
|
return nil, ErrRPClientNoConn
|
||||||
}
|
}
|
||||||
args := &FetchAwardLogArgs{
|
args := &FetchAwardLogArgs{
|
||||||
Plt: plt,
|
Plt: plt,
|
||||||
|
@ -38,7 +47,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.UpsertAwardLog rpcCli == nil")
|
logger.Logger.Error("model.UpsertApplyList 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,8 +134,6 @@ type AllConfig struct {
|
||||||
*webapi.RankTypeConfig
|
*webapi.RankTypeConfig
|
||||||
//获奖记录配置
|
//获奖记录配置
|
||||||
*webapi.AwardLogConfig
|
*webapi.AwardLogConfig
|
||||||
// 获得道具总数
|
|
||||||
AwardItem AwardLog
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type GlobalConfig struct {
|
type GlobalConfig struct {
|
||||||
|
@ -357,12 +355,3 @@ 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 06d6be8fa6d928f7eb30a4c567abfc43e571cbc4
|
Subproject commit d789cca81a36ddbaf30e5414b6c4fe530e0631f6
|
|
@ -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(p.Platform).AwardLogConfig
|
awardLogConfig := PlatformMgrSingleton.GetConfig("1").AwardLogConfig
|
||||||
|
|
||||||
AwardLog := AwardLogMgr.GetAwardLog(p.Platform, msg.TypeId)
|
AwardLog := AwardLogMgr.GetAwardLog(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(p.Platform, msg.TypeId)
|
AnnouncerLog := AwardLogMgr.GetAnnouncerLog(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,123 +1,88 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"time"
|
|
||||||
|
|
||||||
"mongo.games.com/game/common"
|
|
||||||
"mongo.games.com/game/model"
|
"mongo.games.com/game/model"
|
||||||
"mongo.games.com/game/srvdata"
|
|
||||||
"mongo.games.com/goserver/core/basic"
|
"mongo.games.com/goserver/core/basic"
|
||||||
"mongo.games.com/goserver/core/logger"
|
"mongo.games.com/goserver/core/logger"
|
||||||
"mongo.games.com/goserver/core/module"
|
|
||||||
"mongo.games.com/goserver/core/task"
|
"mongo.games.com/goserver/core/task"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"mongo.games.com/goserver/core/module"
|
||||||
)
|
)
|
||||||
|
|
||||||
type AwardLogManager struct {
|
type AwardLogManager struct {
|
||||||
BaseClockSinker
|
BaseClockSinker
|
||||||
AnnouncerLog map[string]map[int32][]model.AnnouncerLog //key:1话费 2实物
|
AwardMap map[int32]map[int32]int32 //key1:1话费 2实物 key2 itemId value:数量
|
||||||
|
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"
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetAwardLog 获取总数量
|
func (this *AwardLogManager) GetAwardLog(typeId int32) map[int32]int32 {
|
||||||
// typeId 1 话费 2实物
|
return this.AwardMap[typeId]
|
||||||
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(plt string, typeId int32) []model.AnnouncerLog {
|
func (this *AwardLogManager) GetAnnouncerLog(typeId int32) []model.AnnouncerLog {
|
||||||
data := this.AnnouncerLog[plt]
|
log := this.AnnouncerLog[typeId]
|
||||||
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 log
|
return this.AnnouncerLog[typeId]
|
||||||
}
|
}
|
||||||
|
|
||||||
// 已兑换数据
|
// 已兑换数据
|
||||||
func (this *AwardLogManager) UpdateAwardLog(plt string, itemId int32, num int64) {
|
func (this *AwardLogManager) UpdateAwardLog(itemId, num, itemType int32) {
|
||||||
PlatformMgrSingleton.AddAwardItem(plt, itemId, num)
|
typeID := int32(1)
|
||||||
|
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) {
|
||||||
data.Ts = time.Now()
|
|
||||||
if this.AnnouncerLog == nil {
|
if this.AnnouncerLog == nil {
|
||||||
this.AnnouncerLog = make(map[string]map[int32][]model.AnnouncerLog)
|
this.AnnouncerLog = make(map[int32][]model.AnnouncerLog)
|
||||||
}
|
}
|
||||||
if this.AnnouncerLog[data.Platform] == nil {
|
this.AnnouncerLog[data.TypeId] = append(this.AnnouncerLog[data.TypeId], data)
|
||||||
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)
|
logger.Logger.Trace("更新实时播报数据 this.AnnouncerLog = ", this.AnnouncerLog)
|
||||||
|
data.Ts = time.Now()
|
||||||
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 {
|
//初始化数据
|
||||||
if v != nil {
|
this.AwardMap = make(map[int32]map[int32]int32)
|
||||||
// 获取道具获得总数
|
this.AnnouncerLog = make(map[int32][]model.AnnouncerLog)
|
||||||
res, err := model.FetchAwardLog(v.IdStr)
|
AwardMap, err := model.FetchAwardLog("1")
|
||||||
if err != nil {
|
if err == nil {
|
||||||
logger.Logger.Errorf("fetch award log error: %v", err)
|
for _, log := range AwardMap {
|
||||||
} else {
|
this.AwardMap = log.AwardMap
|
||||||
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() {
|
||||||
|
@ -129,21 +94,25 @@ 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{} {
|
||||||
this.Save()
|
awardData := &model.AwardLog{}
|
||||||
|
awardData.Platform = "1"
|
||||||
|
awardData.AwardMap = this.AwardMap
|
||||||
|
awardData.Ts = time.Now()
|
||||||
|
model.UpsertAwardLog("1", awardData)
|
||||||
return nil
|
return nil
|
||||||
}), task.CompleteNotifyWrapper(func(i interface{}, t task.Task) {
|
}), task.CompleteNotifyWrapper(func(data interface{}, tt task.Task) {
|
||||||
}), "save_awarditem").Start()
|
})).StartByFixExecutor("AwardLogTask")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *AwardLogManager) Save() {
|
func (this *AwardLogManager) Save() {
|
||||||
for _, v := range PlatformMgrSingleton.platforms {
|
awardData := &model.AwardLog{}
|
||||||
if v != nil {
|
awardData.Platform = "1"
|
||||||
model.UpsertAwardLog(v.IdStr, &PlatformMgrSingleton.GetConfig(v.IdStr).AwardItem)
|
awardData.AwardMap = this.AwardMap
|
||||||
}
|
awardData.Ts = time.Now()
|
||||||
}
|
model.UpsertAwardLog("1", awardData)
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
module.RegisteModule(AwardLogMgr, time.Hour, 0)
|
module.RegisteModule(AwardLogMgr, time.Minute*3, 0)
|
||||||
ClockMgrSington.RegisteSinker(AwardLogMgr)
|
ClockMgrSington.RegisteSinker(AwardLogMgr)
|
||||||
}
|
}
|
||||||
|
|
|
@ -327,30 +327,6 @@ 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 {
|
||||||
|
@ -382,6 +358,28 @@ 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 {
|
||||||
|
@ -500,28 +498,26 @@ func (this *BagMgr) AddItemsOffline(platform string, snid int32, addItems []*Ite
|
||||||
}
|
}
|
||||||
|
|
||||||
//获奖记录log
|
//获奖记录log
|
||||||
if logType == ItemObtain && v.ItemNum > 0 {
|
if v.ItemNum > 0 && (itemData.Type == common.ItemTypeChange || itemData.Type == common.ItemTypeObjective) {
|
||||||
AwardLogMgr.UpdateAwardLog(findPlayer.Platform, itemData.Id, v.ItemNum)
|
awardLogType := 1
|
||||||
|
|
||||||
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,
|
Name: findPlayer.Name,
|
||||||
Name: findPlayer.Name,
|
Phone: findPlayer.Tel,
|
||||||
Phone: findPlayer.Tel,
|
ItemId: itemData.Id, //获得物品ID
|
||||||
ItemId: itemData.Id, //获得物品ID
|
TypeId: int32(awardLogType),
|
||||||
TypeId: int32(awardLogType),
|
|
||||||
}
|
|
||||||
AwardLogMgr.UpdateAnnouncerLog(logData)
|
|
||||||
}
|
}
|
||||||
|
AwardLogMgr.UpdateAnnouncerLog(logData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -761,8 +757,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