图鉴数据参数优化

This commit is contained in:
meixiongfeng 2023-03-13 10:31:08 +08:00
parent 090dbe1521
commit f1409ff23a
3 changed files with 17 additions and 18 deletions

View File

@ -295,7 +295,7 @@ type (
ModifyHeroFetterData(uid string, obj string, data map[string]interface{}) (code pb.ErrorCode) // 修改羁绊信息 ModifyHeroFetterData(uid string, obj string, data map[string]interface{}) (code pb.ErrorCode) // 修改羁绊信息
QueryHeroFetter(uid string) (data []*pb.DBHeroFetter) // 查询所有的羁绊信息 QueryHeroFetter(uid string) (data []*pb.DBHeroFetter) // 查询所有的羁绊信息
AddHeroFetterData(uid string, heroConfId string) (code pb.ErrorCode) // 创建一条羁绊信息 AddHeroFetterData(uid string, heroConfId string) (code pb.ErrorCode) // 创建一条羁绊信息
SendRpcAddHero(session IUserSession, heroConfId string) (err error) SendRpcAddHero(uid string, heroConfId string, serverTag string) (err error)
} }
//月子秘境 //月子秘境
IMoonFantasy interface { IMoonFantasy interface {

View File

@ -83,13 +83,13 @@ func (this *Hero) createRepeatHero(session comm.IUserSession, heroCfgId string,
) )
hero, bFirst, atno, err = this.modelHero.createHero(session, heroCfgId, num) hero, bFirst, atno, err = this.modelHero.createHero(session, heroCfgId, num)
if err == nil && bFirst { if err == nil && bFirst {
//go func(uid string, heroCfgId string) { // 携程处理 图鉴数据 go func() { // 携程处理 图鉴数据
if db.IsCross() { if db.IsCross() {
this.moduleFetter.SendRpcAddHero(session, heroCfgId) this.moduleFetter.SendRpcAddHero(session.GetUserId(), heroCfgId, session.GetServiecTag())
} else { } else {
this.moduleFetter.AddHeroFetterData(session.GetUserId(), heroCfgId) this.moduleFetter.AddHeroFetterData(session.GetUserId(), heroCfgId)
} }
//}(session.GetUserId(), heroCfgId) }()
// 统计任务 // 统计任务
// 查品质 // 查品质

View File

@ -3,7 +3,6 @@ package library
import ( import (
"context" "context"
"errors" "errors"
"fmt"
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/lego/base" "go_dreamfactory/lego/base"
"go_dreamfactory/lego/core" "go_dreamfactory/lego/core"
@ -155,14 +154,15 @@ func (this *Library) QueryOneHeroFetter(uid string, cid string) *pb.DBHeroFetter
} }
// 发送prc消息到区服处理 // 发送prc消息到区服处理
func (this *Library) SendRpcAddHero(session comm.IUserSession, heroConfId string) (err error) { func (this *Library) SendRpcAddHero(uid string, heroConfId string, serverTag string) (err error) {
if this.IsCross() { if this.IsCross() {
if _, err = this.service.AcrossClusterRpcGo( // 给区服发送rpc消息 if _, err = this.service.AcrossClusterRpcGo( // 给区服发送rpc消息
context.Background(), context.Background(),
session.GetServiecTag(), serverTag,
comm.Service_Worker, comm.Service_Worker,
string(comm.Rpc_ModuleFetter), string(comm.Rpc_ModuleFetter),
pb.RPCGeneralReqA2{Param1: session.GetUserId(), Param2: heroConfId}, pb.RPCGeneralReqA2{Param1: uid, Param2: heroConfId},
nil); err != nil { nil); err != nil {
this.Errorln(err) this.Errorln(err)
} }
@ -253,15 +253,14 @@ func (this *Library) Rpc_ModuleFetter(ctx context.Context, args *pb.RPCGeneralRe
session comm.IUserSession session comm.IUserSession
ok bool ok bool
) )
defer func() {
this.PutUserSession(session) if session, ok = this.GetUserSession(args.Param1); ok {
}()
if session, ok = this.GetUserSession(args.Param1); !ok {
err = fmt.Errorf("目标用户:%s 不在线", args.Param1)
} else {
this.AddHeroFetterData(session.GetUserId(), args.Param2) this.AddHeroFetterData(session.GetUserId(), args.Param2)
session.Push() session.Push()
} else {
this.Debugf("Rpc_ModuleFetter 目标用户:%s 不在线", args.Param1)
} }
this.PutUserSession(session)
return return
} }