上传会话对象绑定uid
This commit is contained in:
parent
eec7fd58f3
commit
92ee1d454d
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user