update
This commit is contained in:
parent
f386fbdab1
commit
f9fa1ef05c
@ -10,7 +10,6 @@ import (
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"go.mongodb.org/mongo-driver/mongo/options"
|
||||
mgooptions "go.mongodb.org/mongo-driver/mongo/options"
|
||||
"go.mongodb.org/mongo-driver/x/bsonx"
|
||||
)
|
||||
|
||||
@ -30,9 +29,6 @@ func (this *modelRecode) Init(service core.IService, module core.IModule, comp c
|
||||
{
|
||||
Keys: bsonx.Doc{{Key: "p1", Value: bsonx.Int32(1)},
|
||||
{Key: "p2", Value: bsonx.Int32(1)}},
|
||||
}, {
|
||||
Keys: bson.M{"createtime": -1},
|
||||
Options: mgooptions.Index().SetExpireAfterSeconds(7 * 24 * 3600),
|
||||
},
|
||||
}); err != nil {
|
||||
return
|
||||
|
@ -14,7 +14,7 @@ type apiComp struct {
|
||||
module *Hero
|
||||
chat comm.IChat
|
||||
}
|
||||
type DBHeroDrawXXX struct {
|
||||
type DBHeroDrawCardRecord struct {
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID 主键id
|
||||
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
|
||||
HeroId []string `protobuf:"bytes,3,rep,name=heroId,proto3" json:"heroId"` // 英雄ID
|
||||
|
@ -8,7 +8,6 @@ import (
|
||||
"go_dreamfactory/sys/configure"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
"math/big"
|
||||
"time"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
)
|
||||
@ -326,13 +325,13 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
|
||||
// 任务统计
|
||||
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
||||
|
||||
if _, err = this.module.modelDrawRecode.DBModel.DB.InsertOne("drawrecode", &DBHeroDrawXXX{
|
||||
if _, err = this.module.modelDrawRecode.DBModel.DB.InsertOne("drawrecode", &DBHeroDrawCardRecord{
|
||||
Id: primitive.NewObjectID().Hex(),
|
||||
Uid: session.GetUserId(),
|
||||
HeroId: szCards,
|
||||
Drawtype: 1,
|
||||
Ctime: configure.Now().Unix(),
|
||||
ExpireAt: time.Now(),
|
||||
ExpireAt: configure.Now(),
|
||||
}); err != nil {
|
||||
this.module.Errorln(err)
|
||||
return
|
||||
|
@ -5,7 +5,6 @@ import (
|
||||
"go_dreamfactory/pb"
|
||||
"go_dreamfactory/sys/configure"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
"time"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
)
|
||||
@ -128,13 +127,13 @@ func (this *apiComp) SelectCard(session comm.IUserSession, req *pb.HeroSelectCar
|
||||
|
||||
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
||||
|
||||
if _, err = this.module.modelDrawRecode.DBModel.DB.InsertOne("drawrecode", &DBHeroDrawXXX{
|
||||
if _, err = this.module.modelDrawRecode.DBModel.DB.InsertOne("drawrecode", &DBHeroDrawCardRecord{
|
||||
Id: primitive.NewObjectID().Hex(),
|
||||
Uid: session.GetUserId(),
|
||||
HeroId: curSzCard,
|
||||
Drawtype: 1,
|
||||
Ctime: configure.Now().Unix(),
|
||||
ExpireAt: time.Now(),
|
||||
ExpireAt: configure.Now(),
|
||||
}); err != nil {
|
||||
this.module.Errorln(err)
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user