feat: 添加注册人数分析,优化bbs聊天回车优化
This commit is contained in:
@@ -0,0 +1,20 @@
|
|||||||
|
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Analyse;
|
||||||
|
|
||||||
|
public class RegisterAnalyseDto
|
||||||
|
{
|
||||||
|
public RegisterAnalyseDto(DateTime time, int number)
|
||||||
|
{
|
||||||
|
Time = time;
|
||||||
|
Number = number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime Time { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 人数
|
||||||
|
/// </summary>
|
||||||
|
public int Number { get; set; }
|
||||||
|
}
|
||||||
@@ -48,12 +48,14 @@ namespace Yi.Framework.Bbs.Application.Services
|
|||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取全部访问流量
|
/// 获取全部访问流量(3个月)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<List<AccessLogDto>> Get()
|
public async Task<List<AccessLogDto>> Get()
|
||||||
{
|
{
|
||||||
var entities = await _repository._DbQueryable.OrderBy(x => x.CreationTime).ToListAsync();
|
var entities = await _repository._DbQueryable
|
||||||
|
.Where(x=>x.CreationTime>=DateTime.Now.AddMonths(-3))
|
||||||
|
.OrderBy(x => x.CreationTime).ToListAsync();
|
||||||
var output = entities.Adapt<List<AccessLogDto>>();
|
var output = entities.Adapt<List<AccessLogDto>>();
|
||||||
output?.ForEach(x => x.CreationTime = x.CreationTime.Date);
|
output?.ForEach(x => x.CreationTime = x.CreationTime.Date);
|
||||||
return output;
|
return output;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Mvc;
|
|||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using Volo.Abp.Application.Dtos;
|
using Volo.Abp.Application.Dtos;
|
||||||
using Volo.Abp.Application.Services;
|
using Volo.Abp.Application.Services;
|
||||||
|
using Yi.Framework.Bbs.Application.Contracts.Dtos.Analyse;
|
||||||
using Yi.Framework.Bbs.Application.Contracts.Dtos.BbsUser;
|
using Yi.Framework.Bbs.Application.Contracts.Dtos.BbsUser;
|
||||||
using Yi.Framework.Bbs.Domain.Entities;
|
using Yi.Framework.Bbs.Domain.Entities;
|
||||||
using Yi.Framework.Bbs.Domain.Entities.Integral;
|
using Yi.Framework.Bbs.Domain.Entities.Integral;
|
||||||
@@ -26,6 +27,59 @@ namespace Yi.Framework.Bbs.Application.Services.Analyses
|
|||||||
_onlineService = onlineService;
|
_onlineService = onlineService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 人数注册统计(近3个月)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("analyse/bbs-user/register")]
|
||||||
|
public async Task<List<RegisterAnalyseDto>> GetRegisterAsync([FromQuery] PagedResultRequestDto input)
|
||||||
|
|
||||||
|
{
|
||||||
|
using (DataFilter.DisablePermissionHandler())
|
||||||
|
{
|
||||||
|
var users = await _bbsUserManager._userRepository._DbQueryable
|
||||||
|
.Where(u=>u.CreationTime>=DateTime.Now.AddMonths(-3))
|
||||||
|
.LeftJoin<BbsUserExtraInfoEntity>((u, info) => u.Id == info.UserId)
|
||||||
|
.Select((u, info) => new BbsUserGetListOutputDto()
|
||||||
|
{
|
||||||
|
Id = u.Id,
|
||||||
|
Icon = u.Icon,
|
||||||
|
Level = info.Level,
|
||||||
|
UserLimit = info.UserLimit,
|
||||||
|
Money = info.Money,
|
||||||
|
Experience = info.Experience,
|
||||||
|
CreationTime = u.CreationTime
|
||||||
|
})
|
||||||
|
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
var minCreateUser = users.MinBy(x => x.CreationTime);
|
||||||
|
|
||||||
|
var userCreateTimeDic = users.OrderBy(x => x.CreationTime)
|
||||||
|
.GroupBy(x => x.CreationTime.Date)
|
||||||
|
.ToDictionary(x => x.Key.Date, y => y.Count());
|
||||||
|
|
||||||
|
DateTime startDate = minCreateUser.CreationTime.Date;
|
||||||
|
DateTime endDate = DateTime.Today;
|
||||||
|
|
||||||
|
List<RegisterAnalyseDto> output = new List<RegisterAnalyseDto>();
|
||||||
|
|
||||||
|
// 计算从起始日期到今天的所有天数
|
||||||
|
for (DateTime date = startDate; date <= endDate; date = date.AddDays(1))
|
||||||
|
{
|
||||||
|
var count = 0;
|
||||||
|
userCreateTimeDic.TryGetValue(date, out count);
|
||||||
|
RegisterAnalyseDto dayInfo = new RegisterAnalyseDto(date, count);
|
||||||
|
output.Add(dayInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 财富排行榜
|
/// 财富排行榜
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -38,7 +92,7 @@ namespace Yi.Framework.Bbs.Application.Services.Analyses
|
|||||||
RefAsync<int> total = 0;
|
RefAsync<int> total = 0;
|
||||||
var output = await _bbsUserManager._userRepository._DbQueryable
|
var output = await _bbsUserManager._userRepository._DbQueryable
|
||||||
.LeftJoin<BbsUserExtraInfoEntity>((u, info) => u.Id == info.UserId)
|
.LeftJoin<BbsUserExtraInfoEntity>((u, info) => u.Id == info.UserId)
|
||||||
.OrderByDescending((u,info) => info.Money)
|
.OrderByDescending((u, info) => info.Money)
|
||||||
.Select((u, info) =>
|
.Select((u, info) =>
|
||||||
new MoneyTopUserDto
|
new MoneyTopUserDto
|
||||||
{
|
{
|
||||||
@@ -51,7 +105,6 @@ namespace Yi.Framework.Bbs.Application.Services.Analyses
|
|||||||
Order = SqlFunc.RowNumber(u.Id)
|
Order = SqlFunc.RowNumber(u.Id)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
.ToPageListAsync(input.SkipCount, input.MaxResultCount, total);
|
.ToPageListAsync(input.SkipCount, input.MaxResultCount, total);
|
||||||
|
|
||||||
output.ForEach(x => { x.LevelName = _bbsUserManager._levelCacheDic[x.Level].Name; });
|
output.ForEach(x => { x.LevelName = _bbsUserManager._levelCacheDic[x.Level].Name; });
|
||||||
|
|||||||
@@ -51,3 +51,17 @@ export function getUserAnalyse(data) {
|
|||||||
data,
|
data,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取注册数量用户分析
|
||||||
|
* @param {*} data
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function getRegisterAnalyse(data) {
|
||||||
|
return request({
|
||||||
|
url: "/analyse/bbs-user/register",
|
||||||
|
method: "get",
|
||||||
|
data,
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -288,6 +288,20 @@ const onclickUserItem = (userInfo, itemType) => {
|
|||||||
changeInputValue(value);
|
changeInputValue(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//输入框按键事件
|
||||||
|
const handleKeydownInput=()=>{
|
||||||
|
// 检查是否按下 Shift + Enter
|
||||||
|
if (event.key === 'Enter' && event.shiftKey) {
|
||||||
|
// 允许输入换行
|
||||||
|
return; // 让默认行为继续
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果只按下 Enter,则阻止默认的提交行为,比如在表单中
|
||||||
|
if (event.key === 'Enter') {
|
||||||
|
onclickSendMsg();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//点击发送按钮
|
//点击发送按钮
|
||||||
const onclickSendMsg = () => {
|
const onclickSendMsg = () => {
|
||||||
if (currentInputValue.value == "") {
|
if (currentInputValue.value == "") {
|
||||||
@@ -389,7 +403,7 @@ const getLastMessage = ((receiveId, itemType) => {
|
|||||||
<template>
|
<template>
|
||||||
|
|
||||||
<div style="position: absolute; top: 0;left: 0;" v-show="isShowTipNumber>0">
|
<div style="position: absolute; top: 0;left: 0;" v-show="isShowTipNumber>0">
|
||||||
<p>当前版本:1.5.0</p>
|
<p>当前版本:1.5.1</p>
|
||||||
<p>tip:官方学习交流群每次发送消息消耗 1 钱钱</p>
|
<p>tip:官方学习交流群每次发送消息消耗 1 钱钱</p>
|
||||||
<p>tip:点击聊天窗口右上角“X”可退出</p>
|
<p>tip:点击聊天窗口右上角“X”可退出</p>
|
||||||
<p>tip:多人同时在聊天室时,左侧可显示其他成员</p>
|
<p>tip:多人同时在聊天室时,左侧可显示其他成员</p>
|
||||||
@@ -553,7 +567,9 @@ const getLastMessage = ((receiveId, itemType) => {
|
|||||||
|
|
||||||
</div> -->
|
</div> -->
|
||||||
<textarea class="bottom-input" v-model="currentInputValue" @input="updateInputValue"
|
<textarea class="bottom-input" v-model="currentInputValue" @input="updateInputValue"
|
||||||
@keyup.enter="onclickSendMsg()">
|
@keydown="handleKeydownInput"
|
||||||
|
|
||||||
|
>
|
||||||
|
|
||||||
</textarea>
|
</textarea>
|
||||||
<div class="bottom-send">
|
<div class="bottom-send">
|
||||||
|
|||||||
@@ -107,7 +107,7 @@
|
|||||||
<AccessLogChart :option="accessLogOptins" style="height: 600px;width: 1200px;" />
|
<AccessLogChart :option="accessLogOptins" style="height: 600px;width: 1200px;" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="注册统计" name="RegisterChart" style="display: flex;justify-content: center;">
|
<el-tab-pane label="注册统计" name="RegisterChart" style="display: flex;justify-content: center;">
|
||||||
即将上线,敬请期待
|
<AccessLogChart :option="registerLogOptins" style="height: 600px;width: 1200px;" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
|
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
@@ -206,6 +206,7 @@ import {
|
|||||||
getRecommendedFriend,
|
getRecommendedFriend,
|
||||||
getRankingPoints,
|
getRankingPoints,
|
||||||
getUserAnalyse,
|
getUserAnalyse,
|
||||||
|
getRegisterAnalyse
|
||||||
} from "@/apis/analyseApi.js";
|
} from "@/apis/analyseApi.js";
|
||||||
import { getList as getAllDiscussList } from "@/apis/discussApi.js";
|
import { getList as getAllDiscussList } from "@/apis/discussApi.js";
|
||||||
import PointsRanking from "./components/PointsRanking/index.vue";
|
import PointsRanking from "./components/PointsRanking/index.vue";
|
||||||
@@ -218,6 +219,7 @@ const accessLogDialogVisible = ref(false)
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const accessAllList = ref([]);
|
const accessAllList = ref([]);
|
||||||
|
const registerAllList = ref([]);
|
||||||
|
|
||||||
const plateList = ref([]);
|
const plateList = ref([]);
|
||||||
const discussList = ref([]);
|
const discussList = ref([]);
|
||||||
@@ -323,6 +325,26 @@ const accessLogOptins = computed(() => {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//历史注册人员全部访问统计
|
||||||
|
const registerLogOptins = computed(() => {
|
||||||
|
return {
|
||||||
|
xAxis: {
|
||||||
|
data: registerAllList.value?.map((item, index) => {
|
||||||
|
return item.time.slice(0, 10);
|
||||||
|
|
||||||
|
})
|
||||||
|
},
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
data: registerAllList.value?.map((item, index) => {
|
||||||
|
return item.number;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const onClickMoneyTop = () => {
|
const onClickMoneyTop = () => {
|
||||||
|
|
||||||
router.push("/money");
|
router.push("/money");
|
||||||
@@ -347,14 +369,17 @@ watch(
|
|||||||
);
|
);
|
||||||
watch(
|
watch(
|
||||||
() => accessLogTab.value,
|
() => accessLogTab.value,
|
||||||
async(value) => {
|
async (value) => {
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case "AccessLogChart":
|
case "AccessLogChart":
|
||||||
const {data} = await getAccessList();
|
const { data } = await getAccessList();
|
||||||
accessAllList.value = data;
|
accessAllList.value = data;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "RegisterChart":
|
case "RegisterChart":
|
||||||
|
const { data: registerUserListData } = await getRegisterAnalyse();
|
||||||
|
registerAllList.value = registerUserListData;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user