feat: 新增bbs排行榜功能
This commit is contained in:
@@ -5,9 +5,9 @@ namespace Yi.Framework.Bbs.Application.Contracts.Dtos.BbsUser;
|
||||
public class MoneyTopUserDto
|
||||
{
|
||||
public string UserName { get; set; }
|
||||
public string? Nice { get; set; }
|
||||
public string? Nick { get; set; }
|
||||
public decimal Money { get; set; }
|
||||
public string Order { get; set; }
|
||||
public int Order { get; set; }
|
||||
public string? Icon { get; set; }
|
||||
public int Level { get; set; }
|
||||
/// <summary>
|
||||
|
||||
@@ -19,6 +19,7 @@ namespace Yi.Framework.Bbs.Application.Services.Analyses
|
||||
{
|
||||
private BbsUserManager _bbsUserManager;
|
||||
private IOnlineService _onlineService;
|
||||
|
||||
public BbsUserAnalyseService(BbsUserManager bbsUserManager, IOnlineService onlineService)
|
||||
{
|
||||
_bbsUserManager = bbsUserManager;
|
||||
@@ -37,18 +38,20 @@ namespace Yi.Framework.Bbs.Application.Services.Analyses
|
||||
RefAsync<int> total = 0;
|
||||
var output = await _bbsUserManager._userRepository._DbQueryable
|
||||
.LeftJoin<BbsUserExtraInfoEntity>((u, info) => u.Id == info.UserId)
|
||||
.OrderByDescending((u,info) => info.Money)
|
||||
.Select((u, info) =>
|
||||
new MoneyTopUserDto
|
||||
{
|
||||
UserName = u.UserName,
|
||||
Nice = u.Nick,
|
||||
Nick = u.Nick,
|
||||
Money = info.Money,
|
||||
Icon = u.Icon,
|
||||
Level = info.Level,
|
||||
UserLimit = info.UserLimit
|
||||
UserLimit = info.UserLimit,
|
||||
Order = SqlFunc.RowNumber(u.Id)
|
||||
}
|
||||
)
|
||||
.OrderBy(info=>info.Money)
|
||||
|
||||
.ToPageListAsync(input.SkipCount, input.MaxResultCount, total);
|
||||
|
||||
output.ForEach(x => { x.LevelName = _bbsUserManager._levelCacheDic[x.Level].Name; });
|
||||
@@ -73,8 +76,7 @@ namespace Yi.Framework.Bbs.Application.Services.Analyses
|
||||
var randUserIds = await _bbsUserManager._userRepository._DbQueryable
|
||||
//.Where(x => x.UserName != UserConst.Admin)
|
||||
.OrderBy(x => SqlFunc.GetRandom())
|
||||
.Select(x => x.Id).
|
||||
ToPageListAsync(input.SkipCount, input.MaxResultCount);
|
||||
.Select(x => x.Id).ToPageListAsync(input.SkipCount, input.MaxResultCount);
|
||||
var output = await _bbsUserManager.GetBbsUserInfoAsync(randUserIds);
|
||||
return output.Adapt<List<BbsUserGetListOutputDto>>();
|
||||
|
||||
@@ -83,26 +85,6 @@ namespace Yi.Framework.Bbs.Application.Services.Analyses
|
||||
//这里有数据权限,会根据用户角色进行过滤
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 积分钱钱排行榜
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("analyse/bbs-user/integral-top")]
|
||||
public async Task<List<BbsUserGetListOutputDto>> GetIntegralTopUserAsync([FromQuery] PagedResultRequestDto input)
|
||||
{
|
||||
using (DataFilter.DisablePermissionHandler())
|
||||
{
|
||||
var randUserIds = await _bbsUserManager._userRepository._DbQueryable
|
||||
// .Where(user => user.UserName != UserConst.Admin)
|
||||
.LeftJoin<BbsUserExtraInfoEntity>((user, info) => user.Id == info.UserId)
|
||||
.OrderByDescending((user, info) => info.Money)
|
||||
.Select((user, info) => user.Id).
|
||||
ToPageListAsync(input.SkipCount, input.MaxResultCount);
|
||||
var output = await _bbsUserManager.GetBbsUserInfoAsync(randUserIds);
|
||||
return output.OrderByDescending(x => x.Money).ToList().Adapt<List<BbsUserGetListOutputDto>>();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 用户分析
|
||||
/// </summary>
|
||||
@@ -125,12 +107,11 @@ namespace Yi.Framework.Bbs.Application.Services.Analyses
|
||||
|
||||
var userOnline = (await _onlineService.GetListAsync(new OnlineUserModel { })).TotalCount;
|
||||
|
||||
var output = new BbsUserAnalyseGetOutput() { OnlineNumber = userOnline, RegisterNumber = registerUser, YesterdayNewUser = yesterdayNewUser };
|
||||
var output = new BbsUserAnalyseGetOutput()
|
||||
{ OnlineNumber = userOnline, RegisterNumber = registerUser, YesterdayNewUser = yesterdayNewUser };
|
||||
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -33,9 +33,9 @@ export function getRecommendedFriend(data) {
|
||||
*/
|
||||
export function getRankingPoints(data) {
|
||||
return request({
|
||||
url: "/analyse/bbs-user/integral-top",
|
||||
url: "/analyse/bbs-user/money-top",
|
||||
method: "get",
|
||||
data,
|
||||
params: data
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -106,6 +106,15 @@ const router = createRouter({
|
||||
title: "联系我们",
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
name:"money",
|
||||
path:"/money",
|
||||
component: () => import("../views/money/Index.vue"),
|
||||
meta: {
|
||||
title: "钱钱",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
@@ -102,7 +102,18 @@
|
||||
</InfoCard>
|
||||
|
||||
<el-dialog v-model="accessLogDialogVisible" title="全站历史统计" width="1200px" center>
|
||||
<AccessLogChart :option="accessLogOptins" class="accessLogChart" />
|
||||
<el-tabs v-model="accessLogTab">
|
||||
<el-tab-pane label="访问统计" name="AccessLogChart" style="display: flex;justify-content: center;">
|
||||
<AccessLogChart :option="accessLogOptins" style="height: 600px;width: 1200px;" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="注册统计" name="RegisterChart" style="display: flex;justify-content: center;">
|
||||
即将上线,敬请期待
|
||||
</el-tab-pane>
|
||||
|
||||
</el-tabs>
|
||||
|
||||
|
||||
|
||||
</el-dialog>
|
||||
</el-col>
|
||||
|
||||
@@ -118,7 +129,7 @@
|
||||
|
||||
<el-col :span="24">
|
||||
<template v-if="isPointFinished">
|
||||
<InfoCard :items="pointList" header="财富排行榜" text="关于钱钱" height="400">
|
||||
<InfoCard :items="pointList" header="财富排行榜" text="查看我的位置" height="400" @onClickText="onClickMoneyTop">
|
||||
<template #item="temp">
|
||||
<PointsRanking :pointsData="temp" />
|
||||
</template>
|
||||
@@ -223,7 +234,7 @@ const allDiscussList = ref([]);
|
||||
const isAllDiscussFinished = ref(false);
|
||||
const userAnalyseInfo = ref({});
|
||||
const onlineNumber = ref(0);
|
||||
|
||||
const accessLogTab = ref()
|
||||
const activeList = [
|
||||
{ name: "签到", path: "/activity/sign", icon: "Present" },
|
||||
{ name: "等级", path: "/activity/level", icon: "Ticket" },
|
||||
@@ -256,7 +267,7 @@ onMounted(async () => {
|
||||
const { data: weekData } = await getWeek();
|
||||
weekList.value = weekData;
|
||||
const { data: pointData, config: pointConfig } = await getRankingPoints();
|
||||
pointList.value = pointData;
|
||||
pointList.value = pointData.items;
|
||||
isPointFinished.value = pointConfig.isFinish;
|
||||
const { data: friendData, config: friendConfig } =
|
||||
await getRecommendedFriend();
|
||||
@@ -312,6 +323,11 @@ const accessLogOptins = computed(() => {
|
||||
]
|
||||
}
|
||||
});
|
||||
const onClickMoneyTop = () => {
|
||||
|
||||
router.push("/money");
|
||||
};
|
||||
|
||||
const onClickToChatHub = () => {
|
||||
router.push("/chat");
|
||||
};
|
||||
@@ -329,12 +345,25 @@ watch(
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
watch(
|
||||
() => accessLogTab.value,
|
||||
async(value) => {
|
||||
switch (value) {
|
||||
case "AccessLogChart":
|
||||
const {data} = await getAccessList();
|
||||
accessAllList.value = data;
|
||||
|
||||
break;
|
||||
case "RegisterChart":
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
)
|
||||
const onClickAccessLog = async () => {
|
||||
accessLogDialogVisible.value = true;
|
||||
const {data} = await getAccessList();
|
||||
accessLogTab.value = "AccessLogChart";
|
||||
|
||||
accessAllList.value = data;
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -439,10 +468,12 @@ const onClickAccessLog = async () => {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.top {
|
||||
text-align: center;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.active {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
@@ -457,9 +488,12 @@ const onClickAccessLog = async () => {
|
||||
cursor: pointer;
|
||||
padding: 10px 0px;
|
||||
}
|
||||
|
||||
.el-col:hover {
|
||||
background-color: #cce1ff; /* 悬浮时背景色变化 */
|
||||
color: #70aafb; /* 悬浮时文字颜色变化 */
|
||||
background-color: #cce1ff;
|
||||
/* 悬浮时背景色变化 */
|
||||
color: #70aafb;
|
||||
/* 悬浮时文字颜色变化 */
|
||||
}
|
||||
|
||||
&-btn {
|
||||
|
||||
@@ -10,25 +10,26 @@
|
||||
>
|
||||
|
||||
|
||||
<UserLimitTag :userLimit="pointsData.userLimit" />
|
||||
<!-- <UserLimitTag :userLimit="pointsData.userLimit" /> -->
|
||||
</div>
|
||||
|
||||
<div class="bottom">
|
||||
<div class="name">
|
||||
<el-tooltip
|
||||
class="box-item"
|
||||
effect="dark"
|
||||
:content="pointsData.userName"
|
||||
:content="pointsData.nick"
|
||||
placement="top"
|
||||
>
|
||||
{{ pointsData.userName }}
|
||||
{{ pointsData.nick }}
|
||||
</el-tooltip>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right">
|
||||
<div class="follow">
|
||||
<el-icon class="el-icon--right"><Plus /></el-icon>
|
||||
<div class="text">关注</div>
|
||||
|
||||
<div class="follow-text"> <el-icon class="el-icon--right"><Plus /></el-icon>关注</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -111,4 +112,8 @@ const userImageSrc = computed(() => {
|
||||
}
|
||||
}
|
||||
}
|
||||
.follow-text
|
||||
{ cursor: pointer;
|
||||
font-size: small;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -9,27 +9,27 @@
|
||||
<el-tooltip
|
||||
class="box-item"
|
||||
effect="dark"
|
||||
:content="friendData.userName"
|
||||
:content="friendData.nick"
|
||||
placement="top"
|
||||
>
|
||||
{{ friendData.userName }}
|
||||
{{ friendData.nick }}
|
||||
</el-tooltip>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<el-tag effect="light" type="success"
|
||||
<!-- <el-tag effect="light" type="success"
|
||||
>{{ friendData.level }}-{{friendData.levelName}} 等级</el-tag
|
||||
>
|
||||
> -->
|
||||
|
||||
<UserLimitTag :userLimit="friendData.userLimit" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="right">
|
||||
<div class="follow">
|
||||
<el-icon class="el-icon--right"><Plus /></el-icon>
|
||||
<div class="text">关注</div>
|
||||
|
||||
<div class="follow-text"> <el-icon class="el-icon--right"><Plus /></el-icon>关注</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -86,7 +86,7 @@ const userImageSrc = computed(() => {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.name {
|
||||
width: 50px;
|
||||
width: 100px;
|
||||
color: #252933;
|
||||
margin-left: 5px;
|
||||
white-space: nowrap;
|
||||
@@ -111,4 +111,9 @@ const userImageSrc = computed(() => {
|
||||
}
|
||||
}
|
||||
}
|
||||
.follow-text
|
||||
{
|
||||
font-size: small;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
export const accessLogEchartsConfig = {
|
||||
tooltip: {
|
||||
trigger: 'axis'
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
|
||||
Reference in New Issue
Block a user