排行优化

This commit is contained in:
wh_zcy 2023-01-15 10:54:27 +08:00
parent 5e8f7c5e8e
commit a839bbcd3c
6 changed files with 289 additions and 154 deletions

View File

@ -81,7 +81,11 @@ func (s *SociatyBossView) CreateView(t *model.TestCase) fyne.CanvasObject {
bottomLabels := container.NewHBox( bottomLabels := container.NewHBox(
s.ticketLabel, s.settleTimeLabel, s.endTimeLabel, s.ticketLabel, s.settleTimeLabel, s.endTimeLabel,
) )
c := container.NewBorder(btns, bottomLabels, nil, nil) leftLabels := container.NewHBox(
s.personRankingLabel,
s.sociatyRankingLabel,
)
c := container.NewBorder(btns, bottomLabels, leftLabels, nil)
s.listenTeams() s.listenTeams()
s.listenBossmain() s.listenBossmain()
@ -150,6 +154,16 @@ func (s *SociatyBossView) listenBossmain() {
fmt.Sprintf("挑战券:%d", rsp.Ticket), fmt.Sprintf("挑战券:%d", rsp.Ticket),
) )
s.ticketLabel.Refresh() s.ticketLabel.Refresh()
s.sociatyRankingLabel.SetText(
fmt.Sprintf("公会排名:%d", rsp.SociatyRanking),
)
s.sociatyRankingLabel.Refresh()
s.personRankingLabel.SetText(
fmt.Sprintf("个人排名:%d", rsp.PersonalRanking),
)
s.personRankingLabel.Refresh()
}, },
}) })
s.bossFlag = true s.bossFlag = true

View File

@ -1,6 +1,7 @@
package sociaty package sociaty
import ( import (
"fmt"
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/lego/sys/log" "go_dreamfactory/lego/sys/log"
"go_dreamfactory/pb" "go_dreamfactory/pb"
@ -64,6 +65,21 @@ func (this *apiComp) Bossmain(session comm.IUserSession, req *pb.SociatyBMainReq
rsp.EndTime = dbs.EndTime rsp.EndTime = dbs.EndTime
rsp.SettlementTime = dbs.SettlementTime rsp.SettlementTime = dbs.SettlementTime
// 个人积分
dbr := this.module.modelSociatyBoss.getChallengeRecord(uid)
if dbr != nil {
rsp.Total = dbr.Total
rsp.HighIntegrals = dbr.Integrals
}
//个人排名
rsp.PersonalRanking = this.module.modelSociatyBoss.getRankingByUid(
fmt.Sprintf("%s:%s", this.module.modelSociatyBoss.TableName, BOSS_PERSONAL_RANK), uid)
// 公会排名
rsp.SociatyRanking = this.module.modelSociatyBoss.getRankingByUid(
fmt.Sprintf("%s:%s", this.module.modelSociatyBoss.TableName, BOSS_SOCIATY_RANK), uid)
if sm := this.module.modelSociaty.getMemberInfo(sociaty, uid); sm != nil { if sm := this.module.modelSociaty.getMemberInfo(sociaty, uid); sm != nil {
rsp.Teams = sm.Teams rsp.Teams = sm.Teams
} }

View File

@ -26,7 +26,7 @@ func (this *apiComp) Brank(session comm.IUserSession, req *pb.SociatyBRankReq) (
return return
} }
sri := this.module.modelSociatyBoss.rank(sociaty.Name, req.RankType) sri := this.module.modelSociatyBoss.bossRank(sociaty, req.RankType)
rsp := &pb.SociatyBRankResp{ rsp := &pb.SociatyBRankResp{
Rank: sri, Rank: sri,

View File

@ -22,7 +22,8 @@ import (
var ( var (
BOSS_SPORTS = "sports" BOSS_SPORTS = "sports"
BOSS_RANK = "rank" BOSS_PERSONAL_RANK = "personalrank" //个人排行key
BOSS_SOCIATY_RANK = "sociatyrank" //公会排名
SPORTS_HOUR = 3 * 24 //赛季周期 SPORTS_HOUR = 3 * 24 //赛季周期
) )
@ -293,14 +294,14 @@ func (s *ModelSociatyBoss) updateChallengeRecord(uid, sociatyId string, record *
return nil return nil
} }
// 记入排行 // 记入个人排行
func (s *ModelSociatyBoss) addRank(uid string, integral int64) error { func (s *ModelSociatyBoss) addPersonalRank(uid string, integral int64) error {
var ( var (
pipe *pipe.RedisPipe = s.Redis.RedisPipe(context.TODO()) pipe *pipe.RedisPipe = s.Redis.RedisPipe(context.TODO())
m *redis.Z m *redis.Z
) )
m = &redis.Z{Score: float64(integral), Member: uid} m = &redis.Z{Score: float64(integral), Member: uid}
if cmd := pipe.ZAdd(fmt.Sprintf("%s:%s", s.TableName, BOSS_RANK), m); cmd != nil { if cmd := pipe.ZAdd(fmt.Sprintf("%s:%s", s.TableName, BOSS_PERSONAL_RANK), m); cmd != nil {
_, err := cmd.Result() _, err := cmd.Result()
if err != nil { if err != nil {
return err return err
@ -312,17 +313,40 @@ func (s *ModelSociatyBoss) addRank(uid string, integral int64) error {
return nil return nil
} }
// 记入公会排行
func (s *ModelSociatyBoss) addSociatyRank(uid string, integral int64) error {
dbr := s.getChallengeRecord(uid)
if dbr == nil {
return errors.New("没有挑战记录")
}
if dbr.SociatyId != "" {
var pipe *pipe.RedisPipe = s.Redis.RedisPipe(context.TODO())
if cmd := pipe.ZIncrBy(fmt.Sprintf("%s:%s", s.TableName, BOSS_SOCIATY_RANK), float64(integral), dbr.SociatyId); cmd != nil {
_, err := cmd.Result()
if err != nil {
return err
}
}
if _, err := pipe.Exec(); err != nil {
return err
}
}
return nil
}
// 伤害转换积分 // 伤害转换积分
func (s *ModelSociatyBoss) transIntegral(harm int32) int64 { func (s *ModelSociatyBoss) transIntegral(harm int32) int64 {
return int64(harm) return int64(harm)
} }
// 查询排行榜 // 查询排行榜
func (this *ModelSociatyBoss) queryRankUid(count int64) (ranks []string, err error) { func (s *ModelSociatyBoss) queryRankUid(count int64) (ranks []string, err error) {
var ( var (
result []string result []string
) )
if result, err = this.DBModel.Redis.ZRevRange(this.TableName, 0, count).Result(); err != nil { if result, err = s.DBModel.Redis.ZRevRange(s.TableName, 0, count).Result(); err != nil {
return return
} }
ranks = make([]string, 0) ranks = make([]string, 0)
@ -333,8 +357,8 @@ func (this *ModelSociatyBoss) queryRankUid(count int64) (ranks []string, err err
} }
// 取积分 // 取积分
func (this *ModelSociatyBoss) getScoreByUid(uid string) int64 { func (s *ModelSociatyBoss) getScoreByUid(key, member string) int64 {
result, err := this.DBModel.Redis.ZScore(this.TableName, uid) result, err := s.DBModel.Redis.ZScore(key, member)
if err != nil { if err != nil {
return 0 return 0
} }
@ -342,8 +366,8 @@ func (this *ModelSociatyBoss) getScoreByUid(uid string) int64 {
} }
// 取排名 // 取排名
func (this *ModelSociatyBoss) getRankingByUid(uid string) int64 { func (s *ModelSociatyBoss) getRankingByUid(key, member string) int64 {
result, err := this.DBModel.Redis.ZRevRank(this.TableName, uid) result, err := s.DBModel.Redis.ZRevRank(key, member)
if err != nil { if err != nil {
return 0 return 0
} }
@ -351,16 +375,13 @@ func (this *ModelSociatyBoss) getRankingByUid(uid string) int64 {
} }
// 排行榜 // 排行榜
func (s *ModelSociatyBoss) rank(sociatyName string, rankType int32) (res []*pb.SociatyRankInfo) { func (s *ModelSociatyBoss) bossRank(sociaty *pb.DBSociaty, rankType int32) (res []*pb.SociatyRankInfo) {
var rankCount int64 var (
switch rankType { rankCount int64
case 1: //个人 key string
rankCount = 1000 )
case 2: //成员
rankCount = 50 rank := func() []*pb.SociatyRankInfo {
case 3: //公会
rankCount = 50
}
// 所有排行记录 // 所有排行记录
rankUids, err := s.queryRankUid(rankCount) rankUids, err := s.queryRankUid(rankCount)
if err != nil { if err != nil {
@ -374,17 +395,51 @@ func (s *ModelSociatyBoss) rank(sociatyName string, rankType int32) (res []*pb.S
if iuser, ok := imodule.(comm.IUser); ok { if iuser, ok := imodule.(comm.IUser); ok {
if user := iuser.GetUser(uid); user != nil && user.Uid != "" { if user := iuser.GetUser(uid); user != nil && user.Uid != "" {
res = append(res, &pb.SociatyRankInfo{ res = append(res, &pb.SociatyRankInfo{
SociatyName: sociatyName, SociatyName: sociaty.Name,
Name: user.Name, Name: user.Name,
Head: user.Avatar, Head: user.Avatar,
Lv: user.Lv, Lv: user.Lv,
Ranking: s.getRankingByUid(user.Uid), Ranking: s.getRankingByUid(key, user.Uid),
Integral: s.getScoreByUid(user.Uid), Integral: s.getScoreByUid(key, user.Uid),
})
}
}
}
return res
}
switch rankType {
case 1: //个人
rankCount = 1000
key = fmt.Sprintf("%s:%s", s.TableName, BOSS_PERSONAL_RANK)
rank()
case 2: //公会
rankCount = 50
key = fmt.Sprintf("%s:%s", s.TableName, BOSS_SOCIATY_RANK)
rank()
case 3: //公会成员
for _, m := range sociaty.Members {
imodule, err := s.service.GetModule(comm.ModuleUser)
if err != nil {
return nil
}
if iuser, ok := imodule.(comm.IUser); ok {
if user := iuser.GetUser(m.Uid); user != nil && user.Uid != "" {
res = append(res, &pb.SociatyRankInfo{
SociatyName: sociaty.Name,
Name: user.Name,
Head: user.Avatar,
Lv: user.Lv,
Ranking: s.getRankingByUid(key, user.Uid),
Integral: s.getScoreByUid(key, user.Uid),
})
}
}
}
sort.SliceStable(res, func(i, j int) bool {
return res[i].Integral > res[j].Integral
}) })
} }
}
}
return nil return nil
} }
@ -409,7 +464,7 @@ func (s *ModelSociatyBoss) reset() error {
} }
} }
// 清理排行榜 // 清理排行榜
if err := s.Del(BOSS_RANK); err != nil { if err := s.Del(BOSS_PERSONAL_RANK); err != nil {
s.moduleSociaty.Error("清理排行榜", log.Field{Key: "err", Value: err.Error()}) s.moduleSociaty.Error("清理排行榜", log.Field{Key: "err", Value: err.Error()})
} }
return nil return nil
@ -466,7 +521,9 @@ func (s *ModelSociatyBoss) settlement() error {
} }
// 将玩家积分加入排行榜 // 将玩家积分加入排行榜
s.addRank(uid, total) s.addPersonalRank(uid, total)
// 将玩家积分加入公会排行榜
s.addSociatyRank(uid, total)
s.moduleSociaty.Debug("结算:", log.Field{Key: "uid", Value: uid}) s.moduleSociaty.Debug("结算:", log.Field{Key: "uid", Value: uid})
} }

View File

@ -2782,6 +2782,10 @@ type SociatyBMainResp struct {
Ticket int32 `protobuf:"varint,2,opt,name=ticket,proto3" json:"ticket"` // 挑战券数量 Ticket int32 `protobuf:"varint,2,opt,name=ticket,proto3" json:"ticket"` // 挑战券数量
EndTime int64 `protobuf:"varint,3,opt,name=endTime,proto3" json:"endTime"` //赛季结束时间 EndTime int64 `protobuf:"varint,3,opt,name=endTime,proto3" json:"endTime"` //赛季结束时间
SettlementTime int64 `protobuf:"varint,4,opt,name=settlementTime,proto3" json:"settlementTime"` //赛季结算时间 SettlementTime int64 `protobuf:"varint,4,opt,name=settlementTime,proto3" json:"settlementTime"` //赛季结算时间
Total int64 `protobuf:"varint,5,opt,name=total,proto3" json:"total"` //总积分
HighIntegrals []int64 `protobuf:"varint,6,rep,packed,name=highIntegrals,proto3" json:"highIntegrals"` //最高的积分
PersonalRanking int64 `protobuf:"varint,7,opt,name=personalRanking,proto3" json:"personalRanking"` //个人排名
SociatyRanking int64 `protobuf:"varint,8,opt,name=sociatyRanking,proto3" json:"sociatyRanking"` //公会排名
} }
func (x *SociatyBMainResp) Reset() { func (x *SociatyBMainResp) Reset() {
@ -2844,6 +2848,34 @@ func (x *SociatyBMainResp) GetSettlementTime() int64 {
return 0 return 0
} }
func (x *SociatyBMainResp) GetTotal() int64 {
if x != nil {
return x.Total
}
return 0
}
func (x *SociatyBMainResp) GetHighIntegrals() []int64 {
if x != nil {
return x.HighIntegrals
}
return nil
}
func (x *SociatyBMainResp) GetPersonalRanking() int64 {
if x != nil {
return x.PersonalRanking
}
return 0
}
func (x *SociatyBMainResp) GetSociatyRanking() int64 {
if x != nil {
return x.SociatyRanking
}
return 0
}
// 公会BOSS 布阵 // 公会BOSS 布阵
type SociatyBFormationReq struct { type SociatyBFormationReq struct {
state protoimpl.MessageState state protoimpl.MessageState
@ -3855,7 +3887,7 @@ var file_sociaty_sociaty_msg_proto_rawDesc = []byte{
0x03, 0x75, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x49, 0x03, 0x75, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x49,
0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79,
0x49, 0x64, 0x22, 0x11, 0x0a, 0x0f, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x4d, 0x61, 0x49, 0x64, 0x22, 0x11, 0x0a, 0x0f, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x4d, 0x61,
0x69, 0x6e, 0x52, 0x65, 0x71, 0x22, 0xea, 0x01, 0x0a, 0x10, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x22, 0xf8, 0x02, 0x0a, 0x10, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74,
0x79, 0x42, 0x4d, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x32, 0x0a, 0x05, 0x74, 0x65, 0x79, 0x42, 0x4d, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x32, 0x0a, 0x05, 0x74, 0x65,
0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x53, 0x6f, 0x63, 0x69,
0x61, 0x74, 0x79, 0x42, 0x4d, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x2e, 0x54, 0x65, 0x61, 0x61, 0x74, 0x79, 0x42, 0x4d, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x2e, 0x54, 0x65, 0x61,
@ -3865,98 +3897,107 @@ var file_sociaty_sociaty_msg_proto_rawDesc = []byte{
0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65,
0x12, 0x26, 0x0a, 0x0e, 0x73, 0x65, 0x74, 0x74, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x54, 0x69, 0x12, 0x26, 0x0a, 0x0e, 0x73, 0x65, 0x74, 0x74, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x54, 0x69,
0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x73, 0x65, 0x74, 0x74, 0x6c, 0x65, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x73, 0x65, 0x74, 0x74, 0x6c, 0x65,
0x6d, 0x65, 0x6e, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x1a, 0x48, 0x0a, 0x0a, 0x54, 0x65, 0x61, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61,
0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x24,
0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x24, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x0a, 0x0d, 0x68, 0x69, 0x67, 0x68, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x73, 0x18,
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x06, 0x20, 0x03, 0x28, 0x03, 0x52, 0x0d, 0x68, 0x69, 0x67, 0x68, 0x49, 0x6e, 0x74, 0x65, 0x67,
0x6e, 0x67, 0x65, 0x54, 0x65, 0x61, 0x6d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x72, 0x61, 0x6c, 0x73, 0x12, 0x28, 0x0a, 0x0f, 0x70, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x61, 0x6c,
0x38, 0x01, 0x22, 0xb6, 0x01, 0x0a, 0x14, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x46, 0x52, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x70,
0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x61, 0x6c, 0x52, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x12, 0x26,
0x0a, 0x0e, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x52, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67,
0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x52,
0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x1a, 0x48, 0x0a, 0x0a, 0x54, 0x65, 0x61, 0x6d, 0x73, 0x45,
0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28,
0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x24, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18,
0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67,
0x65, 0x54, 0x65, 0x61, 0x6d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01,
0x22, 0xb6, 0x01, 0x0a, 0x14, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x46, 0x6f, 0x72,
0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x6f, 0x63,
0x69, 0x61, 0x74, 0x79, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x6f,
0x63, 0x69, 0x61, 0x74, 0x79, 0x49, 0x64, 0x12, 0x36, 0x0a, 0x05, 0x74, 0x65, 0x61, 0x6d, 0x73,
0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79,
0x42, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x2e, 0x54, 0x65,
0x61, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x74, 0x65, 0x61, 0x6d, 0x73, 0x1a,
0x48, 0x0a, 0x0a, 0x54, 0x65, 0x61, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a,
0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12,
0x24, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e,
0x2e, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x54, 0x65, 0x61, 0x6d, 0x52, 0x05,
0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x47, 0x0a, 0x15, 0x53, 0x6f, 0x63,
0x69, 0x61, 0x74, 0x79, 0x42, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65,
0x73, 0x70, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x49, 0x64, 0x18,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x49, 0x64,
0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75,
0x69, 0x64, 0x22, 0x39, 0x0a, 0x19, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x43, 0x68,
0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x71, 0x12,
0x1c, 0x0a, 0x09, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01,
0x28, 0x09, 0x52, 0x09, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x49, 0x64, 0x22, 0x4c, 0x0a,
0x1a, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e,
0x67, 0x65, 0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1c, 0x0a, 0x09, 0x73,
0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09,
0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x49, 0x64, 0x12, 0x36, 0x0a, 0x05, 0x74, 0x65, 0x61, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64,
0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x22, 0x64, 0x0a, 0x1a, 0x53,
0x74, 0x79, 0x42, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x2e, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65,
0x54, 0x65, 0x61, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x74, 0x65, 0x61, 0x6d, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x52, 0x65, 0x71, 0x12, 0x1f, 0x0a, 0x05, 0x70, 0x74, 0x79,
0x73, 0x1a, 0x48, 0x0a, 0x0a, 0x54, 0x65, 0x61, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x09, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x54,
0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x70, 0x65, 0x52, 0x05, 0x70, 0x74, 0x79, 0x70, 0x65, 0x12, 0x25, 0x0a, 0x06, 0x72, 0x65,
0x79, 0x12, 0x24, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x42, 0x61, 0x74,
0x32, 0x0e, 0x2e, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x54, 0x65, 0x61, 0x6d, 0x74, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x06, 0x72, 0x65, 0x70, 0x6f, 0x72,
0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x47, 0x0a, 0x15, 0x53, 0x74, 0x22, 0x39, 0x0a, 0x1b, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x43, 0x68, 0x61,
0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70,
0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01,
0x28, 0x03, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x22, 0x2e, 0x0a, 0x18,
0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x52, 0x65, 0x63, 0x6f, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x61, 0x74, 0x65,
0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x61, 0x74, 0x65, 0x22, 0xa2, 0x01, 0x0a,
0x19, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x52, 0x65, 0x63, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x12, 0x3b, 0x0a, 0x05, 0x74, 0x65,
0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x53, 0x6f, 0x63, 0x69,
0x61, 0x74, 0x79, 0x42, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x63,
0x6f, 0x52, 0x65, 0x73, 0x70, 0x2e, 0x54, 0x65, 0x61, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79,
0x52, 0x05, 0x74, 0x65, 0x61, 0x6d, 0x73, 0x1a, 0x48, 0x0a, 0x0a, 0x54, 0x65, 0x61, 0x6d, 0x73,
0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01,
0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x24, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e,
0x67, 0x65, 0x54, 0x65, 0x61, 0x6d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38,
0x01, 0x22, 0x4a, 0x0a, 0x12, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x52, 0x65, 0x63,
0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x6f, 0x63, 0x69, 0x61,
0x74, 0x79, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x6f, 0x63, 0x69,
0x61, 0x74, 0x79, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18,
0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x22, 0x4b, 0x0a,
0x13, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65,
0x52, 0x65, 0x73, 0x70, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x49, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x49,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79,
0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01,
0x03, 0x75, 0x69, 0x64, 0x22, 0x39, 0x0a, 0x19, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x28, 0x05, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x22, 0x2d, 0x0a, 0x0f, 0x53, 0x6f,
0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x52, 0x61, 0x6e, 0x6b, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a,
0x71, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x49, 0x64, 0x18, 0x01, 0x08, 0x72, 0x61, 0x6e, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52,
0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x49, 0x64, 0x22, 0x08, 0x72, 0x61, 0x6e, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x22, 0xa1, 0x01, 0x0a, 0x0f, 0x53, 0x6f,
0x4c, 0x0a, 0x1a, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x63, 0x69, 0x61, 0x74, 0x79, 0x52, 0x61, 0x6e, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a,
0x65, 0x6e, 0x67, 0x65, 0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1c, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d,
0x09, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x65, 0x61, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
0x52, 0x09, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x04, 0x68, 0x65, 0x61, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x03, 0x20, 0x01, 0x28,
0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x22, 0x64, 0x0a, 0x05, 0x52, 0x02, 0x6c, 0x76, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79,
0x1a, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x6f, 0x63, 0x69,
0x67, 0x65, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x52, 0x65, 0x71, 0x12, 0x1f, 0x0a, 0x05, 0x70, 0x61, 0x74, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x61, 0x6e, 0x6b, 0x69,
0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x09, 0x2e, 0x50, 0x6c, 0x61, 0x6e, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e,
0x79, 0x54, 0x79, 0x70, 0x65, 0x52, 0x05, 0x70, 0x74, 0x79, 0x70, 0x65, 0x12, 0x25, 0x0a, 0x06, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x18, 0x06, 0x20,
0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x42, 0x01, 0x28, 0x03, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x22, 0x38, 0x0a,
0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x06, 0x72, 0x65, 0x70, 0x10, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x52, 0x61, 0x6e, 0x6b, 0x52, 0x65, 0x73,
0x6f, 0x72, 0x74, 0x22, 0x39, 0x0a, 0x1b, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x43, 0x70, 0x12, 0x24, 0x0a, 0x04, 0x72, 0x61, 0x6e, 0x6b, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x52, 0x65, 0x10, 0x2e, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x52, 0x61, 0x6e, 0x6b, 0x49, 0x6e, 0x66,
0x73, 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x18, 0x01, 0x6f, 0x52, 0x04, 0x72, 0x61, 0x6e, 0x6b, 0x22, 0x46, 0x0a, 0x0d, 0x53, 0x6f, 0x63, 0x69, 0x61,
0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x22, 0x2e, 0x74, 0x79, 0x42, 0x75, 0x79, 0x52, 0x65, 0x71, 0x12, 0x1d, 0x0a, 0x03, 0x61, 0x74, 0x6e, 0x18,
0x0a, 0x18, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x41, 0x73, 0x73, 0x65,
0x69, 0x6f, 0x6e, 0x52, 0x65, 0x63, 0x6f, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x61, 0x74, 0x73, 0x52, 0x03, 0x61, 0x74, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x75, 0x79, 0x4e, 0x75,
0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x61, 0x74, 0x65, 0x22, 0xa2, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x62, 0x75, 0x79, 0x4e, 0x75, 0x6d, 0x22,
0x01, 0x0a, 0x19, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x22, 0x0a, 0x0e, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x75, 0x79, 0x52, 0x65, 0x73,
0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x63, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x12, 0x3b, 0x0a, 0x05, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03,
0x74, 0x65, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x53, 0x6f, 0x75, 0x69, 0x64, 0x2a, 0x42, 0x0a, 0x11, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x4c, 0x69,
0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x73, 0x74, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x4c, 0x4c, 0x10,
0x65, 0x63, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x2e, 0x54, 0x65, 0x61, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07,
0x72, 0x79, 0x52, 0x05, 0x74, 0x65, 0x61, 0x6d, 0x73, 0x1a, 0x48, 0x0a, 0x0a, 0x54, 0x65, 0x61, 0x4e, 0x4f, 0x41, 0x50, 0x50, 0x4c, 0x59, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x41, 0x50, 0x50,
0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x4c, 0x59, 0x49, 0x4e, 0x47, 0x10, 0x03, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62,
0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x24, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x43, 0x68, 0x61, 0x6c, 0x6c,
0x65, 0x6e, 0x67, 0x65, 0x54, 0x65, 0x61, 0x6d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a,
0x02, 0x38, 0x01, 0x22, 0x4a, 0x0a, 0x12, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x52,
0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x6f, 0x63,
0x69, 0x61, 0x74, 0x79, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x6f,
0x63, 0x69, 0x61, 0x74, 0x79, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49,
0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x22,
0x4b, 0x0a, 0x13, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x52, 0x65, 0x63, 0x65, 0x69,
0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74,
0x79, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x6f, 0x63, 0x69, 0x61,
0x74, 0x79, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x02,
0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x22, 0x2d, 0x0a, 0x0f,
0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x52, 0x61, 0x6e, 0x6b, 0x52, 0x65, 0x71, 0x12,
0x1a, 0x0a, 0x08, 0x72, 0x61, 0x6e, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
0x05, 0x52, 0x08, 0x72, 0x61, 0x6e, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x22, 0xa1, 0x01, 0x0a, 0x0f,
0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x52, 0x61, 0x6e, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12,
0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e,
0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x65, 0x61, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28,
0x09, 0x52, 0x04, 0x68, 0x65, 0x61, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x03, 0x20,
0x01, 0x28, 0x05, 0x52, 0x02, 0x6c, 0x76, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x6f, 0x63, 0x69, 0x61,
0x74, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x6f,
0x63, 0x69, 0x61, 0x74, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x61, 0x6e,
0x6b, 0x69, 0x6e, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x72, 0x61, 0x6e, 0x6b,
0x69, 0x6e, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x18,
0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x22,
0x38, 0x0a, 0x10, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x52, 0x61, 0x6e, 0x6b, 0x52,
0x65, 0x73, 0x70, 0x12, 0x24, 0x0a, 0x04, 0x72, 0x61, 0x6e, 0x6b, 0x18, 0x01, 0x20, 0x03, 0x28,
0x0b, 0x32, 0x10, 0x2e, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x52, 0x61, 0x6e, 0x6b, 0x49,
0x6e, 0x66, 0x6f, 0x52, 0x04, 0x72, 0x61, 0x6e, 0x6b, 0x22, 0x46, 0x0a, 0x0d, 0x53, 0x6f, 0x63,
0x69, 0x61, 0x74, 0x79, 0x42, 0x75, 0x79, 0x52, 0x65, 0x71, 0x12, 0x1d, 0x0a, 0x03, 0x61, 0x74,
0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x41, 0x73,
0x73, 0x65, 0x74, 0x73, 0x52, 0x03, 0x61, 0x74, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x75, 0x79,
0x4e, 0x75, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x62, 0x75, 0x79, 0x4e, 0x75,
0x6d, 0x22, 0x22, 0x0a, 0x0e, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x75, 0x79, 0x52,
0x65, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x03, 0x75, 0x69, 0x64, 0x2a, 0x42, 0x0a, 0x11, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79,
0x4c, 0x69, 0x73, 0x74, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x4c,
0x4c, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x10, 0x01, 0x12, 0x0b,
0x0a, 0x07, 0x4e, 0x4f, 0x41, 0x50, 0x50, 0x4c, 0x59, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x41,
0x50, 0x50, 0x4c, 0x59, 0x49, 0x4e, 0x47, 0x10, 0x03, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70,
0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (

View File

@ -6,12 +6,14 @@ import (
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/lego/core" "go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/mgo" "go_dreamfactory/lego/sys/mgo"
"go_dreamfactory/lego/sys/redis" r "go_dreamfactory/lego/sys/redis"
"go_dreamfactory/pb" "go_dreamfactory/pb"
"math/rand" "math/rand"
"sync" "sync"
"testing" "testing"
"github.com/go-redis/redis/v8"
"go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/bson/primitive" "go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo"
@ -86,11 +88,11 @@ func Test_2D(t *testing.T) {
//测试api_getlist //测试api_getlist
func Test_Json_RTask(t *testing.T) { func Test_Json_RTask(t *testing.T) {
if sys, err := redis.NewSys( if sys, err := r.NewSys(
redis.SetRedisType(redis.Redis_Single), r.SetRedisType(r.Redis_Single),
redis.SetRedis_Single_Addr("10.0.0.9:10011"), r.SetRedis_Single_Addr("10.0.0.9:10011"),
redis.SetRedis_Single_Password("li13451234"), r.SetRedis_Single_Password("li13451234"),
redis.SetRedis_Single_DB(3), r.SetRedis_Single_DB(3),
); err != nil { ); err != nil {
fmt.Printf("err:%v", err) fmt.Printf("err:%v", err)
return return
@ -127,24 +129,29 @@ func Test_Json_RTask(t *testing.T) {
} }
func TestRa(t *testing.T) { func TestRa(t *testing.T) {
if sys, err := redis.NewSys( if sys, err := r.NewSys(
redis.SetRedisType(redis.Redis_Single), r.SetRedisType(r.Redis_Single),
redis.SetRedis_Single_Addr("10.0.0.9:10011"), r.SetRedis_Single_Addr("10.0.0.9:10011"),
redis.SetRedis_Single_Password("li13451234"), r.SetRedis_Single_Password("li13451234"),
redis.SetRedis_Single_DB(15), r.SetRedis_Single_DB(15),
); err != nil { ); err != nil {
fmt.Printf("err:%v", err) fmt.Printf("err:%v", err)
return return
} else { } else {
s, err2 := sys.ZRevRange("sociatybsoss", 0, 10).Result() s, err2 := sys.ZRevRange("sociatyrank", 0, 10).Result()
if err2 != nil { if err2 != nil {
t.Fatal(err2) t.Fatal(err2)
} }
m := &redis.Z{Score: float64(1), Member: "dd"}
sys.ZAdd("sociatyrank", m)
sys.ZIncrBy("sociatyrank", 10, "a100aa")
sys.ZIncrBy("sociatyrank", 10, "a100ab")
for _, v := range s { for _, v := range s {
fmt.Println(v) fmt.Println(v)
score, _ := sys.ZScore("sociatybsoss", v) score, _ := sys.ZScore("sociatyrank", v)
ranking, _ := sys.ZRevRank("sociatybsoss", v) ranking, _ := sys.ZRevRank("sociatyrank", v)
fmt.Printf("%d %v - %d \n", (ranking + 1), v, int64(score)) fmt.Printf("%d %v - %d \n", (ranking + 1), v, int64(score))
} }