创角时创建公会
This commit is contained in:
parent
e56446667e
commit
904b83eacf
@ -96,9 +96,28 @@ func (this *apiComp) Create(session comm.IUserSession, req *pb.UserCreateReq) (c
|
|||||||
//初始化用户设置
|
//初始化用户设置
|
||||||
// this.module.modelSetting.InitSetting(session.GetUserId())
|
// this.module.modelSetting.InitSetting(session.GetUserId())
|
||||||
|
|
||||||
//初始化公会 date3.10
|
go func() {
|
||||||
this.module.CrossCreateSociaty(uid, req.NickName)
|
//初始化公会 date3.10
|
||||||
|
sociaty := this.module.CrossCreateSociaty(uid, req.NickName)
|
||||||
|
if sociaty == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.module.Debugf("公会ID:%v", sociaty.Id)
|
||||||
|
exUpdate := map[string]interface{}{
|
||||||
|
"sociatyId": sociaty.Id,
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := this.module.ModuleUser.ChangeUserExpand(uid, exUpdate); err != nil {
|
||||||
|
code = pb.ErrorCode_DBError
|
||||||
|
this.module.Error("更新玩家公会ID",
|
||||||
|
log.Field{Key: "uid", Value: uid},
|
||||||
|
log.Field{Key: "sociatyId", Value: sociaty.Id},
|
||||||
|
log.Field{Key: "err", Value: err.Error()},
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
}()
|
||||||
if err := session.SendMsg(string(this.module.GetType()), UserSubTypeCreate, &pb.UserCreateResp{IsSucc: true}); err != nil {
|
if err := session.SendMsg(string(this.module.GetType()), UserSubTypeCreate, &pb.UserCreateResp{IsSucc: true}); err != nil {
|
||||||
code = pb.ErrorCode_SystemError
|
code = pb.ErrorCode_SystemError
|
||||||
}
|
}
|
||||||
|
@ -245,21 +245,22 @@ func (this *User) CrossUserSession(uid string) *pb.CacheUser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 跨服创建玩家公会 date 3.10
|
// 跨服创建玩家公会 date 3.10
|
||||||
func (this *User) CrossCreateSociaty(uid, sociatyName string) *pb.EmptyResp {
|
func (this *User) CrossCreateSociaty(uid, sociatyName string) *pb.DBSociaty {
|
||||||
|
sociaty:= &pb.DBSociaty{}
|
||||||
this.service.AcrossClusterRpcCall(context.Background(), this.GetCrossTag(),
|
this.service.AcrossClusterRpcCall(context.Background(), this.GetCrossTag(),
|
||||||
comm.Service_Worker, Rpc_CreateSociaty, &pb.RPCGeneralReqA2{Param1: uid, Param2: sociatyName}, &pb.EmptyResp{})
|
comm.Service_Worker, Rpc_CreateSociaty, &pb.RPCGeneralReqA2{Param1: uid, Param2: sociatyName}, sociaty)
|
||||||
return nil
|
return sociaty
|
||||||
}
|
}
|
||||||
|
|
||||||
// date 3.10
|
// date 3.10
|
||||||
func (this *User) RpcCreateSociaty(ctx context.Context, req *pb.RPCGeneralReqA2, reply *pb.EmptyResp) error {
|
func (this *User) RpcCreateSociaty(ctx context.Context, req *pb.RPCGeneralReqA2, rsp *pb.DBSociaty) error {
|
||||||
conn, err := db.Local()
|
conn, err := db.Local()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
model := db.NewDBModel(comm.TableSociaty, 0, conn)
|
model := db.NewDBModel(comm.TableSociaty, 0, conn)
|
||||||
|
|
||||||
sociaty := &pb.DBSociaty{}
|
sociaty:= &pb.DBSociaty{}
|
||||||
_id := primitive.NewObjectID().Hex()
|
_id := primitive.NewObjectID().Hex()
|
||||||
sociaty.Creater = req.Param1
|
sociaty.Creater = req.Param1
|
||||||
sociaty.Name = req.Param2
|
sociaty.Name = req.Param2
|
||||||
@ -280,6 +281,8 @@ func (this *User) RpcCreateSociaty(ctx context.Context, req *pb.RPCGeneralReqA2,
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rsp.Id = sociaty.Id
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user