Merge branch 'meixiongfeng' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
05353d57eb
@ -114,8 +114,10 @@ const (
|
|||||||
TableRtask = "rtask"
|
TableRtask = "rtask"
|
||||||
// 随机任务触发记录
|
// 随机任务触发记录
|
||||||
TableRtaskRecord = "rrecord"
|
TableRtaskRecord = "rrecord"
|
||||||
///爬塔排行
|
///记录用户爬塔排行数据
|
||||||
TablePagodaRank = "pagodarank"
|
TablePagodaRecord = "pagodarecord"
|
||||||
|
///有序的爬塔排行 (正正的排行榜 最多只有50条)
|
||||||
|
TablePagodaRankList = "pagodaranklist"
|
||||||
/// 美食馆
|
/// 美食馆
|
||||||
TableSmithy = "smithy"
|
TableSmithy = "smithy"
|
||||||
/// 赛季塔数据表
|
/// 赛季塔数据表
|
||||||
|
@ -100,17 +100,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal
|
|||||||
mapData["pagodaId"] = cfg.LayerNum
|
mapData["pagodaId"] = cfg.LayerNum
|
||||||
code = this.module.ModifySeasonPagodaData(session.GetUserId(), mapData)
|
code = this.module.ModifySeasonPagodaData(session.GetUserId(), mapData)
|
||||||
}
|
}
|
||||||
|
// 记录爬塔明细数据
|
||||||
rst, _ := this.module.modulerank.GetUserRandData(session.GetUserId())
|
|
||||||
if rst.Uid == "" {
|
|
||||||
rst.Uid = session.GetUserId()
|
|
||||||
rst.Id = primitive.NewObjectID().Hex()
|
|
||||||
rst.Type = req.PagodaType
|
|
||||||
rst.Nickname = this.module.ModuleUser.GetUser(session.GetUserId()).Name
|
|
||||||
rst.Lv = this.module.ModuleUser.GetUser(session.GetUserId()).Lv
|
|
||||||
rst.PagodaId = pagoda.PagodaId
|
|
||||||
this.module.modulerank.AddRank(session.GetUserId(), rst)
|
|
||||||
} else {
|
|
||||||
if req.Report != nil && len(req.Report.Info.Redflist) > 0 {
|
if req.Report != nil && len(req.Report.Info.Redflist) > 0 {
|
||||||
sz := make([]*pb.LineUp, 5)
|
sz := make([]*pb.LineUp, 5)
|
||||||
for i, v := range req.Report.Info.Redflist[0].Team {
|
for i, v := range req.Report.Info.Redflist[0].Team {
|
||||||
@ -123,10 +113,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.module.modulerank.updatePagodaRankList(session, seasonPagoda, req.Report.Info.Redflist[0].Leadpos, sz)
|
this.module.modulerank.addPagodaRankList(session, seasonPagoda, req.Report.Info.Redflist[0].Leadpos, sz)
|
||||||
}
|
|
||||||
mapData["pagodaId"] = cfg.LayerNum
|
|
||||||
this.module.modulerank.ChangeUserRank(session.GetUserId(), mapData)
|
|
||||||
}
|
}
|
||||||
pagoda.PagodaId = seasonPagoda.PagodaId
|
pagoda.PagodaId = seasonPagoda.PagodaId
|
||||||
pagoda.Type = seasonPagoda.Type
|
pagoda.Type = seasonPagoda.Type
|
||||||
|
@ -14,16 +14,21 @@ func (this *apiComp) RankListCheck(session comm.IUserSession, req *pb.PagodaRank
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *apiComp) RankList(session comm.IUserSession, req *pb.PagodaRankListReq) (code pb.ErrorCode, data proto.Message) {
|
func (this *apiComp) RankList(session comm.IUserSession, req *pb.PagodaRankListReq) (code pb.ErrorCode, data proto.Message) {
|
||||||
|
var (
|
||||||
|
szRank []*pb.DBPagodaRank
|
||||||
|
err error
|
||||||
|
)
|
||||||
code = this.RankListCheck(session, req)
|
code = this.RankListCheck(session, req)
|
||||||
if code != pb.ErrorCode_Success {
|
if code != pb.ErrorCode_Success {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if req.FloorId == 0 && req.Friend == false {
|
||||||
szRank, err := this.module.modulerank.GetRankData()
|
szRank, err = this.module.modulerank.GetRankData()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
session.SendMsg(string(this.module.GetType()), PagodaRankListResp, &pb.PagodaRankListResp{Ranks: szRank})
|
session.SendMsg(string(this.module.GetType()), PagodaRankListResp, &pb.PagodaRankListResp{Ranks: szRank})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ type ModelRank struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *ModelRank) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
func (this *ModelRank) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||||
this.TableName = comm.TablePagodaRank
|
this.TableName = comm.TablePagodaRecord
|
||||||
err = this.MCompModel.Init(service, module, comp, options)
|
err = this.MCompModel.Init(service, module, comp, options)
|
||||||
this.modulePagoda = module.(*Pagoda)
|
this.modulePagoda = module.(*Pagoda)
|
||||||
return
|
return
|
||||||
@ -49,7 +49,7 @@ func (this *ModelRank) ChangeUserRank(uid string, value map[string]interface{})
|
|||||||
|
|
||||||
func (this *ModelRank) GetRankData() (data []*pb.DBPagodaRank, err error) {
|
func (this *ModelRank) GetRankData() (data []*pb.DBPagodaRank, err error) {
|
||||||
data = make([]*pb.DBPagodaRank, 0)
|
data = make([]*pb.DBPagodaRank, 0)
|
||||||
err = this.Redis.LRange(comm.TablePagodaRank, 0, -1, &data)
|
err = this.Redis.LRange(comm.TablePagodaRankList, 0, -1, &data)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -63,7 +63,7 @@ func (this *ModelRank) getPagodaRankList(uid string) []*pb.DBPagodaRank {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 插入新的排行数据
|
// 插入新的排行数据
|
||||||
func (this *ModelRank) updatePagodaRankList(session comm.IUserSession, data *pb.DBSeasonPagoda, Leadpos int32, line []*pb.LineUp) {
|
func (this *ModelRank) addPagodaRankList(session comm.IUserSession, data *pb.DBSeasonPagoda, Leadpos int32, line []*pb.LineUp) {
|
||||||
userinfo := this.modulePagoda.ModuleUser.GetUser(session.GetUserId())
|
userinfo := this.modulePagoda.ModuleUser.GetUser(session.GetUserId())
|
||||||
new := &pb.DBPagodaRank{
|
new := &pb.DBPagodaRank{
|
||||||
Id: primitive.NewObjectID().Hex(),
|
Id: primitive.NewObjectID().Hex(),
|
||||||
|
@ -61,7 +61,7 @@ func (this *ModelSeasonPagoda) addNewSeasonPagoda(uId string, data *pb.DBSeasonP
|
|||||||
// 赛季结束 清理所有塔数据
|
// 赛季结束 清理所有塔数据
|
||||||
func (this *ModelSeasonPagoda) DleAllSeasonData() {
|
func (this *ModelSeasonPagoda) DleAllSeasonData() {
|
||||||
this.DB.DeleteMany(core.SqlTable(this.TableName), bson.M{})
|
this.DB.DeleteMany(core.SqlTable(this.TableName), bson.M{})
|
||||||
err := this.Redis.Ltrim(comm.TablePagodaRank, 0, -1)
|
err := this.Redis.Ltrim(comm.TablePagodaRecord, 0, -1)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("delete failed")
|
log.Errorf("delete failed")
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ type forumComp struct {
|
|||||||
//组件初始化接口
|
//组件初始化接口
|
||||||
func (this *forumComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
func (this *forumComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||||
|
|
||||||
this.TableName = comm.TablePagodaRank
|
this.TableName = comm.TablePagodaRecord
|
||||||
this.MCompModel.Init(service, module, comp, options)
|
this.MCompModel.Init(service, module, comp, options)
|
||||||
this.service = service
|
this.service = service
|
||||||
return
|
return
|
||||||
|
@ -22,7 +22,7 @@ type PagodaRank struct {
|
|||||||
//组件初始化接口
|
//组件初始化接口
|
||||||
func (this *PagodaRank) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
func (this *PagodaRank) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||||
|
|
||||||
this.TableName = comm.TablePagodaRank
|
this.TableName = comm.TablePagodaRecord
|
||||||
this.MCompModel.Init(service, module, comp, options)
|
this.MCompModel.Init(service, module, comp, options)
|
||||||
this.service = service
|
this.service = service
|
||||||
return
|
return
|
||||||
@ -37,7 +37,7 @@ func (this *PagodaRank) Start() (err error) {
|
|||||||
// 处理排行榜排序
|
// 处理排行榜排序
|
||||||
func (this *PagodaRank) Timer() {
|
func (this *PagodaRank) Timer() {
|
||||||
data := make([]interface{}, 0) // options.Find().SetLimit(comm.MaxRankList)
|
data := make([]interface{}, 0) // options.Find().SetLimit(comm.MaxRankList)
|
||||||
if _data, err := this.DB.Find(comm.TablePagodaRank, bson.M{}, options.Find().SetSort(bson.M{"pagodaId": -1}).SetLimit(comm.MaxRankList)); err == nil {
|
if _data, err := this.DB.Find(comm.TablePagodaRecord, bson.M{}, options.Find().SetSort(bson.M{"pagodaId": -1}).SetLimit(comm.MaxRankList)); err == nil {
|
||||||
for _data.Next(context.TODO()) {
|
for _data.Next(context.TODO()) {
|
||||||
temp := &pb.DBPagodaRank{}
|
temp := &pb.DBPagodaRank{}
|
||||||
if err = _data.Decode(temp); err == nil {
|
if err = _data.Decode(temp); err == nil {
|
||||||
@ -46,9 +46,9 @@ func (this *PagodaRank) Timer() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(data) > 0 {
|
if len(data) > 0 {
|
||||||
err := this.Redis.RPush(comm.TablePagodaRank, data...)
|
err := this.Redis.RPush(comm.TablePagodaRankList, data...)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = this.Redis.Ltrim(comm.TablePagodaRank, -1*len(data), -1) //对一个列表进行修剪
|
err = this.Redis.Ltrim(comm.TablePagodaRankList, -1*len(data), -1) //对一个列表进行修剪
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("delete failed")
|
log.Errorf("delete failed")
|
||||||
}
|
}
|
||||||
|
@ -437,8 +437,8 @@ type PagodaRankListReq struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
FloorId int32 `protobuf:"varint,1,opt,name=floorId,proto3" json:"floorId"` // 层数
|
FloorId int32 `protobuf:"varint,1,opt,name=floorId,proto3" json:"floorId"` // 层数 0 标识总榜
|
||||||
Type int32 `protobuf:"varint,2,opt,name=type,proto3" json:"type"` // 塔类型
|
Friend bool `protobuf:"varint,2,opt,name=friend,proto3" json:"friend"` // true 好友榜
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *PagodaRankListReq) Reset() {
|
func (x *PagodaRankListReq) Reset() {
|
||||||
@ -480,11 +480,11 @@ func (x *PagodaRankListReq) GetFloorId() int32 {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *PagodaRankListReq) GetType() int32 {
|
func (x *PagodaRankListReq) GetFriend() bool {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Type
|
return x.Friend
|
||||||
}
|
}
|
||||||
return 0
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
type PagodaRankListResp struct {
|
type PagodaRankListResp struct {
|
||||||
@ -575,15 +575,16 @@ var file_pagoda_pagoda_msg_proto_rawDesc = []byte{
|
|||||||
0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x4f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73,
|
0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x4f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73,
|
||||||
0x70, 0x12, 0x1d, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
0x70, 0x12, 0x1d, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||||
0x09, 0x2e, 0x44, 0x42, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61,
|
0x09, 0x2e, 0x44, 0x42, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61,
|
||||||
0x22, 0x41, 0x0a, 0x11, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x52, 0x61, 0x6e, 0x6b, 0x4c, 0x69,
|
0x22, 0x45, 0x0a, 0x11, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x52, 0x61, 0x6e, 0x6b, 0x4c, 0x69,
|
||||||
0x73, 0x74, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x6c, 0x6f, 0x6f, 0x72, 0x49, 0x64,
|
0x73, 0x74, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x6c, 0x6f, 0x6f, 0x72, 0x49, 0x64,
|
||||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x66, 0x6c, 0x6f, 0x6f, 0x72, 0x49, 0x64, 0x12,
|
0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x66, 0x6c, 0x6f, 0x6f, 0x72, 0x49, 0x64, 0x12,
|
||||||
0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x74,
|
0x16, 0x0a, 0x06, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52,
|
||||||
0x79, 0x70, 0x65, 0x22, 0x39, 0x0a, 0x12, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x52, 0x61, 0x6e,
|
0x06, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x22, 0x39, 0x0a, 0x12, 0x50, 0x61, 0x67, 0x6f, 0x64,
|
||||||
0x6b, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x23, 0x0a, 0x05, 0x72, 0x61, 0x6e,
|
0x61, 0x52, 0x61, 0x6e, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x23, 0x0a,
|
||||||
0x6b, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42, 0x50, 0x61, 0x67,
|
0x05, 0x72, 0x61, 0x6e, 0x6b, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44,
|
||||||
0x6f, 0x64, 0x61, 0x52, 0x61, 0x6e, 0x6b, 0x52, 0x05, 0x72, 0x61, 0x6e, 0x6b, 0x73, 0x42, 0x06,
|
0x42, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x52, 0x61, 0x6e, 0x6b, 0x52, 0x05, 0x72, 0x61, 0x6e,
|
||||||
0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x6b, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
|
||||||
|
0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
Loading…
Reference in New Issue
Block a user