更新公会bingo
This commit is contained in:
parent
12400a82d4
commit
1829a454fb
@ -242,6 +242,8 @@ const ( //Rpc
|
|||||||
Rpc_ModuleSeasonPagodaReward core.Rpc_Key = "Rpc_ModuleSeasonPagodaReward"
|
Rpc_ModuleSeasonPagodaReward core.Rpc_Key = "Rpc_ModuleSeasonPagodaReward"
|
||||||
// 公会信息
|
// 公会信息
|
||||||
Rpc_ModuleSociaty core.Rpc_Key = "Rpc_ModuleSociaty"
|
Rpc_ModuleSociaty core.Rpc_Key = "Rpc_ModuleSociaty"
|
||||||
|
// 公会更新
|
||||||
|
Rpc_ModuleSociatyUpdate core.Rpc_Key = "Rpc_ModuleSociatyUpdate"
|
||||||
)
|
)
|
||||||
|
|
||||||
//事件类型定义处
|
//事件类型定义处
|
||||||
|
@ -207,7 +207,7 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorC
|
|||||||
}
|
}
|
||||||
|
|
||||||
module1.(comm.IMoonFantasy).TriggerMF(session, datas[1])
|
module1.(comm.IMoonFantasy).TriggerMF(session, datas[1])
|
||||||
this.Debug("使用bingo命令:uid = %s ", log.Fields{"uid": session.GetUserId(), "0": datas[1]})
|
this.Debug("使用bingo命令", log.Fields{"uid": session.GetUserId(), "0": datas[1]})
|
||||||
} else if len(datas) == 2 && (datas[0] == "arena") { // 设置竞技场用户积分
|
} else if len(datas) == 2 && (datas[0] == "arena") { // 设置竞技场用户积分
|
||||||
module1, err := this.service.GetModule(comm.ModuleArena)
|
module1, err := this.service.GetModule(comm.ModuleArena)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -219,7 +219,7 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorC
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
module1.(comm.IArena).SetUserIntegral(session, int32(num))
|
module1.(comm.IArena).SetUserIntegral(session, int32(num))
|
||||||
this.Debug("使用bingo命令:uid = %s ", log.Fields{"uid": session.GetUserId(), "0": datas[1]})
|
this.Debug("使用bingo命令", log.Fields{"uid": session.GetUserId(), "0": datas[1]})
|
||||||
} else if len(datas) == 2 && (datas[0] == "sociatyexp") { // 设置工会经验
|
} else if len(datas) == 2 && (datas[0] == "sociatyexp") { // 设置工会经验
|
||||||
module1, err := this.service.GetModule(comm.ModuleSociaty)
|
module1, err := this.service.GetModule(comm.ModuleSociaty)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -231,7 +231,7 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorC
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
module1.(comm.ISociaty).BingoSetExp(session, int32(num))
|
module1.(comm.ISociaty).BingoSetExp(session, int32(num))
|
||||||
this.Debug("使用bingo命令:uid = %s ", log.Fields{"uid": session.GetUserId(), "0": datas[1]})
|
this.Debug("使用bingo命令", log.Fields{"uid": session.GetUserId(), "0": datas[1]})
|
||||||
} else if len(datas) == 2 && (datas[0] == "sociatyactivity") { // 设置工会活跃度
|
} else if len(datas) == 2 && (datas[0] == "sociatyactivity") { // 设置工会活跃度
|
||||||
module1, err := this.service.GetModule(comm.ModuleSociaty)
|
module1, err := this.service.GetModule(comm.ModuleSociaty)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -243,7 +243,7 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorC
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
module1.(comm.ISociaty).BingoSetActivity(session, int32(num))
|
module1.(comm.ISociaty).BingoSetActivity(session, int32(num))
|
||||||
this.Debug("使用bingo命令:uid = %s ", log.Fields{"uid": session.GetUserId(), "0": datas[1]})
|
this.Debug("使用bingo命令", log.Fields{"uid": session.GetUserId(), "0": datas[1]})
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -328,9 +328,26 @@ func (this *ModelSociaty) isRight(uid string, sociaty *pb.DBSociaty, jobs ...pb.
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新公会
|
// 更新公会经验
|
||||||
func (this *ModelSociaty) updateSociaty(sociatyId string, update map[string]interface{}) error {
|
func (this *ModelSociaty) updateSociaty(sociatyId string, update map[string]interface{}) error {
|
||||||
return this.ChangeList("", sociatyId, update)
|
if this.moduleSociaty.IsCross() {
|
||||||
|
return this.ChangeList(comm.RDS_EMPTY, sociatyId, update)
|
||||||
|
} else {
|
||||||
|
req := &SociatyUpdateParam{
|
||||||
|
SociatyId: sociatyId,
|
||||||
|
Update: update,
|
||||||
|
}
|
||||||
|
if err := this.moduleSociaty.service.AcrossClusterRpcCall(
|
||||||
|
context.Background(),
|
||||||
|
this.moduleSociaty.GetCrossTag(),
|
||||||
|
comm.Service_Worker,
|
||||||
|
string(comm.Rpc_ModuleSociatyUpdate),
|
||||||
|
req,
|
||||||
|
&pb.EmptyResp{}); err != nil {
|
||||||
|
this.moduleSociaty.Errorln(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// 退出公会
|
// 退出公会
|
||||||
|
@ -59,6 +59,7 @@ func (this *Sociaty) OnInstallComp() {
|
|||||||
func (this *Sociaty) Start() (err error) {
|
func (this *Sociaty) Start() (err error) {
|
||||||
err = this.ModuleBase.Start()
|
err = this.ModuleBase.Start()
|
||||||
this.service.RegisterFunctionName(string(comm.Rpc_ModuleSociaty), this.RpcGetSociaty)
|
this.service.RegisterFunctionName(string(comm.Rpc_ModuleSociaty), this.RpcGetSociaty)
|
||||||
|
this.service.RegisterFunctionName(string(comm.Rpc_ModuleSociatyUpdate), this.RpcUpdateSociaty)
|
||||||
this.globalConf = this.configure.GetGlobalConf()
|
this.globalConf = this.configure.GetGlobalConf()
|
||||||
if this.globalConf == nil {
|
if this.globalConf == nil {
|
||||||
err = errors.New("global config not found")
|
err = errors.New("global config not found")
|
||||||
@ -156,17 +157,66 @@ func (this *Sociaty) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (
|
|||||||
func (this *Sociaty) RpcGetSociaty(ctx context.Context, req *pb.RPCGeneralReqA1, reply *pb.DBSociaty) error {
|
func (this *Sociaty) RpcGetSociaty(ctx context.Context, req *pb.RPCGeneralReqA1, reply *pb.DBSociaty) error {
|
||||||
this.Debug("Rpc_ModuleSociaty", log.Fields{"req": req})
|
this.Debug("Rpc_ModuleSociaty", log.Fields{"req": req})
|
||||||
sociaty := this.modelSociaty.getSociaty(req.Param1)
|
sociaty := this.modelSociaty.getSociaty(req.Param1)
|
||||||
*reply = *sociaty
|
reply.Id = sociaty.Id
|
||||||
log.Debug("跨服公会", log.Fields{"sociaty": reply})
|
reply.Lv = sociaty.Lv
|
||||||
|
reply.Exp = sociaty.Exp
|
||||||
|
reply.Members = sociaty.Members
|
||||||
|
reply.DismissCD = sociaty.DismissCD
|
||||||
|
reply.Name = sociaty.Name
|
||||||
|
reply.Icon = sociaty.Icon
|
||||||
|
reply.Notice = sociaty.Notice
|
||||||
|
reply.DismissTime = sociaty.DismissTime
|
||||||
|
reply.IsApplyCheck = sociaty.IsApplyCheck
|
||||||
|
reply.SignIds = sociaty.SignIds
|
||||||
|
reply.LastSignCount = sociaty.LastSignCount
|
||||||
|
reply.ApplyLv = sociaty.ApplyLv
|
||||||
|
reply.Activity = sociaty.Activity
|
||||||
|
reply.AccuseTime = sociaty.AccuseTime
|
||||||
|
reply.ApplyRecord = sociaty.ApplyRecord
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type SociatyUpdateParam struct {
|
||||||
|
SociatyId string
|
||||||
|
Update map[string]interface{}
|
||||||
|
}
|
||||||
|
|
||||||
|
//跨服更新数据
|
||||||
|
func (this *Sociaty) RpcUpdateSociaty(ctx context.Context, req *SociatyUpdateParam, reply *pb.DBSociaty) error {
|
||||||
|
return this.modelSociaty.ChangeList(comm.RDS_EMPTY, req.SociatyId, req.Update)
|
||||||
|
}
|
||||||
|
|
||||||
// 设置工会经验
|
// 设置工会经验
|
||||||
func (this *Sociaty) BingoSetExp(session comm.IUserSession, exp int32) error {
|
func (this *Sociaty) BingoSetExp(session comm.IUserSession, exp int32) error {
|
||||||
return nil
|
sociaty := this.modelSociaty.getUserSociaty(session.GetUserId())
|
||||||
|
if sociaty == nil || sociaty.Id == "" {
|
||||||
|
log.Warn("未获得公会信息", log.Fields{"uid": session.GetUserId()})
|
||||||
|
return comm.NewCustomError(pb.ErrorCode_SociatyNoFound)
|
||||||
|
}
|
||||||
|
sociaty.Exp += exp
|
||||||
|
update := map[string]interface{}{
|
||||||
|
"exp": sociaty.Exp,
|
||||||
|
}
|
||||||
|
|
||||||
|
err := this.modelSociaty.updateSociaty(sociaty.Id, update)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.modelSociaty.changeLv(sociaty)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置工会经验
|
// 设置工会活跃度
|
||||||
func (this *Sociaty) BingoSetActivity(session comm.IUserSession, activity int32) error {
|
func (this *Sociaty) BingoSetActivity(session comm.IUserSession, activity int32) error {
|
||||||
return nil
|
sociaty := this.modelSociaty.getUserSociaty(session.GetUserId())
|
||||||
|
if sociaty == nil || sociaty.Id == "" {
|
||||||
|
log.Warn("未获得公会信息", log.Fields{"uid": session.GetUserId()})
|
||||||
|
return comm.NewCustomError(pb.ErrorCode_SociatyNoFound)
|
||||||
|
}
|
||||||
|
|
||||||
|
activity += sociaty.Activity
|
||||||
|
update := map[string]interface{}{
|
||||||
|
"activity": activity,
|
||||||
|
}
|
||||||
|
return this.modelSociaty.updateSociaty(sociaty.Id, update)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user