private void LogOutUserByUserId(string userId) { if (!string.IsNullOrWhiteSpace(userId)) { Guid uId = new Guid(userId); try { using (var client = new AccessTokenClient()) { var result = client.RemoveAll(uId, "Setting站点工具登出"); result.ThrowIfException(true); } using (var useraccoutClient = new UserAccountClient()) { var insertLog = useraccoutClient.LogUserAction(new UserLog { Action = UserActionEnum.LogOut, CreatedTime = DateTime.Now, UserId = uId, ChannelIn = nameof(ChannelIn.H5), Content = "Setting站点内手动登出该用户" }); insertLog.ThrowIfException(true); } } catch (Exception ex) { WebLog.LogException(ex); } } }
public JsonResult LogOutUserById(string userId) { bool flag = false; if (!string.IsNullOrWhiteSpace(userId)) { Guid uId = new Guid(userId); try { var cleanTokenResult = 0; using (var client = new AccessTokenClient()) { var result = client.RemoveAll(uId, "Setting站点工具登出"); result.ThrowIfException(true); cleanTokenResult = result.Result; } if (cleanTokenResult >= 0) { flag = true; } using (var useraccoutClient = new UserAccountClient()) { var insertLog = useraccoutClient.LogUserAction(new UserLog { Action = UserActionEnum.LogOut, CreatedTime = DateTime.Now, UserId = uId, ChannelIn = nameof(ChannelIn.H5), Content = "Setting站点内手动登出该用户" }); insertLog.ThrowIfException(true); } } catch (Exception ex) { WebLog.LogException(ex); } } return(Json(flag)); }