完成各信息查看页面
This commit is contained in:
parent
63c69e8613
commit
11e68fab14
@ -115,5 +115,81 @@ namespace ChatRoomServer.Db
|
||||
TotalCount = (long)totalCountParameter.Value
|
||||
};
|
||||
}
|
||||
|
||||
public async Task<PagedData<MsgLog>> GetMsgLogList(string username, int pagesize, int pageindex)
|
||||
{
|
||||
var sp = "exec usp_MsgLog_GetList @pageindex, @pagesize, @user, @count output";
|
||||
var totalCountParameter = new SqlParameter("count", SqlDbType.BigInt) { Direction = ParameterDirection.Output, Value = 0 };
|
||||
var list = await Database.SqlQuery<MsgLog>(
|
||||
sp,
|
||||
new SqlParameter("pageindex", SqlDbType.Int) { Value = pageindex },
|
||||
new SqlParameter("pagesize", SqlDbType.Int) { Value = pagesize },
|
||||
new SqlParameter("user", SqlDbType.VarChar, 100) { Value = username },
|
||||
totalCountParameter
|
||||
).ToListAsync();
|
||||
|
||||
return new PagedData<MsgLog>()
|
||||
{
|
||||
Data = list,
|
||||
TotalCount = (long)totalCountParameter.Value
|
||||
};
|
||||
}
|
||||
|
||||
public async Task<PagedData<BlockUser>> GetBlockUserList(string username, int pagesize, int pageindex)
|
||||
{
|
||||
var sp = "exec usp_Block_GetList @pageindex, @pagesize, @user, @count output";
|
||||
var totalCountParameter = new SqlParameter("count", SqlDbType.BigInt) { Direction = ParameterDirection.Output, Value = 0 };
|
||||
var list = await Database.SqlQuery<BlockUser>(
|
||||
sp,
|
||||
new SqlParameter("pageindex", SqlDbType.Int) { Value = pageindex },
|
||||
new SqlParameter("pagesize", SqlDbType.Int) { Value = pagesize },
|
||||
new SqlParameter("user", SqlDbType.VarChar, 100) { Value = username },
|
||||
totalCountParameter
|
||||
).ToListAsync();
|
||||
|
||||
return new PagedData<BlockUser>()
|
||||
{
|
||||
Data = list,
|
||||
TotalCount = (long)totalCountParameter.Value
|
||||
};
|
||||
}
|
||||
|
||||
public async Task<PagedData<User>> GetUserList(string username, int pagesize, int pageindex)
|
||||
{
|
||||
var sp = "exec usp_User_GetList @pageindex, @pagesize, @user, @count output";
|
||||
var totalCountParameter = new SqlParameter("count", SqlDbType.BigInt) { Direction = ParameterDirection.Output, Value = 0 };
|
||||
var list = await Database.SqlQuery<User>(
|
||||
sp,
|
||||
new SqlParameter("pageindex", SqlDbType.Int) { Value = pageindex },
|
||||
new SqlParameter("pagesize", SqlDbType.Int) { Value = pagesize },
|
||||
new SqlParameter("user", SqlDbType.VarChar, 100) { Value = username ?? "" },
|
||||
totalCountParameter
|
||||
).ToListAsync();
|
||||
|
||||
return new PagedData<User>()
|
||||
{
|
||||
Data = list,
|
||||
TotalCount = (long)totalCountParameter.Value
|
||||
};
|
||||
}
|
||||
|
||||
public async Task<PagedData<UserConnectLog>> GetConnectionLogList(string username, int pagesize, int pageindex)
|
||||
{
|
||||
var sp = "exec usp_ConnectionLog_GetList @pageindex, @pagesize, @user, @count output";
|
||||
var totalCountParameter = new SqlParameter("count", SqlDbType.BigInt) { Direction = ParameterDirection.Output, Value = 0 };
|
||||
var list = await Database.SqlQuery<UserConnectLog>(
|
||||
sp,
|
||||
new SqlParameter("pageindex", SqlDbType.Int) { Value = pageindex },
|
||||
new SqlParameter("pagesize", SqlDbType.Int) { Value = pagesize },
|
||||
new SqlParameter("user", SqlDbType.VarChar, 100) { Value = username },
|
||||
totalCountParameter
|
||||
).ToListAsync();
|
||||
|
||||
return new PagedData<UserConnectLog>()
|
||||
{
|
||||
Data = list,
|
||||
TotalCount = (long)totalCountParameter.Value
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43,6 +43,8 @@ namespace ChatRoomServer.Db.Entities
|
||||
/// </summary>
|
||||
public int? ElapsedTime { get; set; }
|
||||
|
||||
public string Ip { get; set; }
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -57,6 +59,7 @@ namespace ChatRoomServer.Db.Entities
|
||||
Property(s => s.Id).HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
|
||||
Property(s => s.UserName).HasMaxLength(100).IsRequired();
|
||||
Property(s => s.RoomID).HasMaxLength(100).IsRequired();
|
||||
Property(s => s.Ip).IsRequired();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +94,8 @@ namespace ChatRoomServer.Main
|
||||
{
|
||||
UserName = UserName,
|
||||
ConnectTime = DateTime.Now,
|
||||
RoomID = Id
|
||||
RoomID = Id,
|
||||
Ip = RemoteEndPoint.ToString()
|
||||
};
|
||||
db.UserConnectLogs.Add(ucl);
|
||||
db.SaveChanges();
|
||||
|
@ -7,12 +7,15 @@ using System.Web.Http;
|
||||
|
||||
namespace ChatRoomServer.Www.Areas.Api.Controllers
|
||||
{
|
||||
using System.Data.Entity;
|
||||
using System.Threading.Tasks;
|
||||
using ChatRoomServer.Db;
|
||||
|
||||
[Authorize]
|
||||
public class MsgsController : ApiController
|
||||
{
|
||||
[RoutePrefix("api/msgs")]
|
||||
public class MsgsController : ApiController
|
||||
{
|
||||
[Route("list")]
|
||||
public async Task<object> List([FromBody] Dictionary<string, string> query)
|
||||
{
|
||||
var searchUser = query.GetValue("searchUser") ?? "";
|
||||
@ -20,7 +23,20 @@ namespace ChatRoomServer.Www.Areas.Api.Controllers
|
||||
var pagesize = query.GetValue("pagesize").ToInt32(20);
|
||||
var db = new ChatDb();
|
||||
|
||||
var data = await db.GetMsgLogList(searchUser, pagesize, pageIndex);
|
||||
var rooms = data.Data.Select(s => s.RoomId).Distinct().ToArray();
|
||||
var roomdata = await db.Rooms.Where(s => rooms.Contains(s.ID)).ToDictionaryAsync(s => s.ID);
|
||||
|
||||
|
||||
return new
|
||||
{
|
||||
count = data.TotalCount,
|
||||
list = data.Data.Select(s => new
|
||||
{
|
||||
msg = s,
|
||||
room = roomdata.GetValue(s.RoomId)
|
||||
})
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,61 @@ namespace ChatRoomServer.Www.Areas.Api.Controllers
|
||||
[RoutePrefix("api/users"), Authorize]
|
||||
public class UsersController : ApiController
|
||||
{
|
||||
[Route("blockList")]
|
||||
public async Task<object> BlockUsersList([FromBody] Dictionary<string, string> query)
|
||||
{
|
||||
var searchUser = query.GetValue("searchUser") ?? "";
|
||||
var pageIndex = query.GetValue("pageIndex").ToInt32(1);
|
||||
var pagesize = query.GetValue("pagesize").ToInt32(20);
|
||||
var db = new ChatDb();
|
||||
|
||||
var data = await db.GetBlockUserList(searchUser, pagesize, pageIndex);
|
||||
|
||||
return new
|
||||
{
|
||||
count = data.TotalCount,
|
||||
list = data.Data
|
||||
};
|
||||
}
|
||||
|
||||
[Route("connectionLog")]
|
||||
public async Task<object> ConnectionLog([FromBody] Dictionary<string, string> query)
|
||||
{
|
||||
var searchUser = query.GetValue("searchUser") ?? "";
|
||||
var pageIndex = query.GetValue("pageIndex").ToInt32(1);
|
||||
var pagesize = query.GetValue("pagesize").ToInt32(20);
|
||||
var db = new ChatDb();
|
||||
|
||||
var data = await db.GetConnectionLogList(searchUser, pagesize, pageIndex);
|
||||
var rooms = data.Data.Select(s => s.RoomID).Distinct().ToArray();
|
||||
var roomdata = await db.Rooms.Where(s => rooms.Contains(s.ID)).ToDictionaryAsync(s => s.ID);
|
||||
|
||||
|
||||
return new
|
||||
{
|
||||
count = data.TotalCount,
|
||||
list = data.Data.Select(s => new
|
||||
{
|
||||
msg = s,
|
||||
room = roomdata.GetValue(s.RoomID)
|
||||
})
|
||||
};
|
||||
}
|
||||
|
||||
[Route("list"), HttpGet]
|
||||
public async Task<object> UserList(int pageindex, int pagesize, string user)
|
||||
{
|
||||
var db = new ChatDb();
|
||||
|
||||
var data = await db.GetUserList(user, pagesize, pageindex);
|
||||
|
||||
return new
|
||||
{
|
||||
count = data.TotalCount,
|
||||
list = data.Data
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
[Route("abuseList")]
|
||||
public async Task<object> AbuseList([FromBody]Dictionary<string, string> query)
|
||||
|
@ -194,6 +194,9 @@
|
||||
<Content Include="Views\Index\Index.cshtml" />
|
||||
<Content Include="Views\Users\AbuseList.cshtml" />
|
||||
<Content Include="Views\Msgs\LogList.cshtml" />
|
||||
<Content Include="Views\Users\ConnectionLog.cshtml" />
|
||||
<Content Include="Views\Users\BlockList.cshtml" />
|
||||
<Content Include="Views\Users\UserList.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\Private\iFishOs\FSLib.Extension\src\FSLib.Extension.csproj">
|
||||
|
@ -13,5 +13,20 @@ namespace ChatRoomServer.Www.Controllers
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public ActionResult ConnectionLog()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public ActionResult UserList()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public ActionResult BlockList()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
}
|
||||
}
|
@ -252,7 +252,7 @@ var app = angular.module('chat12306', ['ngCookies']);
|
||||
$scope.filter = {
|
||||
searchUser: "",
|
||||
pageIndex: 1,
|
||||
pagesize : "20"
|
||||
pagesize: "20"
|
||||
};
|
||||
$scope.pages = 0;
|
||||
$scope.itemsCount = 0;
|
||||
@ -276,21 +276,16 @@ var app = angular.module('chat12306', ['ngCookies']);
|
||||
});
|
||||
$http.post(listApi, $scope.filter)
|
||||
.success(function (data) {
|
||||
if (data.success) {
|
||||
notify.update({
|
||||
"title": "操作成功...",
|
||||
type: "success",
|
||||
icon: "fa fa-check",
|
||||
showProgressbar: false
|
||||
});
|
||||
$scope.items = data.items;
|
||||
$scope.itemsCount = data.count;
|
||||
} else {
|
||||
notify.changeStatus("danger", "fa fa-ban", "加载失败:" + data.message, null, -2);
|
||||
}
|
||||
notify.update({
|
||||
"title": "加载成功...",
|
||||
type: "success",
|
||||
icon: "fa fa-check",
|
||||
showProgressbar: false
|
||||
});
|
||||
$scope.items = data.list;
|
||||
$scope.itemsCount = data.count;
|
||||
$scope.pages = Math.ceil($scope.itemsCount / parseInt($scope.filter.pagesize, 10));
|
||||
setTimeout(notify.close, 2000);
|
||||
|
||||
$("tr[data-id=" + item.id + "] button.btn").remove();
|
||||
}).error(function () {
|
||||
notify.setTitle("加载失败,请重试。服务器错误啦....").setType("danger").setIcon("fa fa-ban").hideProgress().delayClose();
|
||||
});
|
||||
@ -311,4 +306,194 @@ var app = angular.module('chat12306', ['ngCookies']);
|
||||
}
|
||||
|
||||
app.controller("ChatMessageListController", ['$scope', '$http', chatMessageListController]);
|
||||
})();
|
||||
(function ConnectionLogControllerContainer() {
|
||||
function connectionLogController($scope, $http) {
|
||||
var listApi = "/api/users/connectionlog";
|
||||
|
||||
$scope.filter = {
|
||||
searchUser: "",
|
||||
pageIndex: 1,
|
||||
pagesize: "20"
|
||||
};
|
||||
$scope.pages = 0;
|
||||
$scope.itemsCount = 0;
|
||||
$scope.items = [];
|
||||
|
||||
//加载
|
||||
$scope.reload = function () {
|
||||
var notify = $.notify({
|
||||
title: "数据加载中...",
|
||||
"icon": "fa-spin fa fa-spinner",
|
||||
type: "info"
|
||||
}, {
|
||||
delay: 0,
|
||||
progress: -1,
|
||||
showProgressbar: true,
|
||||
allow_dismiss: false,
|
||||
placement: {
|
||||
from: "top",
|
||||
align: "center"
|
||||
}
|
||||
});
|
||||
$http.post(listApi, $scope.filter)
|
||||
.success(function (data) {
|
||||
notify.update({
|
||||
"title": "加载成功...",
|
||||
type: "success",
|
||||
icon: "fa fa-check",
|
||||
showProgressbar: false
|
||||
});
|
||||
$scope.items = data.list;
|
||||
$scope.itemsCount = data.count;
|
||||
$scope.pages = Math.ceil($scope.itemsCount / parseInt($scope.filter.pagesize, 10));
|
||||
setTimeout(notify.close, 2000);
|
||||
}).error(function () {
|
||||
notify.setTitle("加载失败,请重试。服务器错误啦....").setType("danger").setIcon("fa fa-ban").hideProgress().delayClose();
|
||||
});
|
||||
};
|
||||
$scope.goPage = function (page) {
|
||||
if (page <= 0)
|
||||
return;
|
||||
$scope.filter.pageIndex = page;
|
||||
};
|
||||
$scope.go = function (pageOffset) {
|
||||
$scope.filter.pageIndex = Math.max(1, Math.min($scope.filter.pageIndex + pageOffset, $scope.pages));
|
||||
};
|
||||
|
||||
|
||||
$scope.$watch("filter", function (newvalue, oldvalue) {
|
||||
$scope.reload();
|
||||
}, true);
|
||||
}
|
||||
|
||||
app.controller("ConnectionLogController", ['$scope', '$http', connectionLogController]);
|
||||
})();
|
||||
//-------------------------------------------------------------
|
||||
(function blockUserListControllerContainer() {
|
||||
function blockUserListController($scope, $http) {
|
||||
var listApi = "/api/users/blockList";
|
||||
|
||||
$scope.filter = {
|
||||
searchUser: "",
|
||||
pageIndex: 1,
|
||||
pagesize: "20"
|
||||
};
|
||||
$scope.pages = 0;
|
||||
$scope.itemsCount = 0;
|
||||
$scope.items = [];
|
||||
|
||||
//加载
|
||||
$scope.reload = function () {
|
||||
var notify = $.notify({
|
||||
title: "数据加载中...",
|
||||
"icon": "fa-spin fa fa-spinner",
|
||||
type: "info"
|
||||
}, {
|
||||
delay: 0,
|
||||
progress: -1,
|
||||
showProgressbar: true,
|
||||
allow_dismiss: false,
|
||||
placement: {
|
||||
from: "top",
|
||||
align: "center"
|
||||
}
|
||||
});
|
||||
$http.post(listApi, $scope.filter)
|
||||
.success(function (data) {
|
||||
notify.update({
|
||||
"title": "加载成功...",
|
||||
type: "success",
|
||||
icon: "fa fa-check",
|
||||
showProgressbar: false
|
||||
});
|
||||
$scope.items = data.list;
|
||||
$scope.itemsCount = data.count;
|
||||
$scope.pages = Math.ceil($scope.itemsCount / parseInt($scope.filter.pagesize, 10));
|
||||
setTimeout(notify.close, 2000);
|
||||
}).error(function () {
|
||||
notify.setTitle("加载失败,请重试。服务器错误啦....").setType("danger").setIcon("fa fa-ban").hideProgress().delayClose();
|
||||
});
|
||||
};
|
||||
$scope.goPage = function (page) {
|
||||
if (page <= 0)
|
||||
return;
|
||||
$scope.filter.pageIndex = page;
|
||||
};
|
||||
$scope.go = function (pageOffset) {
|
||||
$scope.filter.pageIndex = Math.max(1, Math.min($scope.filter.pageIndex + pageOffset, $scope.pages));
|
||||
};
|
||||
|
||||
|
||||
$scope.$watch("filter", function (newvalue, oldvalue) {
|
||||
$scope.reload();
|
||||
}, true);
|
||||
}
|
||||
|
||||
app.controller("BlockUserListController", ['$scope', '$http', blockUserListController]);
|
||||
})();
|
||||
//-------------------------------------------------------------
|
||||
(function userListControllerContainer() {
|
||||
function userListController($scope, $http) {
|
||||
var listApi = "/api/users/list";
|
||||
|
||||
$scope.filter = {
|
||||
user: "",
|
||||
pageIndex: 1,
|
||||
pagesize: "20"
|
||||
};
|
||||
$scope.pages = 0;
|
||||
$scope.itemsCount = 0;
|
||||
$scope.items = [];
|
||||
|
||||
//加载
|
||||
$scope.reload = function () {
|
||||
var notify = $.notify({
|
||||
title: "数据加载中...",
|
||||
"icon": "fa-spin fa fa-spinner",
|
||||
type: "info"
|
||||
}, {
|
||||
delay: 0,
|
||||
progress: -1,
|
||||
showProgressbar: true,
|
||||
allow_dismiss: false,
|
||||
placement: {
|
||||
from: "top",
|
||||
align: "center"
|
||||
}
|
||||
});
|
||||
$http.get(listApi, {
|
||||
params: $scope.filter
|
||||
})
|
||||
.success(function (data) {
|
||||
notify.update({
|
||||
"title": "加载成功...",
|
||||
type: "success",
|
||||
icon: "fa fa-check",
|
||||
showProgressbar: false
|
||||
});
|
||||
$scope.items = data.list;
|
||||
$scope.itemsCount = data.count;
|
||||
$scope.pages = Math.ceil($scope.itemsCount / parseInt($scope.filter.pagesize, 10));
|
||||
setTimeout(notify.close, 2000);
|
||||
}).error(function () {
|
||||
notify.setTitle("加载失败,请重试。服务器错误啦....").setType("danger").setIcon("fa fa-ban").hideProgress().delayClose();
|
||||
});
|
||||
};
|
||||
$scope.goPage = function (page) {
|
||||
if (page <= 0)
|
||||
return;
|
||||
$scope.filter.pageIndex = page;
|
||||
};
|
||||
$scope.go = function (pageOffset) {
|
||||
$scope.filter.pageIndex = Math.max(1, Math.min($scope.filter.pageIndex + pageOffset, $scope.pages));
|
||||
};
|
||||
|
||||
|
||||
$scope.$watch("filter", function (newvalue, oldvalue) {
|
||||
$scope.reload();
|
||||
}, true);
|
||||
}
|
||||
|
||||
app.controller("UserListController", ['$scope', '$http', userListController]);
|
||||
})();
|
@ -10,6 +10,11 @@
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">搜索</div>
|
||||
<input type="text" ng-change="filter.pageIndex=1" class="form-control" ng-model="filter.searchUser" id="" placeholder="按用户名搜索..." />
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default" ng-click="filter.searchUser=''" ng-disabled="!filter.searchUser">
|
||||
<i class="fa fa-times"></i>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@ -25,12 +30,12 @@
|
||||
<th>发送给</th>
|
||||
</tr>
|
||||
<tr ng-repeat-start="item in items">
|
||||
<td>{{item.msg.id}}</td>
|
||||
<td>{{item.room.name}}</td>
|
||||
<td><a href="javascript:;" ng-click="filter.searchUser=item.msg.userName;">{{item.msg.userName}}</a></td>
|
||||
<td>{{item.msg.sendTime|jsonDate}}</td>
|
||||
<td>{{item.msg.ip}}</td>
|
||||
<td>{{item.msg.atUser}}</td>
|
||||
<th>{{item.msg.id}}</th>
|
||||
<th>{{item.room.name}}</th>
|
||||
<th><a href="javascript:;" ng-click="filter.searchUser=item.msg.userName;">{{item.msg.userName}}</a></th>
|
||||
<th>{{item.msg.sendTime|jsonDate}}</th>
|
||||
<th>{{item.msg.ip}}</th>
|
||||
<th>{{item.msg.atUser}}</th>
|
||||
</tr>
|
||||
<tr ng-repeat-end>
|
||||
<td colspan="6">
|
||||
@ -47,11 +52,6 @@
|
||||
<li>
|
||||
<span>共 {{itemsCount}} 条记录,每页 {{filter.pagesize}} 条,共 {{ pages }} 页</span>
|
||||
</li>
|
||||
<li ng-class="filter.pageIndex>1?'':'disabled'">
|
||||
<a href="javascript:;" ng-click="go(-1)" ng-disabled="filter.pageIndex<=1" aria-label="Previous">
|
||||
<span aria-hidden="true">«</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<span>
|
||||
每页记录数
|
||||
@ -60,6 +60,11 @@
|
||||
</select>
|
||||
</span>
|
||||
</li>
|
||||
<li ng-class="filter.pageIndex>1?'':'disabled'">
|
||||
<a href="javascript:;" ng-click="go(-1)" ng-disabled="filter.pageIndex<=1" aria-label="Previous">
|
||||
<span aria-hidden="true">«</span>
|
||||
</a>
|
||||
</li>
|
||||
<li ng-repeat="index in filter.pageIndex | pagelist:pages" ng-class="[index===filter.pageIndex?'active':'', index<0?'disabled':'']"><a href="javascript:;" ng-click="goPage(index)" ng-bind="index<0?'...':index"></a></li>
|
||||
<li ng-class="filter.pageIndex<pages?'':'disabled'">
|
||||
<a href="javascript:;" ng-click="go(1)" ng-disabled="filter.pageIndex<pages" aria-label="Next">
|
||||
|
@ -27,7 +27,9 @@
|
||||
<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown">用户管理 <i class="caret"></i></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li>@Html.ActionLink("举报管理", "AbuseList", "Users")</li>
|
||||
<li>@Html.ActionLink("举报管理", "BlockList", "Users")</li>
|
||||
<li>@Html.ActionLink("屏蔽列表", "BlockList", "Users")</li>
|
||||
<li>@Html.ActionLink("连接日志", "ConnectionLog", "Users")</li>
|
||||
<li>@Html.ActionLink("用户列表", "UserList", "Users")</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
|
70
ChatRoomServer.Www/Views/Users/BlockList.cshtml
Normal file
70
ChatRoomServer.Www/Views/Users/BlockList.cshtml
Normal file
@ -0,0 +1,70 @@
|
||||
@{
|
||||
ViewBag.Title = "用户连接日志";
|
||||
}
|
||||
|
||||
<div class="container" ng-app="chat12306" ng-controller="BlockUserListController">
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
<form class="form-inline">
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">搜索</div>
|
||||
<input type="text" ng-change="filter.pageIndex=1" class="form-control" ng-model="filter.searchUser" id="" placeholder="按用户名搜索..." />
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default" ng-click="filter.searchUser=''" ng-disabled="!filter.searchUser">
|
||||
<i class="fa fa-times"></i>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<table class="table table-topspace table-bordered table-striped table-hover">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>用户名</th>
|
||||
<th>屏蔽时间</th>
|
||||
<th>解除时间</th>
|
||||
</tr>
|
||||
<tr ng-repeat="item in items">
|
||||
<td>{{item.id}}</td>
|
||||
<td><a href="javascript:;" ng-click="filter.searchUser=item.userName;">{{item.userName}}</a></td>
|
||||
<td>{{item.blockTime|jsonDate}}</td>
|
||||
<td>{{item.unblockTime||'永久' | jsonDate}}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<nav>
|
||||
<ul class="pagination">
|
||||
<li>
|
||||
<span>共 {{itemsCount}} 条记录,每页 {{filter.pagesize}} 条,共 {{ pages }} 页</span>
|
||||
</li>
|
||||
<li>
|
||||
<span>
|
||||
每页记录数
|
||||
<select ng-model="filter.pagesize" class="form-control">
|
||||
<option ng-repeat="ps in [10,20,30,40,50,100]" ng-value="ps">{{ps}}</option>
|
||||
</select>
|
||||
</span>
|
||||
</li>
|
||||
<li ng-class="filter.pageIndex>1?'':'disabled'">
|
||||
<a href="javascript:;" ng-click="go(-1)" ng-disabled="filter.pageIndex<=1" aria-label="Previous">
|
||||
<span aria-hidden="true">«</span>
|
||||
</a>
|
||||
</li>
|
||||
<li ng-repeat="index in filter.pageIndex | pagelist:pages" ng-class="[index===filter.pageIndex?'active':'', index<0?'disabled':'']"><a href="javascript:;" ng-click="goPage(index)" ng-bind="index<0?'...':index"></a></li>
|
||||
<li ng-class="filter.pageIndex<pages?'':'disabled'">
|
||||
<a href="javascript:;" ng-click="go(1)" ng-disabled="filter.pageIndex<pages" aria-label="Next">
|
||||
<span aria-hidden="true">»</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="javascript:;" ng-click="reload();">
|
||||
<i class="glyphicon glyphicon-refresh"></i>
|
||||
刷新数据
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
76
ChatRoomServer.Www/Views/Users/ConnectionLog.cshtml
Normal file
76
ChatRoomServer.Www/Views/Users/ConnectionLog.cshtml
Normal file
@ -0,0 +1,76 @@
|
||||
@{
|
||||
ViewBag.Title = "用户连接日志";
|
||||
}
|
||||
|
||||
<div class="container" ng-app="chat12306" ng-controller="ConnectionLogController">
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
<form class="form-inline">
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">搜索</div>
|
||||
<input type="text" ng-change="filter.pageIndex=1" class="form-control" ng-model="filter.searchUser" id="" placeholder="按用户名搜索..." />
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default" ng-click="filter.searchUser=''" ng-disabled="!filter.searchUser">
|
||||
<i class="fa fa-times"></i>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<table class="table table-topspace table-bordered table-striped table-hover">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>用户名</th>
|
||||
<th>房间</th>
|
||||
<th>连接时间</th>
|
||||
<th>断开时间</th>
|
||||
<th>持续时间</th>
|
||||
<th>IP</th>
|
||||
</tr>
|
||||
<tr ng-repeat="item in items">
|
||||
<td>{{item.msg.id}}</td>
|
||||
<td><a href="javascript:;" ng-click="filter.searchUser=item.msg.userName;">{{item.msg.userName}}</a></td>
|
||||
<td>{{item.room.name}}</td>
|
||||
<td>{{item.msg.connectTime|jsonDate}}</td>
|
||||
<td>{{item.msg.disconnectTime|jsonDate}}</td>
|
||||
<td>{{item.msg.elapsedTime/60|number:0}}分钟/{{item.msg.elapsedTime/3600 | number:2}}小时</td>
|
||||
<td>{{item.msg.ip}}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<nav>
|
||||
<ul class="pagination">
|
||||
<li>
|
||||
<span>共 {{itemsCount}} 条记录,每页 {{filter.pagesize}} 条,共 {{ pages }} 页</span>
|
||||
</li>
|
||||
<li>
|
||||
<span>
|
||||
每页记录数
|
||||
<select ng-model="filter.pagesize" class="form-control">
|
||||
<option ng-repeat="ps in [10,20,30,40,50,100]" ng-value="ps">{{ps}}</option>
|
||||
</select>
|
||||
</span>
|
||||
</li>
|
||||
<li ng-class="filter.pageIndex>1?'':'disabled'">
|
||||
<a href="javascript:;" ng-click="go(-1)" ng-disabled="filter.pageIndex<=1" aria-label="Previous">
|
||||
<span aria-hidden="true">«</span>
|
||||
</a>
|
||||
</li>
|
||||
<li ng-repeat="index in filter.pageIndex | pagelist:pages" ng-class="[index===filter.pageIndex?'active':'', index<0?'disabled':'']"><a href="javascript:;" ng-click="goPage(index)" ng-bind="index<0?'...':index"></a></li>
|
||||
<li ng-class="filter.pageIndex<pages?'':'disabled'">
|
||||
<a href="javascript:;" ng-click="go(1)" ng-disabled="filter.pageIndex<pages" aria-label="Next">
|
||||
<span aria-hidden="true">»</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="javascript:;" ng-click="reload();">
|
||||
<i class="glyphicon glyphicon-refresh"></i>
|
||||
刷新数据
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
78
ChatRoomServer.Www/Views/Users/UserList.cshtml
Normal file
78
ChatRoomServer.Www/Views/Users/UserList.cshtml
Normal file
@ -0,0 +1,78 @@
|
||||
@{
|
||||
ViewBag.Title = "用户列表";
|
||||
}
|
||||
|
||||
<div class="container" ng-app="chat12306" ng-controller="UserListController">
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
<form class="form-inline">
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">搜索</div>
|
||||
<input type="text" ng-change="filter.pageIndex=1" class="form-control" ng-model="filter.user" id="" placeholder="按用户名搜索..." />
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default" ng-click="filter.user=''" ng-disabled="!filter.user">
|
||||
<i class="fa fa-times"></i>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<table class="table table-topspace table-bordered table-striped table-hover">
|
||||
<tr>
|
||||
<th>用户名</th>
|
||||
<th>显示名称</th>
|
||||
<th>首次连接时间</th>
|
||||
<th>最后连接时间</th>
|
||||
<th>首次发言时间</th>
|
||||
<th>最后发言时间</th>
|
||||
<th>发言次数</th>
|
||||
<th>在线时间</th>
|
||||
</tr>
|
||||
<tr ng-repeat="item in items">
|
||||
<td><a href="javascript:;" ng-click="filter.user=item.userName;">{{item.userName}}</a></td>
|
||||
<td>{{item.nickName}}</td>
|
||||
<td>{{item.firstConnect|jsonDate}}</td>
|
||||
<td>{{item.lastConnect|jsonDate}}</td>
|
||||
<td>{{item.firstSend||'永久' | jsonDate}}</td>
|
||||
<td>{{item.lastSend||'永久' | jsonDate}}</td>
|
||||
<td>{{item.sendTimes}}</td>
|
||||
<td>{{item.onlineTime/60|number:0}}分钟/{{item.onlineTime/3600 | number:2}}小时</td>
|
||||
</tr>
|
||||
</table>
|
||||
<nav>
|
||||
<ul class="pagination">
|
||||
<li>
|
||||
<span>共 {{itemsCount}} 条记录,每页 {{filter.pagesize}} 条,共 {{ pages }} 页</span>
|
||||
</li>
|
||||
<li>
|
||||
<span>
|
||||
每页记录数
|
||||
<select ng-model="filter.pagesize" class="form-control">
|
||||
<option ng-repeat="ps in [10,20,30,40,50,100]" ng-value="ps">{{ps}}</option>
|
||||
</select>
|
||||
</span>
|
||||
</li>
|
||||
<li ng-class="filter.pageIndex>1?'':'disabled'">
|
||||
<a href="javascript:;" ng-click="go(-1)" ng-disabled="filter.pageIndex<=1" aria-label="Previous">
|
||||
<span aria-hidden="true">«</span>
|
||||
</a>
|
||||
</li>
|
||||
<li ng-repeat="index in filter.pageIndex | pagelist:pages" ng-class="[index===filter.pageIndex?'active':'', index<0?'disabled':'']"><a href="javascript:;" ng-click="goPage(index)" ng-bind="index<0?'...':index"></a></li>
|
||||
<li ng-class="filter.pageIndex<pages?'':'disabled'">
|
||||
<a href="javascript:;" ng-click="go(1)" ng-disabled="filter.pageIndex<pages" aria-label="Next">
|
||||
<span aria-hidden="true">»</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="javascript:;" ng-click="reload();">
|
||||
<i class="glyphicon glyphicon-refresh"></i>
|
||||
刷新数据
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
@ -13,6 +13,8 @@ using Newtonsoft.Json;
|
||||
|
||||
namespace TrainInfomationProviderService.StationInfo
|
||||
{
|
||||
using TrainInfomationProviderService.Web;
|
||||
|
||||
class SameStationManager
|
||||
{
|
||||
public static Dictionary<string, HashSet<string>> SameStationMap { get; private set; }
|
||||
@ -117,7 +119,7 @@ namespace TrainInfomationProviderService.StationInfo
|
||||
|
||||
static bool GrabberFromWeb()
|
||||
{
|
||||
var ctx = new HttpClient().Create<string>(HttpMethod.Get, _url).Send();
|
||||
var ctx = new HttpWebClient().Create<string>(HttpMethod.Get, _url).Send();
|
||||
if (!ctx.IsValid())
|
||||
return false;
|
||||
|
||||
|
@ -16,6 +16,8 @@ using TrainInfomationProviderService.StationInfo.Entities;
|
||||
|
||||
namespace TrainInfomationProviderService.StationInfo
|
||||
{
|
||||
using TrainInfomationProviderService.Web;
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
public class StationManager
|
||||
@ -156,7 +158,7 @@ namespace TrainInfomationProviderService.StationInfo
|
||||
void RefreshStationInfo(int version)
|
||||
{
|
||||
Trace.TraceInformation("[STATION] 正在获得最新车站信息");
|
||||
var html = new HttpClient().Create(HttpMethod.Get, "https://kyfw.12306.cn/otn/resources/js/framework/station_name.js", null, null, "").Send();
|
||||
var html = new HttpWebClient().Create(HttpMethod.Get, "https://kyfw.12306.cn/otn/resources/js/framework/station_name.js", null, null, "").Send();
|
||||
if (!html.IsValid())
|
||||
{
|
||||
Trace.TraceError("[STATION] 车站信息获得失败。错误:{0}", html.Exception);
|
||||
@ -203,7 +205,7 @@ namespace TrainInfomationProviderService.StationInfo
|
||||
/// <returns></returns>
|
||||
public int GetLatestVersionFromWeb()
|
||||
{
|
||||
var ctx = new HttpClient().Create<string>(HttpMethod.Get, "https://kyfw.12306.cn/otn/leftTicket/init", "https://kyfw.12306.cn/otn/leftTicket/init").Send();
|
||||
var ctx = new HttpWebClient().Create<string>(HttpMethod.Get, "https://kyfw.12306.cn/otn/leftTicket/init", "https://kyfw.12306.cn/otn/leftTicket/init").Send();
|
||||
if (!ctx.IsValid())
|
||||
return 0;
|
||||
|
||||
|
@ -16,6 +16,8 @@ using TrainInfomationProviderService.TrainInfo.Entities;
|
||||
|
||||
namespace TrainInfomationProviderService.TrainInfo
|
||||
{
|
||||
using TrainInfomationProviderService.Web;
|
||||
|
||||
public class TrainInfoManager
|
||||
{
|
||||
private static readonly object _lockObject = new object();
|
||||
@ -229,7 +231,7 @@ namespace TrainInfomationProviderService.TrainInfo
|
||||
/// <returns></returns>
|
||||
public int GetLatestVersionFromWeb()
|
||||
{
|
||||
var ctx = new HttpClient().Create<string>(HttpMethod.Get, "https://kyfw.12306.cn/otn/queryTrainInfo/init", "https://kyfw.12306.cn/otn/queryTrainInfo/init").Send();
|
||||
var ctx = new HttpWebClient().Create<string>(HttpMethod.Get, "https://kyfw.12306.cn/otn/queryTrainInfo/init", "https://kyfw.12306.cn/otn/queryTrainInfo/init").Send();
|
||||
if (!ctx.IsValid())
|
||||
return 0;
|
||||
|
||||
|
@ -16,6 +16,7 @@ using TrainInfomationProviderService.TrainInfo.Entities;
|
||||
namespace TrainInfomationProviderService.TrainInfo
|
||||
{
|
||||
using System.Runtime.Serialization;
|
||||
using TrainInfomationProviderService.Web;
|
||||
|
||||
class WebDataProvider
|
||||
{
|
||||
@ -101,7 +102,7 @@ namespace TrainInfomationProviderService.TrainInfo
|
||||
public void LoadTrainInfo(IndexStorage indexStorage, Action saveCallback)
|
||||
{
|
||||
Trace.TraceInformation("[TRAIN_DATA_WEB_PROVIDER] 正在获得最新车次信息");
|
||||
var html = new HttpClient().Create(HttpMethod.Get, "https://kyfw.12306.cn/otn/resources/js/query/train_list.js?scriptVersion=" + (new Random().NextDouble() + 1).ToString("#0.00000"), null, null, "").Send();
|
||||
var html = new HttpWebClient().Create(HttpMethod.Get, "https://kyfw.12306.cn/otn/resources/js/query/train_list.js?scriptVersion=" + (new Random().NextDouble() + 1).ToString("#0.00000"), null, null, "").Send();
|
||||
if (!html.IsValid())
|
||||
{
|
||||
Trace.TraceError("[TRAIN_DATA_WEB_PROVIDER] 车次信息获得失败。错误:{0}", html.Exception);
|
||||
@ -230,7 +231,7 @@ namespace TrainInfomationProviderService.TrainInfo
|
||||
var tryCount = 0;
|
||||
while (tryCount++ < 50)
|
||||
{
|
||||
var ctx = new HttpClient().Create(
|
||||
var ctx = new HttpWebClient().Create(
|
||||
HttpMethod.Get,
|
||||
string.Format("https://kyfw.12306.cn/otn/czxx/queryByTrainNo?train_no={0}&from_station_telecode={1}&to_station_telecode={2}&depart_date={3}", train.Id, train.From, train.To, date),
|
||||
null,
|
||||
|
@ -112,6 +112,7 @@
|
||||
<Compile Include="Utility.cs" />
|
||||
<Compile Include="Web\Controllers\TransitController.cs" />
|
||||
<Compile Include="Web\Models\Dto\Station.cs" />
|
||||
<Compile Include="Web\WebClient.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
|
53
TrainInfomationProviderService/Web/WebClient.cs
Normal file
53
TrainInfomationProviderService/Web/WebClient.cs
Normal file
@ -0,0 +1,53 @@
|
||||
namespace TrainInfomationProviderService.Web
|
||||
{
|
||||
using System;
|
||||
using System.Net;
|
||||
using FSLib.Network.Http;
|
||||
|
||||
class HttpWebClient : HttpClient
|
||||
{
|
||||
public HttpWebClient()
|
||||
: base(null, new WebHandler())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
class WebHandler : HttpHandler
|
||||
{
|
||||
public WebHandler()
|
||||
{
|
||||
var proxy = System.Configuration.ConfigurationManager.AppSettings["web_proxy"];
|
||||
if (!proxy.IsNullOrEmpty())
|
||||
{
|
||||
_proxy = new WebProxy(new Uri(proxy));
|
||||
var username = System.Configuration.ConfigurationManager.AppSettings["web_proxy_username"];
|
||||
if (!proxy.IsNullOrEmpty())
|
||||
{
|
||||
_proxy.UseDefaultCredentials = false;
|
||||
_proxy.Credentials = new NetworkCredential(username, System.Configuration.ConfigurationManager.AppSettings["web_proxy_password"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WebProxy _proxy;
|
||||
|
||||
/// <summary>
|
||||
/// 获得用于发送请求的Request对象
|
||||
/// </summary>
|
||||
/// <param name="uri"></param>
|
||||
/// <param name="method"></param>
|
||||
/// <returns></returns>
|
||||
public override HttpWebRequest GetRequest(Uri uri, HttpMethod method, HttpContext context)
|
||||
{
|
||||
var request = base.GetRequest(uri, method, context);
|
||||
if (_proxy != null)
|
||||
request.Proxy = _proxy;
|
||||
|
||||
return request;
|
||||
}
|
||||
}
|
||||
}
|
@ -37,6 +37,11 @@
|
||||
<add key="12306_keepaliveurl" value="http://test.fishlee.net/tt/keepalive" />
|
||||
<add key="local_disable_train_provider" value="0" />
|
||||
<add key="FSLib.MvcWeb.CsrfDefender.Disabled" value="1" />
|
||||
|
||||
<add key="web_proxy" value="http://connect.fishlee.net:51100/" />
|
||||
<add key="web_proxy_username" value="fish" />
|
||||
<add key="web_proxy_password" value="fish" />
|
||||
|
||||
</appSettings>
|
||||
<connectionStrings>
|
||||
<add name="chatroom" connectionString="Server=114.112.68.93;port=11119;Database=gopush;Uid=gopush;Pwd=c8488f421866b23758d52045429437c45;CharSet=utf8;" providerName="MySql.Data.MySqlClient" />
|
||||
|
Loading…
Reference in New Issue
Block a user