公会红点

This commit is contained in:
wh_zcy 2022-11-11 15:58:08 +08:00
parent 9870184e47
commit 662f332bc0
5 changed files with 59 additions and 1 deletions

View File

@ -235,6 +235,8 @@ const ( //Rpc
// 赛季塔计算邮件奖励
Rpc_ModuleSeasonPagodaReward core.Rpc_Key = "Rpc_ModuleSeasonPagodaReward"
// 公会信息
Rpc_ModuleSociaty core.Rpc_Key = "Rpc_ModuleSociaty"
)
//事件类型定义处

View File

@ -232,6 +232,8 @@ type (
MembersByUid(uid string) (list []*pb.SociatyMemberInfo)
// 获取公会成员
MembersBySociatyId(sociatyId string) (list []*pb.SociatyMemberInfo)
//红点
Reddot(uid string, rid ...ReddotType) map[ReddotType]bool
}
//星座图
IHoroscope interface {

View File

@ -32,6 +32,10 @@ func (this *apiComp) Get(session comm.IUserSession, req *pb.ReddotGetReq) (code
for k, v := range this.module.ModuleTask.Reddot(session.GetUserId(), comm.Reddot2) {
reddot[int32(k)] = v
}
case int32(comm.Reddot3):
for k, v := range this.module.ModuleSociaty.Reddot(session.GetUserId(), comm.Reddot3) {
reddot[int32(k)] = v
}
case int32(comm.Reddot4):
for k, v := range this.module.ModuleTask.Reddot(session.GetUserId(), comm.Reddot2) {
reddot[int32(k)] = v

View File

@ -191,10 +191,30 @@ func (this *ModelSociaty) isDismiss(sociaty *pb.DBSociaty) bool {
// 获取玩家所在的公会
func (this *ModelSociaty) getUserSociaty(uid string) (sociaty *pb.DBSociaty) {
userEx, err := this.moduleSociaty.ModuleUser.GetRemoteUserExpand(uid)
var (
userEx *pb.DBUserExpand
err error
)
if this.moduleSociaty.IsCross() {
userEx, err = this.moduleSociaty.ModuleUser.GetRemoteUserExpand(uid)
} else {
userEx, err = this.moduleSociaty.ModuleUser.GetUserExpand(uid)
sociaty = &pb.DBSociaty{}
if err = this.moduleSociaty.service.AcrossClusterRpcCall(
context.Background(),
this.moduleSociaty.GetCrossTag(),
comm.Service_Worker,
string(comm.Rpc_ModuleFriendUseAssitHero),
pb.RPCGeneralReqA1{Param1: userEx.SociatyId},
sociaty); err != nil {
this.moduleSociaty.Errorln(err)
}
}
if err != nil {
log.Errorf("GetUserExpand uid:%v err:%v", uid, err)
return
}
if userEx.SociatyId != "" {
sociaty = this.getSociaty(userEx.SociatyId)
if sociaty.Id != "" {

View File

@ -1,9 +1,11 @@
package sociaty
import (
"context"
"go_dreamfactory/comm"
"go_dreamfactory/lego/base"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
"go_dreamfactory/sys/configure"
@ -45,10 +47,12 @@ func (this *Sociaty) OnInstallComp() {
func (this *Sociaty) Start() (err error) {
err = this.ModuleBase.Start()
this.service.RegisterFunctionName(string(comm.Rpc_ModuleSociaty), this.RpcGetSociaty)
return
}
// 会长弹劾处理
// Deprecated
func (this *Sociaty) ProcessAccuse(uid, sociatyId string) {
ggd := this.configure.GetGlobalConf()
t := ggd.GuildImpeachmentCountDown
@ -86,3 +90,29 @@ func (this *Sociaty) MembersBySociatyId(sociatyId string) (list []*pb.SociatyMem
sociaty := this.modelSociaty.getSociaty(sociatyId)
return this.modelSociaty.members(sociaty)
}
//公会
func (this *Sociaty) Reddot(uid string, rid ...comm.ReddotType) (reddot map[comm.ReddotType]bool) {
reddot = make(map[comm.ReddotType]bool)
sociaty := this.modelSociaty.getUserSociaty(uid)
if sociaty == nil || sociaty.Id == "" {
reddot[comm.Reddot3] = false
return
}
for _, v := range rid {
switch v {
case comm.Reddot3:
if ok := this.modelSociaty.IsSign(uid, sociaty); !ok {
reddot[comm.Reddot3] = true
}
}
}
return
}
// 跨服获取公会
func (this *Sociaty) RpcGetSociaty(ctx context.Context, req *pb.RPCGeneralReqA1, reply *pb.DBSociaty) error {
this.Debug("Rpc_ModuleSociaty", log.Field{Key: "req", Value: req})
reply = this.modelSociaty.getSociaty(req.Param1)
return nil
}