package model import ( "github.com/globalsign/mgo/bson" "mongo.games.com/goserver/core/logger" "time" ) type BagChangeDollLog struct { LogId bson.ObjectId `bson:"_id"` Platform string //平台 Snid int32 //用户id ItemId int32 ItemNum int32 UserName string //姓名 UserTel string //手机号 Addr string //地址 State int32 //状态 0.默认 1.成功 2.失败 3.未发货准备发货 Remark string //备注信息 CreateTs int64 //订单生成时间 OpTs int64 //订单最后操作时间 Ts int64 } var ( BagChangeDollLogDBName = "log" BagChangeDollLogCollName = "log_bagChangeDoll" ) type DbBagChangeDollLogArgs struct { Log *BagChangeDollLog } func NewDbBagChangeDoll(platform string, snid, itemId, itemNum int32, state int32, remark string, addr string, userName string, userTel string) *BagChangeDollLog { t := time.Now() return &BagChangeDollLog{ LogId: bson.NewObjectId(), Platform: platform, Snid: snid, ItemId: itemId, ItemNum: itemNum, State: state, UserName: userName, UserTel: userTel, Addr: addr, Remark: remark, CreateTs: t.Unix(), OpTs: t.Unix(), Ts: t.Unix(), } } func InsertDbBagChangeDollLog(log *BagChangeDollLog) (err error) { if rpcCli == nil { logger.Logger.Error("model.InsertDbBagChangeDollLog rpcCli == nil") return } var ret bool args := &DbBagChangeDollLogArgs{ Log: log, } err = rpcCli.CallWithTimeout("DbBagChangeDollLogSvc.InsertDbBagChangeDollLog", args, &ret, time.Second*30) if err != nil { logger.Logger.Warn("InsertDbBagChangeDollLog error:", err) return } return } func GetDbBagChangeDollLog(platform string, snid int32) []*BagChangeDollLog { if rpcCli == nil { logger.Logger.Error("model.GetDbBagChangeDollLog rpcCli == nil") return nil } var ret []*BagChangeDollLog args := &DbBagChangeDollLogArgs{ Log: &BagChangeDollLog{Snid: snid, Platform: platform}, } err := rpcCli.CallWithTimeout("DbBagChangeDollLogSvc.GetDbBagChangeDollLog", args, &ret, time.Second*30) if err != nil { logger.Logger.Warn("GetDbBagChangeDollLog error:", err) return nil } return ret }