This commit is contained in:
meixiongfeng 2023-01-14 19:00:42 +08:00
commit a12aa4e77a
32 changed files with 366 additions and 232 deletions

View File

@ -24,10 +24,13 @@ type SociatyBossView struct {
BaseformView BaseformView
itemList common.ItemList itemList common.ItemList
rankItemList common.ItemList //排行榜
heroListFlag bool heroListFlag bool
teamFlag bool teamFlag bool
bossFlag bool bossFlag bool
rankFlag bool
heroList func() heroList func()
rankList func()
sociatyId string sociatyId string
teams map[int32]*pb.ChallengeTeam teams map[int32]*pb.ChallengeTeam
endTimeLabel *widget.Label // 赛季结束时间 endTimeLabel *widget.Label // 赛季结束时间
@ -73,7 +76,8 @@ func (s *SociatyBossView) CreateView(t *model.TestCase) fyne.CanvasObject {
challengestartBtn := widget.NewButton("开始挑战", s.challengestart) challengestartBtn := widget.NewButton("开始挑战", s.challengestart)
challengefinishBtn := widget.NewButton("挑战结束", s.challengefinish) challengefinishBtn := widget.NewButton("挑战结束", s.challengefinish)
ticketBuyBtn := widget.NewButton("挑战券", s.buy) ticketBuyBtn := widget.NewButton("挑战券", s.buy)
btns := container.NewHBox(buzhenBtn, challengestartBtn, challengefinishBtn, ticketBuyBtn) rankBtn := widget.NewButton("排行榜", s.rank)
btns := container.NewHBox(buzhenBtn, challengestartBtn, challengefinishBtn, ticketBuyBtn, rankBtn)
bottomLabels := container.NewHBox( bottomLabels := container.NewHBox(
s.ticketLabel, s.settleTimeLabel, s.endTimeLabel, s.ticketLabel, s.settleTimeLabel, s.endTimeLabel,
) )
@ -343,6 +347,61 @@ func (s *SociatyBossView) buzhen() {
dconf.Show() dconf.Show()
} }
// 排行榜
func (s *SociatyBossView) rank() {
s.rankItemList = *common.NewItemList()
s.rankItemList.ItemList = s.itemList.CreateList()
s.rankList = func() {
if err := service.GetPttService().SendToClient(string(comm.ModuleSociaty), "brank", &pb.SociatyBRankReq{
RankType: 1,
}); err != nil {
logrus.Error(err)
return
}
}
defer s.rankList()
layout := container.NewBorder(nil, nil, nil, nil, s.rankItemList.ItemList)
dconf := dialog.NewCustom("排行榜", "关闭", layout, s.w)
dconf.Resize(fyne.NewSize(800, 500))
dconf.Show()
s.listenRank()
}
func (this *SociatyBossView) listenRank() {
if this.rankFlag {
return
}
this.obs.AddListener(observer.EVENT_REQ_RSP, observer.Listener{
OnNotify: func(d interface{}, args ...interface{}) {
data := d.(*pb.UserMessage)
if !(data.MainType == string(comm.ModuleSociaty) &&
data.SubType == sociaty.SociatySubTypeBrank) {
return
}
rsp := &pb.SociatyBRankResp{}
if !comm.ProtoUnmarshal(data, rsp) {
logrus.Error("unmarshal err")
return
}
for _, v := range rsp.Rank {
item := common.Item{
Text: fmt.Sprintf("%d 昵称:%v 公会:%s Lv:%d 积分:%d",
v.Ranking, v.Name, v.SociatyName, v.Lv, v.Integral),
}
this.itemList.AddItem(item)
}
},
})
this.rankFlag = true
}
func (this *SociatyBossView) HeroDataListener() { func (this *SociatyBossView) HeroDataListener() {
if this.heroListFlag { if this.heroListFlag {
return return

View File

@ -184,7 +184,7 @@ const (
// 公会日志 // 公会日志
TableSociatyLog = "sociatylog" TableSociatyLog = "sociatylog"
// 公会BOSS // 公会BOSS
TableSociatyBoss = "sociatybsoss" TableSociatyBoss = "sociatyboss"
///充值数据表 ///充值数据表
TablePay = "payorder" TablePay = "payorder"

View File

@ -49,7 +49,7 @@ func (this *apiComp) Formation(session comm.IUserSession, req *pb.SociatyBFormat
} }
sociaty := this.module.modelSociaty.getUserSociaty(uid) sociaty := this.module.modelSociaty.getUserSociaty(uid)
if sociaty != nil && sociaty.Id == "" { if sociaty == nil {
code = pb.ErrorCode_SociatyNoFound code = pb.ErrorCode_SociatyNoFound
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid}) this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
return return

View File

@ -21,7 +21,7 @@ func (this *apiComp) Accuse(session comm.IUserSession, req *pb.SociatyAccuseReq)
} }
uid := session.GetUserId() uid := session.GetUserId()
sociaty := this.module.modelSociaty.getUserSociaty(uid) sociaty := this.module.modelSociaty.getUserSociaty(uid)
if sociaty != nil && sociaty.Id == "" { if sociaty == nil {
code = pb.ErrorCode_SociatyNoFound code = pb.ErrorCode_SociatyNoFound
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid}) this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
return return

View File

@ -17,7 +17,7 @@ func (this *apiComp) ActivitylistCheck(session comm.IUserSession, req *pb.Sociat
func (this *apiComp) Activitylist(session comm.IUserSession, req *pb.SociatyActivityListReq) (code pb.ErrorCode, data proto.Message) { func (this *apiComp) Activitylist(session comm.IUserSession, req *pb.SociatyActivityListReq) (code pb.ErrorCode, data proto.Message) {
uid := session.GetUserId() uid := session.GetUserId()
sociaty := this.module.modelSociaty.getUserSociaty(uid) sociaty := this.module.modelSociaty.getUserSociaty(uid)
if sociaty != nil && sociaty.Id == "" { if sociaty == nil {
code = pb.ErrorCode_SociatyNoFound code = pb.ErrorCode_SociatyNoFound
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid}) this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
return return

View File

@ -23,7 +23,7 @@ func (this *apiComp) Activityreceive(session comm.IUserSession, req *pb.SociatyA
} }
uid := session.GetUserId() uid := session.GetUserId()
sociaty := this.module.modelSociaty.getUserSociaty(uid) sociaty := this.module.modelSociaty.getUserSociaty(uid)
if sociaty.Id == "" { if sociaty == nil {
code = pb.ErrorCode_SociatyNoFound code = pb.ErrorCode_SociatyNoFound
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid}) this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
return return

View File

@ -25,7 +25,7 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.SociatyAgreeReq) (
} }
uid := session.GetUserId() uid := session.GetUserId()
sociaty := this.module.modelSociaty.getUserSociaty(uid) sociaty := this.module.modelSociaty.getUserSociaty(uid)
if sociaty != nil && sociaty.Id == "" { if sociaty == nil {
code = pb.ErrorCode_SociatyNoFound code = pb.ErrorCode_SociatyNoFound
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid}) this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
return return

View File

@ -31,7 +31,7 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.SociatyApplyReq) (
uid := session.GetUserId() uid := session.GetUserId()
sociaty := this.module.modelSociaty.getSociaty(req.SociatyId) sociaty := this.module.modelSociaty.getSociaty(req.SociatyId)
if sociaty != nil && sociaty.Id == "" { if sociaty == nil {
code = pb.ErrorCode_SociatyNoFound code = pb.ErrorCode_SociatyNoFound
this.module.Error("公会未找到", log.Field{Key: "uid", Value: uid}, log.Field{Key: "sociatyId", Value: req.SociatyId}) this.module.Error("公会未找到", log.Field{Key: "uid", Value: uid}, log.Field{Key: "sociatyId", Value: req.SociatyId})
return return

View File

@ -24,7 +24,7 @@ func (this *apiComp) ApplyList(session comm.IUserSession, req *pb.SociatyApplyLi
} }
uid := session.GetUserId() uid := session.GetUserId()
sociaty := this.module.modelSociaty.getSociaty(req.SociatyId) sociaty := this.module.modelSociaty.getSociaty(req.SociatyId)
if sociaty != nil && sociaty.Id == "" { if sociaty == nil {
code = pb.ErrorCode_SociatyNoFound code = pb.ErrorCode_SociatyNoFound
this.module.Error("公会未找到", this.module.Error("公会未找到",
log.Field{Key: "uid", Value: uid}, log.Field{Key: "uid", Value: uid},

View File

@ -31,7 +31,7 @@ func (this *apiComp) Assign(session comm.IUserSession, req *pb.SociatyAssignReq)
} }
sociaty := this.module.modelSociaty.getUserSociaty(uid) sociaty := this.module.modelSociaty.getUserSociaty(uid)
if sociaty != nil && sociaty.Id == "" { if sociaty == nil {
code = pb.ErrorCode_SociatyNoFound code = pb.ErrorCode_SociatyNoFound
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid}) this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
return return

View File

@ -36,22 +36,20 @@ func (this *apiComp) Bossmain(session comm.IUserSession, req *pb.SociatyBMainReq
Ticket: userEx.SociatyTicket, Ticket: userEx.SociatyTicket,
} }
// 未开始 // 未参赛(恢复挑战券)
if !this.module.modelSociatyBoss.sportsIsStarted() { if !this.module.modelSociatyBoss.IsSports(uid) {
if userEx.SociatyTicket != ggd.GuildBossInitialNum { userEx.SociatyTicket = ggd.GuildBossInitialNum
userEx.SociatyTicket = ggd.GuildBossInitialNum update := map[string]interface{}{
update := map[string]interface{}{ "sociatyTicket": userEx.SociatyTicket,
"sociatyTicket": userEx.SociatyTicket, }
} if err := this.module.ModuleUser.ChangeUserExpand(uid, update); err != nil {
if err := this.module.ModuleUser.ChangeUserExpand(uid, update); err != nil { code = pb.ErrorCode_DBError
code = pb.ErrorCode_DBError return
return
}
} }
} }
sociaty := this.module.modelSociaty.getUserSociaty(uid) sociaty := this.module.modelSociaty.getUserSociaty(uid)
if sociaty != nil && sociaty.Id == "" { if sociaty == nil {
code = pb.ErrorCode_SociatyNoFound code = pb.ErrorCode_SociatyNoFound
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid}) this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
return return

View File

@ -20,7 +20,7 @@ func (this *apiComp) Brank(session comm.IUserSession, req *pb.SociatyBRankReq) (
} }
uid := session.GetUserId() uid := session.GetUserId()
sociaty := this.module.modelSociaty.getUserSociaty(uid) sociaty := this.module.modelSociaty.getUserSociaty(uid)
if sociaty != nil && sociaty.Id == "" { if sociaty == nil {
code = pb.ErrorCode_SociatyNoFound code = pb.ErrorCode_SociatyNoFound
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid}) this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
return return

View File

@ -28,7 +28,7 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.SociatyBuyReq) (code
} }
uid := session.GetUserId() uid := session.GetUserId()
sociaty := this.module.modelSociaty.getUserSociaty(uid) sociaty := this.module.modelSociaty.getUserSociaty(uid)
if sociaty != nil && sociaty.Id == "" { if sociaty == nil {
code = pb.ErrorCode_SociatyNoFound code = pb.ErrorCode_SociatyNoFound
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid}) this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
return return

View File

@ -19,7 +19,7 @@ func (this *apiComp) Challengefinish(session comm.IUserSession, req *pb.SociatyB
} }
uid := session.GetUserId() uid := session.GetUserId()
sociaty := this.module.modelSociaty.getUserSociaty(uid) sociaty := this.module.modelSociaty.getUserSociaty(uid)
if sociaty != nil && sociaty.Id == "" { if sociaty == nil {
code = pb.ErrorCode_SociatyNoFound code = pb.ErrorCode_SociatyNoFound
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid}) this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
return return

View File

@ -21,7 +21,7 @@ func (this *apiComp) Challengestart(session comm.IUserSession, req *pb.SociatyBC
uid := session.GetUserId() uid := session.GetUserId()
sociaty := this.module.modelSociaty.getUserSociaty(uid) sociaty := this.module.modelSociaty.getUserSociaty(uid)
if sociaty != nil && sociaty.Id == "" { if sociaty == nil {
code = pb.ErrorCode_SociatyNoFound code = pb.ErrorCode_SociatyNoFound
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid}) this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
return return

View File

@ -25,7 +25,7 @@ func (this *apiComp) Discharge(session comm.IUserSession, req *pb.SociatyDischar
} }
uid := session.GetUserId() uid := session.GetUserId()
sociaty := this.module.modelSociaty.getUserSociaty(uid) sociaty := this.module.modelSociaty.getUserSociaty(uid)
if sociaty != nil && sociaty.Id == "" { if sociaty == nil {
code = pb.ErrorCode_SociatyNoFound code = pb.ErrorCode_SociatyNoFound
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid}) this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
return return

View File

@ -25,7 +25,7 @@ func (this *apiComp) Dismiss(session comm.IUserSession, req *pb.SociatyDismissRe
} }
uid := session.GetUserId() uid := session.GetUserId()
sociaty := this.module.modelSociaty.getUserSociaty(uid) sociaty := this.module.modelSociaty.getUserSociaty(uid)
if sociaty != nil && sociaty.Id == "" { if sociaty == nil {
code = pb.ErrorCode_SociatyNoFound code = pb.ErrorCode_SociatyNoFound
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid}) this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
return return

View File

@ -17,7 +17,7 @@ func (this *apiComp) LogCheck(session comm.IUserSession, req *pb.SociatyLogReq)
func (this *apiComp) Log(session comm.IUserSession, req *pb.SociatyLogReq) (code pb.ErrorCode, data proto.Message) { func (this *apiComp) Log(session comm.IUserSession, req *pb.SociatyLogReq) (code pb.ErrorCode, data proto.Message) {
uid := session.GetUserId() uid := session.GetUserId()
sociaty := this.module.modelSociaty.getUserSociaty(uid) sociaty := this.module.modelSociaty.getUserSociaty(uid)
if sociaty != nil && sociaty.Id == "" { if sociaty == nil {
code = pb.ErrorCode_SociatyNoFound code = pb.ErrorCode_SociatyNoFound
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid}) this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
return return

View File

@ -17,7 +17,7 @@ func (this *apiComp) MembersCheck(session comm.IUserSession, req *pb.SociatyMemb
func (this *apiComp) Members(session comm.IUserSession, req *pb.SociatyMembersReq) (code pb.ErrorCode, data proto.Message) { func (this *apiComp) Members(session comm.IUserSession, req *pb.SociatyMembersReq) (code pb.ErrorCode, data proto.Message) {
uid := session.GetUserId() uid := session.GetUserId()
sociaty := this.module.modelSociaty.getUserSociaty(uid) sociaty := this.module.modelSociaty.getUserSociaty(uid)
if sociaty != nil && sociaty.Id == "" { if sociaty == nil {
code = pb.ErrorCode_SociatyNoFound code = pb.ErrorCode_SociatyNoFound
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid}) this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
return return

View File

@ -40,7 +40,7 @@ func (this *apiComp) Mine(session comm.IUserSession, req *pb.SociatyMineReq) (co
// 获取公会 // 获取公会
sociaty := this.module.modelSociaty.getUserSociaty(uid) sociaty := this.module.modelSociaty.getUserSociaty(uid)
if sociaty != nil && sociaty.Id == "" { if sociaty == nil {
code = pb.ErrorCode_SociatyNoFound code = pb.ErrorCode_SociatyNoFound
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid}) this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
return return

View File

@ -18,7 +18,7 @@ func (this *apiComp) QuitCheck(session comm.IUserSession, req *pb.SociatyQuitReq
func (this *apiComp) Quit(session comm.IUserSession, req *pb.SociatyQuitReq) (code pb.ErrorCode, data proto.Message) { func (this *apiComp) Quit(session comm.IUserSession, req *pb.SociatyQuitReq) (code pb.ErrorCode, data proto.Message) {
uid := session.GetUserId() uid := session.GetUserId()
sociaty := this.module.modelSociaty.getUserSociaty(uid) sociaty := this.module.modelSociaty.getUserSociaty(uid)
if sociaty != nil && sociaty.Id == "" { if sociaty == nil {
code = pb.ErrorCode_SociatyNoFound code = pb.ErrorCode_SociatyNoFound
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid}) this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
return return

View File

@ -24,7 +24,7 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.SociatyReceiveRe
} }
uid := session.GetUserId() uid := session.GetUserId()
sociaty := this.module.modelSociaty.getUserSociaty(uid) sociaty := this.module.modelSociaty.getUserSociaty(uid)
if sociaty != nil && sociaty.Id == "" { if sociaty == nil {
code = pb.ErrorCode_SociatyNoFound code = pb.ErrorCode_SociatyNoFound
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid}) this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
return return

View File

@ -24,7 +24,7 @@ func (this *apiComp) Refuse(session comm.IUserSession, req *pb.SociatyRefuseReq)
} }
uid := session.GetUserId() uid := session.GetUserId()
sociaty := this.module.modelSociaty.getUserSociaty(uid) sociaty := this.module.modelSociaty.getUserSociaty(uid)
if sociaty != nil && sociaty.Id == "" { if sociaty == nil {
code = pb.ErrorCode_SociatyNoFound code = pb.ErrorCode_SociatyNoFound
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid}) this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
return return

View File

@ -24,7 +24,7 @@ func (this *apiComp) Search(session comm.IUserSession, req *pb.SociatySearchReq)
rsp := &pb.SociatySearchResp{} rsp := &pb.SociatySearchResp{}
sociaty := this.module.modelSociaty.findByName(req.Name) sociaty := this.module.modelSociaty.findByName(req.Name)
if sociaty != nil && sociaty.Id != "" { if sociaty == nil {
rsp.List = append(rsp.List, sociaty) rsp.List = append(rsp.List, sociaty)
} }

View File

@ -25,7 +25,7 @@ func (this *apiComp) Setting(session comm.IUserSession, req *pb.SociatySettingRe
uid := session.GetUserId() uid := session.GetUserId()
sociaty := this.module.modelSociaty.getUserSociaty(uid) sociaty := this.module.modelSociaty.getUserSociaty(uid)
if sociaty != nil && sociaty.Id == "" { if sociaty == nil {
code = pb.ErrorCode_SociatyNoFound code = pb.ErrorCode_SociatyNoFound
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid}) this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
return return

View File

@ -24,7 +24,7 @@ func (this *apiComp) SettingJob(session comm.IUserSession, req *pb.SociatySettin
uid := session.GetUserId() uid := session.GetUserId()
sociaty := this.module.modelSociaty.getUserSociaty(uid) sociaty := this.module.modelSociaty.getUserSociaty(uid)
if sociaty != nil && sociaty.Id == "" { if sociaty == nil{
code = pb.ErrorCode_SociatyNoFound code = pb.ErrorCode_SociatyNoFound
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid}) this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
return return

View File

@ -20,7 +20,7 @@ func (this *apiComp) Sign(session comm.IUserSession, req *pb.SociatySignReq) (co
uid := session.GetUserId() uid := session.GetUserId()
sociaty := this.module.modelSociaty.getUserSociaty(uid) sociaty := this.module.modelSociaty.getUserSociaty(uid)
if sociaty != nil && sociaty.Id == "" { if sociaty == nil {
code = pb.ErrorCode_SociatyNoFound code = pb.ErrorCode_SociatyNoFound
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid}) this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
return return

View File

@ -17,7 +17,7 @@ func (this *apiComp) TaskListCheck(session comm.IUserSession, req *pb.SociatyTas
func (this *apiComp) TaskList(session comm.IUserSession, req *pb.SociatyTaskListReq) (code pb.ErrorCode, data proto.Message) { func (this *apiComp) TaskList(session comm.IUserSession, req *pb.SociatyTaskListReq) (code pb.ErrorCode, data proto.Message) {
uid := session.GetUserId() uid := session.GetUserId()
sociaty := this.module.modelSociaty.getUserSociaty(uid) sociaty := this.module.modelSociaty.getUserSociaty(uid)
if sociaty.Id == "" { if sociaty == nil {
code = pb.ErrorCode_SociatyNoFound code = pb.ErrorCode_SociatyNoFound
this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid}) this.module.Error("当前玩家所在的公会未找到", log.Field{Key: "uid", Value: uid})
return return

View File

@ -91,9 +91,7 @@ func (this *ModelSociaty) isNameExist(name string) error {
// 公会列表 // 公会列表
func (this *ModelSociaty) list(uid string, filter pb.SociatyListFilter) (list []*pb.DBSociaty) { func (this *ModelSociaty) list(uid string, filter pb.SociatyListFilter) (list []*pb.DBSociaty) {
user := this.module.ModuleUser.GetUser(uid) user := this.module.ModuleUser.GetUser(uid)
// if err != nil {
// return
// }
if user == nil { if user == nil {
return return
} }
@ -169,7 +167,10 @@ func (this *ModelSociaty) getSociaty(sociatyId string) (sociaty *pb.DBSociaty) {
sociaty = &pb.DBSociaty{} sociaty = &pb.DBSociaty{}
if err := this.GetListObj(comm.RDS_EMPTY, sociatyId, sociaty); err != nil { if err := this.GetListObj(comm.RDS_EMPTY, sociatyId, sociaty); err != nil {
log.Error("GetListObj", log.Field{Key: "sociatyId", Value: sociatyId}) log.Error("GetListObj", log.Field{Key: "sociatyId", Value: sociatyId})
return return nil
}
if sociaty.Id == "" {
return nil
} }
return return
} }
@ -202,7 +203,7 @@ func (this *ModelSociaty) getUserSociaty(uid string) (sociaty *pb.DBSociaty) {
} }
if userEx.SociatyId != "" { if userEx.SociatyId != "" {
sociaty = this.getSociaty(userEx.SociatyId) sociaty = this.getSociaty(userEx.SociatyId)
if sociaty.Id != "" { if sociaty != nil {
//验证是否解散 //验证是否解散
if this.isDismiss(sociaty) { if this.isDismiss(sociaty) {
sociaty.Id = "" sociaty.Id = ""
@ -970,5 +971,3 @@ func (s *ModelSociaty) clearSigned(sociaty *pb.DBSociaty) error {
} }
return s.updateSociaty(sociaty.Id, update) return s.updateSociaty(sociaty.Id, update)
} }

View File

@ -2,6 +2,8 @@ package sociaty
import ( import (
"context" "context"
"errors"
"fmt"
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/lego/core" "go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/log" "go_dreamfactory/lego/sys/log"
@ -19,9 +21,9 @@ import (
) )
var ( var (
BOSS_SPORTS = "sports" BOSS_SPORTS = "sports"
BOSS_PLAYERS = "players" BOSS_RANK = "rank"
SPORTS_HOUR = 3 * 24 //赛季周期 SPORTS_HOUR = 3 * 24 //赛季周期
) )
type ModelSociatyBoss struct { type ModelSociatyBoss struct {
@ -40,6 +42,9 @@ func (this *ModelSociatyBoss) Init(service core.IService, module core.IModule, c
// 初始化赛季 // 初始化赛季
func (s *ModelSociatyBoss) initSports() error { func (s *ModelSociatyBoss) initSports() error {
if !s.moduleSociaty.IsCross() {
return nil
}
ticker := time.NewTicker(time.Second) ticker := time.NewTicker(time.Second)
sports := &pb.DBSociatyBossSports{} sports := &pb.DBSociatyBossSports{}
if err := s.Get(BOSS_SPORTS, sports); err != nil { if err := s.Get(BOSS_SPORTS, sports); err != nil {
@ -65,18 +70,19 @@ func (s *ModelSociatyBoss) initSports() error {
s.moduleSociaty.Debugln("更新赛季结算时间:" + utils.FormatStr(sports.SettlementTime, "")) s.moduleSociaty.Debugln("更新赛季结算时间:" + utils.FormatStr(sports.SettlementTime, ""))
} }
if now.Unix() >= sports.EndTime { if now.Unix() >= sports.EndTime {
// 更新下一赛季周期结束时间
sports.EndTime, sports.SettlementTime = s.sportsTime() sports.EndTime, sports.SettlementTime = s.sportsTime()
//归档前赛季数据
s.reset()
// 更新下一赛季周期结束时间
update := map[string]interface{}{ update := map[string]interface{}{
"endTime": sports.EndTime, "endTime": sports.EndTime,
"settlementTime": sports.SettlementTime, "settlementTime": sports.SettlementTime,
"uids": []string{},
} }
if err := s.Change(BOSS_SPORTS, update); err != nil { if err := s.Change(BOSS_SPORTS, update); err != nil {
s.moduleSociaty.Errorln("Failed to change") s.moduleSociaty.Errorln("Failed to change")
return return
} }
//归档前赛季数据、清理前赛季玩家
s.reset()
s.moduleSociaty.Debugln("更新赛季周期时间:" + utils.FormatStr(sports.EndTime, "")) s.moduleSociaty.Debugln("更新赛季周期时间:" + utils.FormatStr(sports.EndTime, ""))
} }
} }
@ -96,11 +102,18 @@ func (s *ModelSociatyBoss) getSociatyBossSports() *pb.DBSociatyBossSports {
return sports return sports
} }
// 更新赛季数据
func (s *ModelSociatyBoss) updateSociatyBossSports(data map[string]interface{}) {
if err := s.Change(BOSS_SPORTS, data); err != nil {
s.moduleSociaty.Error("更新赛季数据", log.Field{Key: "err", Value: err.Error()})
}
}
// 赛季时间 // 赛季时间
func (s *ModelSociatyBoss) sportsTime() (t1, t2 int64) { func (s *ModelSociatyBoss) sportsTime() (t1, t2 int64) {
now := configure.Now() now := configure.Now()
end1 := now.Add(time.Duration(SPORTS_HOUR) * time.Hour) //测试时单位分钟 else Hour end1 := now.Add(time.Duration(SPORTS_HOUR) * time.Hour) //测试时单位分钟 else Hour
h, _ := time.ParseDuration("-1h") //测试时2m else -1h h, _ := time.ParseDuration("-1h") //测试时-2m else -1h
end2 := end1.Add(h) end2 := end1.Add(h)
return end1.Unix(), end2.Unix() return end1.Unix(), end2.Unix()
} }
@ -195,35 +208,89 @@ func (s *ModelSociatyBoss) challengefinish(sociaty *pb.DBSociaty, uid string, re
return nil return nil
} }
sm := s.moduleSociaty.modelSociaty.getMemberInfo(sociaty, uid)
if sm == nil {
s.moduleSociaty.Error("没有该成员", log.Field{Key: "uid", Value: uid}, log.Field{Key: "sociatyId", Value: sociaty.Id})
return comm.NewCustomError(pb.ErrorCode_SociatyNoMember)
}
//保存挑战记录 //保存挑战记录
if err := s.addChallengeRecord(uid, sociaty.Id, &pb.DBSociatyBossRecord{ record := &pb.ChallengeRecord{
Uid: uid, Teams: sm.Teams,
SociatyId: sociaty.Id, Integral: s.transIntegral(report.Harm),
Integral: s.transIntegral(report.Harm), Duration: report.Costtime,
Duration: report.Costtime, Rtime: configure.Now().Unix(),
Rtime: configure.Now().Unix(), }
}); err != nil { if err := s.updateChallengeRecord(uid, sociaty.Id, record); err != nil {
return err return err
} }
s.addSociatyBossUser(uid)
return nil return nil
} }
// 挑战记录 作为阵容推荐的依据; // 添加参赛玩家
func (s *ModelSociatyBoss) addChallengeRecord(uid, sociatyId string, record *pb.DBSociatyBossRecord) error { func (s *ModelSociatyBoss) addSociatyBossUser(uid string) {
if err := s.AddList(uid, sociatyId, record); err != nil { sports := s.getSociatyBossSports()
return err if sports == nil {
return
} }
return s.addUserWithSports(uid, sociatyId) if len(sports.Uids) == 0 {
sports.Uids = append(sports.Uids, uid)
} else {
if _, ok := utils.Findx(sports.Uids, uid); !ok {
sports.Uids = append(sports.Uids, uid)
}
}
update := map[string]interface{}{
"uids": sports.Uids,
}
if err := s.Change(BOSS_SPORTS, update); err != nil {
s.moduleSociaty.Error("添加参赛玩家", log.Field{Key: "err", Value: err.Error()})
}
} }
// 记录参赛的玩家 // 获取玩家赛季挑战记录
func (s *ModelSociatyBoss) addUserWithSports(uid, sociatyId string) error { func (s *ModelSociatyBoss) getChallengeRecord(uid string) *pb.DBSociatyBossRecord {
record := &pb.DBSociatyBossUser{ his := &pb.DBSociatyBossRecord{}
Uid: uid, if err := s.Get(uid, his); err != nil {
SociatyId: sociatyId, return nil
} }
return s.moduleSociaty.modelSociatyBoss.AddList(BOSS_PLAYERS, uid, record) if his.Uid == "" {
return nil
}
return his
}
// 挑战记录 作为阵容推荐的依据;
func (s *ModelSociatyBoss) updateChallengeRecord(uid, sociatyId string, record *pb.ChallengeRecord) error {
his := &pb.DBSociatyBossRecord{}
if err := s.Get(uid, his); err != nil {
if err == rn.RedisNil || err == mongo.ErrNoDocuments {
if err := s.Add(uid, &pb.DBSociatyBossRecord{
Uid: uid,
SociatyId: sociatyId,
Record: []*pb.ChallengeRecord{record},
}); err != nil {
return comm.NewCustomError(pb.ErrorCode_DBError)
}
} else {
return comm.NewCustomError(pb.ErrorCode_DBError)
}
}
//更新挑战记录
his.Record = append(his.Record, record)
update := map[string]interface{}{
"record": his.Record,
}
if err := s.Change(uid, update); err != nil {
return comm.NewCustomError(pb.ErrorCode_DBError)
}
return nil
} }
// 记入排行 // 记入排行
@ -233,7 +300,7 @@ func (s *ModelSociatyBoss) addRank(uid string, integral int64) error {
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(s.TableName, m); cmd != nil { if cmd := pipe.ZAdd(fmt.Sprintf("%s:%s", s.TableName, BOSS_RANK), m); cmd != nil {
_, err := cmd.Result() _, err := cmd.Result()
if err != nil { if err != nil {
return err return err
@ -317,63 +384,68 @@ func (s *ModelSociatyBoss) rank(sociatyName string, rankType int32) (res []*pb.S
} }
} }
} }
return nil return nil
} }
// 公会BOSS重置数据 // 公会BOSS重置数据
func (s *ModelSociatyBoss) reset() error { func (s *ModelSociatyBoss) reset() error {
s.moduleSociaty.Debugln("赛季重置") sports := s.getSociatyBossSports()
if sports == nil {
// 清理前赛季玩家 return errors.New("sociatyboss sports is nil")
var players []*pb.DBSociatyBossUser
if err := s.GetList(BOSS_PLAYERS, &players); err != nil {
return err
}
for _, v := range players {
if err := s.DelListlds(BOSS_PLAYERS, v.Uid); err != nil {
s.moduleSociaty.Error("清理玩家赛事记录", log.Field{Key: "uid", Value: v.Uid}, log.Field{Key: "err", Value: err.Error()})
}
// 归档前赛季数据
update := map[string]interface{}{
"status": 1, //归档
}
if err := s.ChangeList(v.Uid, v.SociatyId, update); err != nil {
s.moduleSociaty.Error("归档玩家赛事记录", log.Field{Key: "uid", Value: v.Uid}, log.Field{Key: "err", Value: err.Error()})
}
} }
// 归档前赛季数据
for _, uid := range sports.Uids {
var record []*pb.DBSociatyBossRecord
_ = s.GetList(uid, &record)
for _, v := range record {
update := map[string]interface{}{
"status": 1, //归档
}
if err := s.Change(BOSS_SPORTS, update); err != nil {
s.moduleSociaty.Error("归档玩家赛事记录", log.Field{Key: "uid", Value: v.Uid}, log.Field{Key: "err", Value: err.Error()})
}
}
}
// 清理排行榜
if err := s.Del(BOSS_RANK); err != nil {
s.moduleSociaty.Error("清理排行榜", log.Field{Key: "err", Value: err.Error()})
}
return nil return nil
} }
// 是否参赛
func (s *ModelSociatyBoss) IsSports(uid string) bool {
sports := s.getSociatyBossSports()
if sports == nil {
return false
}
for _, v := range sports.Uids {
if v == uid {
return true
}
}
return false
}
// 赛季结算 // 赛季结算
func (s *ModelSociatyBoss) settlement() error { func (s *ModelSociatyBoss) settlement() error {
s.moduleSociaty.Debugln("赛季结算") sports := s.getSociatyBossSports()
start := time.Now() if sports == nil {
var players []*pb.DBSociatyBossUser return errors.New("sociatyboss sports is nil")
// 查询所有参赛玩家
if err := s.GetList(BOSS_PLAYERS, &players); err != nil {
return err
} }
// 计算玩家的赛季积分 // 计算玩家的赛季积分
for _, r := range players { for _, uid := range sports.Uids {
s.moduleSociaty.Debugln(r.Uid) cr := s.getChallengeRecord(uid)
var record []*pb.DBSociatyBossRecord
if err := s.GetListObj(r.Uid, r.SociatyId, &record); err != nil {
s.moduleSociaty.Error("查询玩家赛事记录", log.Field{Key: "uid", Value: r.Uid}, log.Field{Key: "err", Value: err.Error()})
continue
}
//排序-倒叙 //排序-倒叙
sort.SliceStable(record, func(i, j int) bool { sort.SliceStable(cr.Record, func(i, j int) bool {
return record[i].Integral > record[j].Integral return cr.Record[i].Integral > cr.Record[j].Integral
}) })
var total int64 //当前赛季总积分 var total int64 //当前赛季总积分
var highScore []int64 //暂存玩家积分 var highScore []int64 //暂存玩家积分
for i, v := range record { for i, v := range cr.Record {
highScore = append(highScore, v.Integral) highScore = append(highScore, v.Integral)
total += v.Integral total += v.Integral
if i > 2 { if i > 2 {
@ -382,19 +454,21 @@ func (s *ModelSociatyBoss) settlement() error {
} }
// 更新玩家赛季信息 // 更新玩家赛季信息
cr.Total = total
cr.Integrals = highScore
update := map[string]interface{}{ update := map[string]interface{}{
"total": total, "total": total,
"integrals": highScore, "integrals": highScore,
} }
if err := s.ChangeList(BOSS_PLAYERS, r.Uid, update); err != nil { if err := s.Change(uid, update); err != nil {
s.moduleSociaty.Error("更新玩家赛事信息", log.Field{Key: "uid", Value: r.Uid}, log.Field{Key: "err", Value: err.Error()}) s.moduleSociaty.Error("更新玩家赛事信息", log.Field{Key: "uid", Value: uid}, log.Field{Key: "err", Value: err.Error()})
continue continue
} }
//将玩家积分加入排行榜 //将玩家积分加入排行榜
s.addRank(r.Uid, total) s.addRank(uid, total)
s.moduleSociaty.Debugln("耗时:", time.Since(start)) s.moduleSociaty.Debug("结算:", log.Field{Key: "uid", Value: uid})
} }
return nil return nil

View File

@ -223,19 +223,18 @@ func (this *User) SearchRmoteUser(nickname string) ([]*pb.DBUser, error) {
//查询用户属性值 例如 金币 经验 //查询用户属性值 例如 金币 经验
func (this *User) QueryAttributeValue(uid string, attr string) (value int64) { func (this *User) QueryAttributeValue(uid string, attr string) (value int64) {
var ( var (
user *pb.DBUser user *pb.DBUser
err error userEx *pb.DBUserExpand
err error
) )
if this.IsCross() {
user, err = this.getRemoteUser(uid) user = this.modelUser.GetUser(uid)
if err != nil { userEx, err = this.GetUserExpand(uid)
return if err != nil {
} return
} else {
user = this.modelUser.GetUser(uid)
} }
if user == nil { if user == nil || userEx == nil {
return return
} }
switch attr { switch attr {
@ -251,6 +250,10 @@ func (this *User) QueryAttributeValue(uid string, attr string) (value int64) {
return user.Diamond return user.Diamond
case comm.ResPs: case comm.ResPs:
return int64(user.Ps) return int64(user.Ps)
case comm.SociatyCoin:
return int64(userEx.Guildcoin)
case comm.ArenaCoin:
return int64(userEx.Arenacoin)
} }
return return
} }
@ -262,7 +265,6 @@ func (this *User) change(session comm.IUserSession, attr string, add int32) (cha
log.Field{Key: "attr", Value: attr}, log.Field{Key: "attr", Value: attr},
log.Field{Key: "add", Value: add}, log.Field{Key: "add", Value: add},
) )
// code = pb.ErrorCode_ReqParameterError
return return
} }
@ -280,7 +282,7 @@ func (this *User) change(session comm.IUserSession, attr string, add int32) (cha
return return
} }
if user == nil { if user == nil || userEx == nil {
code = pb.ErrorCode_UserSessionNobeing code = pb.ErrorCode_UserSessionNobeing
return return
} }

View File

@ -888,8 +888,9 @@ type DBSociatyBossSports struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
EndTime int64 `protobuf:"varint,1,opt,name=endTime,proto3" json:"endTime" bson:"endTime"` //公会BOSS赛季结束时间 EndTime int64 `protobuf:"varint,1,opt,name=endTime,proto3" json:"endTime" bson:"endTime"` //公会BOSS赛季结束时间
SettlementTime int64 `protobuf:"varint,2,opt,name=settlementTime,proto3" json:"settlementTime" bson:"settlementTime"` //赛季结算时间 SettlementTime int64 `protobuf:"varint,2,opt,name=settlementTime,proto3" json:"settlementTime" bson:"settlementTime"` //赛季结算时间
Uids []string `protobuf:"bytes,3,rep,name=uids,proto3" json:"uids" bson:"uids"` //参赛玩家
} }
func (x *DBSociatyBossSports) Reset() { func (x *DBSociatyBossSports) Reset() {
@ -938,20 +939,27 @@ func (x *DBSociatyBossSports) GetSettlementTime() int64 {
return 0 return 0
} }
// 赛季玩家信息 func (x *DBSociatyBossSports) GetUids() []string {
type DBSociatyBossUser struct { if x != nil {
return x.Uids
}
return nil
}
// 玩家每次挑战的记录
type ChallengeRecord struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid" bson:"uid"` Teams map[int32]*ChallengeTeam `protobuf:"bytes,1,rep,name=teams,proto3" json:"teams" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3" bson:"teams"` //挑战队伍
SociatyId string `protobuf:"bytes,2,opt,name=sociatyId,proto3" json:"sociatyId" bson:"sociatyId"` Integral int64 `protobuf:"varint,2,opt,name=integral,proto3" json:"integral" bson:"integral"` //公会BOSS挑战积分
Total int64 `protobuf:"varint,3,opt,name=total,proto3" json:"total" bson:"total"` //赛季总积分 Duration int32 `protobuf:"varint,3,opt,name=duration,proto3" json:"duration" bson:"duration"` //战斗耗时
Integrals []int64 `protobuf:"varint,4,rep,packed,name=integrals,proto3" json:"integrals" bson:"integrals"` //赛季中最高积分 Rtime int64 `protobuf:"varint,4,opt,name=rtime,proto3" json:"rtime" bson:"rtime"` //记录时间
} }
func (x *DBSociatyBossUser) Reset() { func (x *ChallengeRecord) Reset() {
*x = DBSociatyBossUser{} *x = ChallengeRecord{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_sociaty_sociaty_db_proto_msgTypes[12] mi := &file_sociaty_sociaty_db_proto_msgTypes[12]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -959,13 +967,13 @@ func (x *DBSociatyBossUser) Reset() {
} }
} }
func (x *DBSociatyBossUser) String() string { func (x *ChallengeRecord) String() string {
return protoimpl.X.MessageStringOf(x) return protoimpl.X.MessageStringOf(x)
} }
func (*DBSociatyBossUser) ProtoMessage() {} func (*ChallengeRecord) ProtoMessage() {}
func (x *DBSociatyBossUser) ProtoReflect() protoreflect.Message { func (x *ChallengeRecord) ProtoReflect() protoreflect.Message {
mi := &file_sociaty_sociaty_db_proto_msgTypes[12] mi := &file_sociaty_sociaty_db_proto_msgTypes[12]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -977,52 +985,51 @@ func (x *DBSociatyBossUser) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x) return mi.MessageOf(x)
} }
// Deprecated: Use DBSociatyBossUser.ProtoReflect.Descriptor instead. // Deprecated: Use ChallengeRecord.ProtoReflect.Descriptor instead.
func (*DBSociatyBossUser) Descriptor() ([]byte, []int) { func (*ChallengeRecord) Descriptor() ([]byte, []int) {
return file_sociaty_sociaty_db_proto_rawDescGZIP(), []int{12} return file_sociaty_sociaty_db_proto_rawDescGZIP(), []int{12}
} }
func (x *DBSociatyBossUser) GetUid() string { func (x *ChallengeRecord) GetTeams() map[int32]*ChallengeTeam {
if x != nil { if x != nil {
return x.Uid return x.Teams
}
return ""
}
func (x *DBSociatyBossUser) GetSociatyId() string {
if x != nil {
return x.SociatyId
}
return ""
}
func (x *DBSociatyBossUser) GetTotal() int64 {
if x != nil {
return x.Total
}
return 0
}
func (x *DBSociatyBossUser) GetIntegrals() []int64 {
if x != nil {
return x.Integrals
} }
return nil return nil
} }
// 成员公会BOSS历史记录 func (x *ChallengeRecord) GetIntegral() int64 {
if x != nil {
return x.Integral
}
return 0
}
func (x *ChallengeRecord) GetDuration() int32 {
if x != nil {
return x.Duration
}
return 0
}
func (x *ChallengeRecord) GetRtime() int64 {
if x != nil {
return x.Rtime
}
return 0
}
// 成员公会BOSS挑战历史记录
type DBSociatyBossRecord struct { type DBSociatyBossRecord struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
SociatyId string `protobuf:"bytes,1,opt,name=sociatyId,proto3" json:"sociatyId" bson:"sociatyId"` //公会ID Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid" bson:"uid"` //玩家ID
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //玩家ID SociatyId string `protobuf:"bytes,2,opt,name=sociatyId,proto3" json:"sociatyId" bson:"sociatyId"` //公会ID
Integral int64 `protobuf:"varint,3,opt,name=integral,proto3" json:"integral" bson:"integral"` //公会BOSS挑战积分 Record []*ChallengeRecord `protobuf:"bytes,4,rep,name=record,proto3" json:"record" bson:"record"` //赛季挑战记录
Teams map[int32]*ChallengeTeam `protobuf:"bytes,4,rep,name=teams,proto3" json:"teams" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3" bson:"teams"` //挑战队伍 Total int64 `protobuf:"varint,5,opt,name=total,proto3" json:"total" bson:"total"` //赛季总积分(前三积分和)
Duration int32 `protobuf:"varint,5,opt,name=duration,proto3" json:"duration" bson:"duration"` //战斗耗时 Integrals []int64 `protobuf:"varint,6,rep,packed,name=integrals,proto3" json:"integrals" bson:"integrals"` //赛季中最高积分
Rtime int64 `protobuf:"varint,6,opt,name=rtime,proto3" json:"rtime" bson:"rtime"` //记录时间 Status int32 `protobuf:"varint,7,opt,name=status,proto3" json:"status"` //@go_tags(`bson:"status"`)0当前赛季记录 1归档赛季记录
Status int32 `protobuf:"varint,7,opt,name=status,proto3" json:"status"` //@go_tags(`bson:"status"`)0当前赛季记录 1归档赛季记录
} }
func (x *DBSociatyBossRecord) Reset() { func (x *DBSociatyBossRecord) Reset() {
@ -1057,13 +1064,6 @@ func (*DBSociatyBossRecord) Descriptor() ([]byte, []int) {
return file_sociaty_sociaty_db_proto_rawDescGZIP(), []int{13} return file_sociaty_sociaty_db_proto_rawDescGZIP(), []int{13}
} }
func (x *DBSociatyBossRecord) GetSociatyId() string {
if x != nil {
return x.SociatyId
}
return ""
}
func (x *DBSociatyBossRecord) GetUid() string { func (x *DBSociatyBossRecord) GetUid() string {
if x != nil { if x != nil {
return x.Uid return x.Uid
@ -1071,32 +1071,32 @@ func (x *DBSociatyBossRecord) GetUid() string {
return "" return ""
} }
func (x *DBSociatyBossRecord) GetIntegral() int64 { func (x *DBSociatyBossRecord) GetSociatyId() string {
if x != nil { if x != nil {
return x.Integral return x.SociatyId
} }
return 0 return ""
} }
func (x *DBSociatyBossRecord) GetTeams() map[int32]*ChallengeTeam { func (x *DBSociatyBossRecord) GetRecord() []*ChallengeRecord {
if x != nil { if x != nil {
return x.Teams return x.Record
} }
return nil return nil
} }
func (x *DBSociatyBossRecord) GetDuration() int32 { func (x *DBSociatyBossRecord) GetTotal() int64 {
if x != nil { if x != nil {
return x.Duration return x.Total
} }
return 0 return 0
} }
func (x *DBSociatyBossRecord) GetRtime() int64 { func (x *DBSociatyBossRecord) GetIntegrals() []int64 {
if x != nil { if x != nil {
return x.Rtime return x.Integrals
} }
return 0 return nil
} }
func (x *DBSociatyBossRecord) GetStatus() int32 { func (x *DBSociatyBossRecord) GetStatus() int32 {
@ -1209,45 +1209,46 @@ var file_sociaty_sociaty_db_proto_rawDesc = []byte{
0x6e, 0x67, 0x65, 0x54, 0x65, 0x61, 0x6d, 0x12, 0x2e, 0x0a, 0x09, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x6e, 0x67, 0x65, 0x54, 0x65, 0x61, 0x6d, 0x12, 0x2e, 0x0a, 0x09, 0x66, 0x6f, 0x72, 0x6d, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x42, 0x61, 0x74,
0x74, 0x6c, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x66, 0x6f, 0x74, 0x6c, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x66, 0x6f,
0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x57, 0x0a, 0x13, 0x44, 0x42, 0x53, 0x6f, 0x63, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x6b, 0x0a, 0x13, 0x44, 0x42, 0x53, 0x6f, 0x63,
0x69, 0x61, 0x74, 0x79, 0x42, 0x6f, 0x73, 0x73, 0x53, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x12, 0x18, 0x69, 0x61, 0x74, 0x79, 0x42, 0x6f, 0x73, 0x73, 0x53, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x12, 0x18,
0x0a, 0x07, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x07, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52,
0x07, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x26, 0x0a, 0x0e, 0x73, 0x65, 0x74, 0x74, 0x07, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x26, 0x0a, 0x0e, 0x73, 0x65, 0x74, 0x74,
0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03,
0x52, 0x0e, 0x73, 0x65, 0x74, 0x74, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x52, 0x0e, 0x73, 0x65, 0x74, 0x74, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x54, 0x69, 0x6d, 0x65,
0x22, 0x77, 0x0a, 0x11, 0x44, 0x42, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x6f, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x69, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04,
0x73, 0x55, 0x73, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x75, 0x69, 0x64, 0x73, 0x22, 0xdc, 0x01, 0x0a, 0x0f, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e,
0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x67, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x31, 0x0a, 0x05, 0x74, 0x65, 0x61, 0x6d,
0x74, 0x79, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x6f, 0x63, 0x69, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65,
0x61, 0x74, 0x79, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x03, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x54, 0x65, 0x61, 0x6d, 0x73, 0x45,
0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x74, 0x65, 0x61, 0x6d, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x69,
0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x69,
0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01,
0x28, 0x03, 0x52, 0x05, 0x72, 0x74, 0x69, 0x6d, 0x65, 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, 0xbb, 0x01, 0x0a, 0x13, 0x44, 0x42, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74,
0x79, 0x42, 0x6f, 0x73, 0x73, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75,
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 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, 0x49, 0x64, 0x12, 0x28, 0x0a, 0x06, 0x72,
0x65, 0x63, 0x6f, 0x72, 0x64, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x43, 0x68,
0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x06, 0x72,
0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x05,
0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x1c, 0x0a, 0x09, 0x69,
0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x03, 0x52, 0x09, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x03, 0x52, 0x09,
0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x73, 0x22, 0xac, 0x02, 0x0a, 0x13, 0x44, 0x42, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61,
0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x6f, 0x73, 0x73, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x74, 0x75, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75,
0x64, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x49, 0x64, 0x18, 0x01, 0x73, 0x2a, 0x50, 0x0a, 0x0a, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x4a, 0x6f, 0x62, 0x12,
0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x49, 0x64, 0x12, 0x09, 0x0a, 0x05, 0x4e, 0x4f, 0x4a, 0x4f, 0x42, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4d, 0x45,
0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x4d, 0x42, 0x45, 0x52, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x44, 0x4d, 0x49, 0x4e, 0x10,
0x64, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x18, 0x03, 0x20, 0x02, 0x12, 0x11, 0x0a, 0x0d, 0x56, 0x49, 0x43, 0x45, 0x50, 0x52, 0x45, 0x53, 0x49, 0x44, 0x45,
0x01, 0x28, 0x03, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x12, 0x35, 0x0a, 0x4e, 0x54, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x50, 0x52, 0x45, 0x53, 0x49, 0x44, 0x45, 0x4e,
0x05, 0x74, 0x65, 0x61, 0x6d, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x44, 0x54, 0x10, 0x04, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x42, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x6f, 0x73, 0x73, 0x52, 0x65, 0x63, 0x6f, 0x74, 0x6f, 0x33,
0x72, 0x64, 0x2e, 0x54, 0x65, 0x61, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x74,
0x65, 0x61, 0x6d, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x12, 0x14, 0x0a, 0x05, 0x72, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52,
0x05, 0x72, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73,
0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 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, 0x2a, 0x50, 0x0a, 0x0a, 0x53, 0x6f, 0x63, 0x69,
0x61, 0x74, 0x79, 0x4a, 0x6f, 0x62, 0x12, 0x09, 0x0a, 0x05, 0x4e, 0x4f, 0x4a, 0x4f, 0x42, 0x10,
0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4d, 0x45, 0x4d, 0x42, 0x45, 0x52, 0x10, 0x01, 0x12, 0x09, 0x0a,
0x05, 0x41, 0x44, 0x4d, 0x49, 0x4e, 0x10, 0x02, 0x12, 0x11, 0x0a, 0x0d, 0x56, 0x49, 0x43, 0x45,
0x50, 0x52, 0x45, 0x53, 0x49, 0x44, 0x45, 0x4e, 0x54, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x50,
0x52, 0x45, 0x53, 0x49, 0x44, 0x45, 0x4e, 0x54, 0x10, 0x04, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b,
0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
@ -1278,10 +1279,10 @@ var file_sociaty_sociaty_db_proto_goTypes = []interface{}{
(*ChallengeTeamInfo)(nil), // 10: ChallengeTeamInfo (*ChallengeTeamInfo)(nil), // 10: ChallengeTeamInfo
(*ChallengeTeam)(nil), // 11: ChallengeTeam (*ChallengeTeam)(nil), // 11: ChallengeTeam
(*DBSociatyBossSports)(nil), // 12: DBSociatyBossSports (*DBSociatyBossSports)(nil), // 12: DBSociatyBossSports
(*DBSociatyBossUser)(nil), // 13: DBSociatyBossUser (*ChallengeRecord)(nil), // 13: ChallengeRecord
(*DBSociatyBossRecord)(nil), // 14: DBSociatyBossRecord (*DBSociatyBossRecord)(nil), // 14: DBSociatyBossRecord
nil, // 15: SociatyMember.TeamsEntry nil, // 15: SociatyMember.TeamsEntry
nil, // 16: DBSociatyBossRecord.TeamsEntry nil, // 16: ChallengeRecord.TeamsEntry
(*BattleFormation)(nil), // 17: BattleFormation (*BattleFormation)(nil), // 17: BattleFormation
} }
var file_sociaty_sociaty_db_proto_depIdxs = []int32{ var file_sociaty_sociaty_db_proto_depIdxs = []int32{
@ -1293,14 +1294,15 @@ var file_sociaty_sociaty_db_proto_depIdxs = []int32{
7, // 5: DBSociatyTask.taskList:type_name -> SociatyTask 7, // 5: DBSociatyTask.taskList:type_name -> SociatyTask
8, // 6: DBSociatyTask.activityList:type_name -> SociatyActivity 8, // 6: DBSociatyTask.activityList:type_name -> SociatyActivity
17, // 7: ChallengeTeam.formation:type_name -> BattleFormation 17, // 7: ChallengeTeam.formation:type_name -> BattleFormation
16, // 8: DBSociatyBossRecord.teams:type_name -> DBSociatyBossRecord.TeamsEntry 16, // 8: ChallengeRecord.teams:type_name -> ChallengeRecord.TeamsEntry
11, // 9: SociatyMember.TeamsEntry.value:type_name -> ChallengeTeam 13, // 9: DBSociatyBossRecord.record:type_name -> ChallengeRecord
11, // 10: DBSociatyBossRecord.TeamsEntry.value:type_name -> ChallengeTeam 11, // 10: SociatyMember.TeamsEntry.value:type_name -> ChallengeTeam
11, // [11:11] is the sub-list for method output_type 11, // 11: ChallengeRecord.TeamsEntry.value:type_name -> ChallengeTeam
11, // [11:11] is the sub-list for method input_type 12, // [12:12] is the sub-list for method output_type
11, // [11:11] is the sub-list for extension type_name 12, // [12:12] is the sub-list for method input_type
11, // [11:11] is the sub-list for extension extendee 12, // [12:12] is the sub-list for extension type_name
0, // [0:11] is the sub-list for field type_name 12, // [12:12] is the sub-list for extension extendee
0, // [0:12] is the sub-list for field type_name
} }
func init() { file_sociaty_sociaty_db_proto_init() } func init() { file_sociaty_sociaty_db_proto_init() }
@ -1455,7 +1457,7 @@ func file_sociaty_sociaty_db_proto_init() {
} }
} }
file_sociaty_sociaty_db_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { file_sociaty_sociaty_db_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DBSociatyBossUser); i { switch v := v.(*ChallengeRecord); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1: