This commit is contained in:
liwei1dao 2024-01-02 19:19:18 +08:00
commit 546e17f7b5
12 changed files with 64 additions and 19 deletions

View File

@ -1023,11 +1023,12 @@ const (
)
const (
MaxRankList = 50 // 赛季塔 排行榜人数
MaxMailCount = 50 // 当前邮件最大数量
MaxRankNum = 3
MinRankList = 10 // 排行榜人数
AssistHeroCount = 12 // 助战英雄列表显示数量
MaxRankList = 50 // 赛季塔 排行榜人数
MaxMailCount = 50 // 当前邮件最大数量
MaxRankNum = 3
MinRankList = 10 // 排行榜人数
AssistHeroCount = 12 // 助战英雄列表显示数量
DrawRecordNumber = 100 // 抽卡列表数量
)
// /聊天消息公告类型

View File

@ -707,6 +707,7 @@ type (
}
IMoonlv interface {
IBuriedUpdateNotify
GMCreateMoonlv(session IUserSession, lv int32)
}
//捉虫子
ICatchBugs interface {

View File

@ -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()})
return
}
if _, err = this.service.AcrossClusterRpcGo(
if err = this.service.AcrossClusterRpcCall(
context.Background(),
stag,
comm.Service_Worker,

View File

@ -136,7 +136,7 @@ func (this *apiComp) Train(session comm.IUserSession, req *pb.DragonTrainReq) (e
rsp.Reward = atno
}
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["stime"] = c.Stime
dragon.Property["etime"] = c.Etime

View File

@ -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

View File

@ -824,6 +824,20 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (errdata *pb.Er
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]},
)
}
}
}
}

View File

@ -4,6 +4,7 @@ import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
"time"
)
type apiComp struct {
@ -13,6 +14,14 @@ type apiComp struct {
module *Hero
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 ( //消息回复的头名称
StrengthenUplv = "strengthenuplv"

View File

@ -325,13 +325,17 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
// 任务统计
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(),
Uid: session.GetUserId(),
HeroId: szCards,
Drawtype: req.DrawType,
Drawtype: 1,
Ctime: configure.Now().Unix(),
})
ExpireAt: configure.Now(),
}); err != nil {
this.module.Errorln(err)
return
}
var szHero []*pb.DBHero
for _, hero := range add { // 奖励一次性发放
if user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil { // 广播 首次获得英雄

View File

@ -124,14 +124,20 @@ func (this *apiComp) SelectCard(session comm.IUserSession, req *pb.HeroSelectCar
Record: heroRecord,
Atno: szAtno,
})
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(),
Uid: session.GetUserId(),
HeroId: curSzCard,
Drawtype: 1,
Ctime: configure.Now().Unix(),
})
ExpireAt: configure.Now(),
}); err != nil {
this.module.Errorln(err)
return
}
this.module.HeroLibrary(session, curSzCard, szHero)
this.module.SendTaskMsg(session, szStar, 10, 1, curSzCard)
})

View File

@ -10,6 +10,7 @@ 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"
)
@ -25,10 +26,16 @@ func (this *modelDrawRecode) Init(service core.IService, module core.IModule, co
this.module = module.(*Hero)
// 通过uid创建索引
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)}},
})
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
}
@ -46,7 +53,7 @@ func (this *modelDrawRecode) getDrawCardRecord(uid string) (results []*pb.DBHero
)
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}),
options.Find().SetLimit(int64(comm.MaxRankList))); err != nil {
options.Find().SetLimit(int64(comm.DrawRecordNumber))); err != nil {
this.module.Errorln(err)
return
} else {

View File

@ -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})
}

View File

@ -659,7 +659,7 @@ type DBHeroDrawRecord struct {
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"` // 抽卡时间
Ctime int64 `protobuf:"varint,5,opt,name=ctime,proto3" json:"ctime"`
}
func (x *DBHeroDrawRecord) Reset() {