Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
546e17f7b5
@ -1028,6 +1028,7 @@ const (
|
|||||||
MaxRankNum = 3
|
MaxRankNum = 3
|
||||||
MinRankList = 10 // 排行榜人数
|
MinRankList = 10 // 排行榜人数
|
||||||
AssistHeroCount = 12 // 助战英雄列表显示数量
|
AssistHeroCount = 12 // 助战英雄列表显示数量
|
||||||
|
DrawRecordNumber = 100 // 抽卡列表数量
|
||||||
)
|
)
|
||||||
|
|
||||||
// /聊天消息公告类型
|
// /聊天消息公告类型
|
||||||
|
@ -707,6 +707,7 @@ type (
|
|||||||
}
|
}
|
||||||
IMoonlv interface {
|
IMoonlv interface {
|
||||||
IBuriedUpdateNotify
|
IBuriedUpdateNotify
|
||||||
|
GMCreateMoonlv(session IUserSession, lv int32)
|
||||||
}
|
}
|
||||||
//捉虫子
|
//捉虫子
|
||||||
ICatchBugs interface {
|
ICatchBugs interface {
|
||||||
|
@ -548,7 +548,7 @@ func (this *Buried) TriggerBuried(session comm.IUserSession, burieds ...*pb.Buri
|
|||||||
this.Error("远程触发埋点错误!", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "err", Value: err.Error()})
|
this.Error("远程触发埋点错误!", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "err", Value: err.Error()})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if _, err = this.service.AcrossClusterRpcGo(
|
if err = this.service.AcrossClusterRpcCall(
|
||||||
context.Background(),
|
context.Background(),
|
||||||
stag,
|
stag,
|
||||||
comm.Service_Worker,
|
comm.Service_Worker,
|
||||||
|
@ -136,7 +136,7 @@ func (this *apiComp) Train(session comm.IUserSession, req *pb.DragonTrainReq) (e
|
|||||||
rsp.Reward = atno
|
rsp.Reward = atno
|
||||||
}
|
}
|
||||||
if curType != preType { // 坐骑升阶 增加属性
|
if curType != preType { // 坐骑升阶 增加属性
|
||||||
if c, err := this.module.configure.GetDragonMount(dragon.Dragonid, curType); err != nil {
|
if c, err := this.module.configure.GetDragonMount(dragon.Dragonid, curType); err == nil {
|
||||||
dragon.Property = make(map[string]int32)
|
dragon.Property = make(map[string]int32)
|
||||||
dragon.Property["stime"] = c.Stime
|
dragon.Property["stime"] = c.Stime
|
||||||
dragon.Property["etime"] = c.Etime
|
dragon.Property["etime"] = c.Etime
|
||||||
|
@ -10,7 +10,6 @@ import (
|
|||||||
"go.mongodb.org/mongo-driver/bson"
|
"go.mongodb.org/mongo-driver/bson"
|
||||||
"go.mongodb.org/mongo-driver/mongo"
|
"go.mongodb.org/mongo-driver/mongo"
|
||||||
"go.mongodb.org/mongo-driver/mongo/options"
|
"go.mongodb.org/mongo-driver/mongo/options"
|
||||||
mgooptions "go.mongodb.org/mongo-driver/mongo/options"
|
|
||||||
"go.mongodb.org/mongo-driver/x/bsonx"
|
"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)},
|
Keys: bsonx.Doc{{Key: "p1", Value: bsonx.Int32(1)},
|
||||||
{Key: "p2", Value: bsonx.Int32(1)}},
|
{Key: "p2", Value: bsonx.Int32(1)}},
|
||||||
}, {
|
|
||||||
Keys: bson.M{"createtime": -1},
|
|
||||||
Options: mgooptions.Index().SetExpireAfterSeconds(7 * 24 * 3600),
|
|
||||||
},
|
},
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return
|
return
|
||||||
|
@ -824,6 +824,20 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (errdata *pb.Er
|
|||||||
log.Field{Key: "0", Value: datas[0]},
|
log.Field{Key: "0", Value: datas[0]},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
} else if len(datas) == 2 && (datas[0] == "moonlv") { // 等级
|
||||||
|
module1, err := this.service.GetModule(comm.ModuleMoonlv)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if lv, err := strconv.Atoi(datas[1]); err == nil {
|
||||||
|
module1.(comm.IMoonlv).GMCreateMoonlv(session, int32(lv))
|
||||||
|
|
||||||
|
this.Debug("使用bingo命令",
|
||||||
|
log.Field{Key: "uid", Value: session.GetUserId()},
|
||||||
|
log.Field{Key: "0", Value: datas[1]},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type apiComp struct {
|
type apiComp struct {
|
||||||
@ -13,6 +14,14 @@ type apiComp struct {
|
|||||||
module *Hero
|
module *Hero
|
||||||
chat comm.IChat
|
chat comm.IChat
|
||||||
}
|
}
|
||||||
|
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
|
||||||
|
Drawtype int32 `protobuf:"varint,4,opt,name=drawtype,proto3" json:"drawtype"` // 卡池
|
||||||
|
Ctime int64 `protobuf:"varint,5,opt,name=ctime,proto3" json:"ctime"`
|
||||||
|
ExpireAt time.Time `bson:"expireAt,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
const ( //消息回复的头名称
|
const ( //消息回复的头名称
|
||||||
StrengthenUplv = "strengthenuplv"
|
StrengthenUplv = "strengthenuplv"
|
||||||
|
@ -325,13 +325,17 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
|
|||||||
// 任务统计
|
// 任务统计
|
||||||
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
||||||
|
|
||||||
this.module.modelDrawRecode.InstertDrawCardRecord(&pb.DBHeroDrawRecord{
|
if _, err = this.module.modelDrawRecode.DBModel.DB.InsertOne("drawrecode", &DBHeroDrawCardRecord{
|
||||||
Id: primitive.NewObjectID().Hex(),
|
Id: primitive.NewObjectID().Hex(),
|
||||||
Uid: session.GetUserId(),
|
Uid: session.GetUserId(),
|
||||||
HeroId: szCards,
|
HeroId: szCards,
|
||||||
Drawtype: req.DrawType,
|
Drawtype: 1,
|
||||||
Ctime: configure.Now().Unix(),
|
Ctime: configure.Now().Unix(),
|
||||||
})
|
ExpireAt: configure.Now(),
|
||||||
|
}); err != nil {
|
||||||
|
this.module.Errorln(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
var szHero []*pb.DBHero
|
var szHero []*pb.DBHero
|
||||||
for _, hero := range add { // 奖励一次性发放
|
for _, hero := range add { // 奖励一次性发放
|
||||||
if user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil { // 广播 首次获得英雄
|
if user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil { // 广播 首次获得英雄
|
||||||
|
@ -124,14 +124,20 @@ func (this *apiComp) SelectCard(session comm.IUserSession, req *pb.HeroSelectCar
|
|||||||
Record: heroRecord,
|
Record: heroRecord,
|
||||||
Atno: szAtno,
|
Atno: szAtno,
|
||||||
})
|
})
|
||||||
|
|
||||||
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
||||||
this.module.modelDrawRecode.InstertDrawCardRecord(&pb.DBHeroDrawRecord{
|
|
||||||
|
if _, err = this.module.modelDrawRecode.DBModel.DB.InsertOne("drawrecode", &DBHeroDrawCardRecord{
|
||||||
Id: primitive.NewObjectID().Hex(),
|
Id: primitive.NewObjectID().Hex(),
|
||||||
Uid: session.GetUserId(),
|
Uid: session.GetUserId(),
|
||||||
HeroId: curSzCard,
|
HeroId: curSzCard,
|
||||||
Drawtype: 1,
|
Drawtype: 1,
|
||||||
Ctime: configure.Now().Unix(),
|
Ctime: configure.Now().Unix(),
|
||||||
})
|
ExpireAt: configure.Now(),
|
||||||
|
}); err != nil {
|
||||||
|
this.module.Errorln(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
this.module.HeroLibrary(session, curSzCard, szHero)
|
this.module.HeroLibrary(session, curSzCard, szHero)
|
||||||
this.module.SendTaskMsg(session, szStar, 10, 1, curSzCard)
|
this.module.SendTaskMsg(session, szStar, 10, 1, curSzCard)
|
||||||
})
|
})
|
||||||
|
@ -10,6 +10,7 @@ import (
|
|||||||
"go.mongodb.org/mongo-driver/bson"
|
"go.mongodb.org/mongo-driver/bson"
|
||||||
"go.mongodb.org/mongo-driver/mongo"
|
"go.mongodb.org/mongo-driver/mongo"
|
||||||
"go.mongodb.org/mongo-driver/mongo/options"
|
"go.mongodb.org/mongo-driver/mongo/options"
|
||||||
|
mgooptions "go.mongodb.org/mongo-driver/mongo/options"
|
||||||
"go.mongodb.org/mongo-driver/x/bsonx"
|
"go.mongodb.org/mongo-driver/x/bsonx"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -25,10 +26,16 @@ func (this *modelDrawRecode) Init(service core.IService, module core.IModule, co
|
|||||||
this.module = module.(*Hero)
|
this.module = module.(*Hero)
|
||||||
|
|
||||||
// 通过uid创建索引
|
// 通过uid创建索引
|
||||||
|
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{})
|
||||||
|
|
||||||
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
|
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
|
||||||
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
|
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
|
||||||
})
|
})
|
||||||
|
indexModel := mongo.IndexModel{
|
||||||
|
Keys: bson.M{"expireAt": 1},
|
||||||
|
Options: mgooptions.Index().SetExpireAfterSeconds(6 * 30 * 24 * 3600),
|
||||||
|
}
|
||||||
|
_, err = this.DB.CreateIndex(core.SqlTable(this.TableName), indexModel) //设置 验证码过期时间索引
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,7 +53,7 @@ func (this *modelDrawRecode) getDrawCardRecord(uid string) (results []*pb.DBHero
|
|||||||
)
|
)
|
||||||
results = make([]*pb.DBHeroDrawRecord, 0)
|
results = make([]*pb.DBHeroDrawRecord, 0)
|
||||||
if cursor, err = this.DBModel.DB.Find(comm.TableDrawRecode, bson.M{"uid": uid}, options.Find().SetSort(bson.M{"ctime": -1}),
|
if cursor, err = this.DBModel.DB.Find(comm.TableDrawRecode, bson.M{"uid": uid}, options.Find().SetSort(bson.M{"ctime": -1}),
|
||||||
options.Find().SetLimit(int64(comm.MaxRankList))); err != nil {
|
options.Find().SetLimit(int64(comm.DrawRecordNumber))); err != nil {
|
||||||
this.module.Errorln(err)
|
this.module.Errorln(err)
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
|
@ -113,3 +113,10 @@ func (this *Moonlv) BuriedsNotify(session comm.IUserSession, conds []*pb.ConIPro
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *Moonlv) GMCreateMoonlv(session comm.IUserSession, lv int32) {
|
||||||
|
if lv <= 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.modelMoonlv.modifyMoonlvList(session.GetUserId(), map[string]interface{}{"lv": lv})
|
||||||
|
}
|
||||||
|
@ -659,7 +659,7 @@ type DBHeroDrawRecord struct {
|
|||||||
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户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
|
HeroId []string `protobuf:"bytes,3,rep,name=heroId,proto3" json:"heroId"` // 英雄ID
|
||||||
Drawtype int32 `protobuf:"varint,4,opt,name=drawtype,proto3" json:"drawtype"` // 卡池
|
Drawtype int32 `protobuf:"varint,4,opt,name=drawtype,proto3" json:"drawtype"` // 卡池
|
||||||
Ctime int64 `protobuf:"varint,5,opt,name=ctime,proto3" json:"ctime"` // 抽卡时间
|
Ctime int64 `protobuf:"varint,5,opt,name=ctime,proto3" json:"ctime"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *DBHeroDrawRecord) Reset() {
|
func (x *DBHeroDrawRecord) Reset() {
|
||||||
|
Loading…
Reference in New Issue
Block a user