From 92ee1d454d5c2413b3826db68b64f4cee9309d14 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Tue, 28 Jun 2022 19:07:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E4=BC=9A=E8=AF=9D=E5=AF=B9?= =?UTF-8?q?=E8=B1=A1=E7=BB=91=E5=AE=9Auid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/usersession.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/comm/usersession.go b/comm/usersession.go index 82fc50420..ddcec3825 100644 --- a/comm/usersession.go +++ b/comm/usersession.go @@ -66,24 +66,28 @@ func (this *UserSession) IsLogin() bool { ///wokerId 用户绑定worker服务id func (this *UserSession) Bind(uid string, wokerId string) (err error) { reply := &pb.RPCMessageReply{} - if err := this.service.RpcCall(context.Background(), fmt.Sprintf("%s/%s", Service_Gateway, this.GatewayServiceId), string(Rpc_GatewayAgentBind), &pb.AgentBuildReq{ + if err = this.service.RpcCall(context.Background(), fmt.Sprintf("%s/%s", Service_Gateway, this.GatewayServiceId), string(Rpc_GatewayAgentBind), &pb.AgentBuildReq{ UserSessionId: this.SessionId, UserId: uid, WorkerId: wokerId, }, reply); err != nil { log.Errorf("Bind UserSession:%s UserId:%s err:%v", this.SessionId, this.UserId, err) + return } + this.UserId = uid return } //解绑uid 注销和切换账号是处理 func (this *UserSession) UnBind() (err error) { reply := &pb.RPCMessageReply{} - if err := this.service.RpcCall(context.Background(), fmt.Sprintf("%s/%s", Service_Gateway, this.GatewayServiceId), string(Rpc_GatewayAgentUnBind), &pb.AgentUnBuildReq{ + if err = this.service.RpcCall(context.Background(), fmt.Sprintf("%s/%s", Service_Gateway, this.GatewayServiceId), string(Rpc_GatewayAgentUnBind), &pb.AgentUnBuildReq{ UserSessionId: this.SessionId, }, reply); err != nil { log.Errorf("UnBuild UserSession:%s UserId:%s err:%v", this.SessionId, this.UserId, err) + return } + this.UserId = "" return }