84 lines
1.7 KiB
Go
84 lines
1.7 KiB
Go
package model
|
|
|
|
import (
|
|
"mongo.games.com/goserver/core/logger"
|
|
"time"
|
|
|
|
"github.com/globalsign/mgo"
|
|
)
|
|
|
|
type AnnouncerLog struct {
|
|
Platform string
|
|
Snid int32 //玩家ID
|
|
Name string //玩家名字
|
|
Phone string //电话
|
|
ItemId int32 //获得物品ID
|
|
TypeId int32 //1-话费 2-实物
|
|
Ts time.Time
|
|
}
|
|
|
|
var (
|
|
AnnouncerLogDBName = "log"
|
|
AnnouncerLogCollName = "announcer_log"
|
|
)
|
|
|
|
func InsertAnnouncerLog(logs ...*AnnouncerLog) (err error) {
|
|
if rpcCli == nil {
|
|
return ErrRPClientNoConn
|
|
}
|
|
var ret bool
|
|
return rpcCli.CallWithTimeout("AnnouncerLogSvc.InsertAnnouncerLog", logs, &ret, time.Second*30)
|
|
}
|
|
|
|
func UpsertAnnouncerLog(platform string, data *AwardLog) {
|
|
if rpcCli == nil {
|
|
logger.Logger.Error("model.UpsertApplyList rpcCli == nil")
|
|
return
|
|
}
|
|
|
|
args := &FetchAwardLogArgs{
|
|
Plt: platform,
|
|
Data: data,
|
|
}
|
|
|
|
ret := &AwardLogRes{}
|
|
err := rpcCli.CallWithTimeout("AnnouncerLogSvc.UpsertAnnouncerLog", args, ret, time.Second*30)
|
|
if err != nil {
|
|
logger.Logger.Warn("UpsertApplyList error:", err)
|
|
return
|
|
}
|
|
return
|
|
}
|
|
|
|
type FetchAnnouncerLogArgs struct {
|
|
Plt string
|
|
Data *AnnouncerLog
|
|
}
|
|
|
|
func FetchAnnouncerLog(plt string) (recs []AnnouncerLog, err error) {
|
|
if rpcCli == nil {
|
|
return nil, ErrRPClientNoConn
|
|
}
|
|
args := &FetchAnnouncerLogArgs{
|
|
Plt: plt,
|
|
}
|
|
err = rpcCli.CallWithTimeout("AnnouncerLogSvc.FetchAnnouncerLog", args, &recs, time.Second*30)
|
|
return
|
|
}
|
|
|
|
type RemoveAnnouncerLogArgs struct {
|
|
Plt string
|
|
Ts time.Time
|
|
}
|
|
|
|
func RemovAnnouncerLog(plt string, ts time.Time) (ret *mgo.ChangeInfo, err error) {
|
|
if rpcCli == nil {
|
|
return nil, ErrRPClientNoConn
|
|
}
|
|
args := &RemoveAnnouncerLogArgs{
|
|
Plt: plt,
|
|
}
|
|
rpcCli.CallWithTimeout("AwardLogSvc.RemoveAwardLog", args, &ret, time.Second*30)
|
|
return
|
|
}
|