前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >用于 DLE 的统计模块“LightStat”3.0

用于 DLE 的统计模块“LightStat”3.0

作者头像
Dabenshi
发布2023-05-26 13:56:48
2340
发布2023-05-26 13:56:48
举报
文章被收录于专栏:DabenshiDabenshi

文章引自https://www.pandoge.com/moduli-i-skripty/modul-statistiki-lightstat-30-dlya-dle此文只为记录自己编译过程中一些心得和记录

模块功能:

  • 无需重新加载页面即可自动刷新数据。
  • 数据缓存(我知道很多人都问过这个问题)。
  • 自适应设计。
  • 与 2.0 版本相比,搜索机器人的基础得到了扩展,这使得统计数据更加准确。
  • 用于深色和浅色网站设计的两个小部件主题。深色主题默认开启。
  • 仅计算活跃访问者。如果在给定的时间内一个人没有在网站上显示任何活动(例如,长时间离开计算机),则认为他不在。当活动恢复时,它会自动包含在统计中,无需刷新页面。
  • 在方便的列表中显示当天访问过该站点的所有站点用户。默认情况下,最后 3 个用户显示在列表中;如果有更多用户,则会出现一个特殊按钮,允许您显示整个人员列表。按上次访问时间从小到大排序。它还显示用户的状态,如果他在网站上,以及他上次在网站上的时间,如果他在指定的时间不活跃,以进行统计。
  • 为用户名添加了一个特殊的类。这取决于它所在的组,并允许您在视觉上将一个人与其他组区分开来。用于标记站点上具有特殊权限的管理员和组的有用功能。
  • 修复了之前版本中发现的模块工作和布局中的一些不准确之处。

安装模块:

如果您之前使用过2.0版本的模块,那么第一步应该跳过。如果您是第一次使用该模块,请对您的数据库进行以下 SQL 查询:

代码语言:javascript
复制
CREATE TABLE `您的数据库名称`.`dle_lightstat` (`ip` VARCHAR(32) NOT NULL , `time` INT(11) NOT NULL, `type` INT(1) NOT NULL, PRIMARY KEY (`ip`), INDEX (`type`)) ENGINE = MyISAM;

 接下来,下载文末压缩包,解压lightstat.php文件,通过FTP或其他方便的方式上传到/engine/modules/文件夹。将丢失的头像文件(no_avatar_lightstat.png)上传到图像文件夹,该文件夹应该位于您的主题文件夹(/模板/您的主题/)中。如果您的站点上没有这样的文件夹,请创建它。

将统计小部件连接到您网站上的正确位置:

代码语言:javascript
复制
{include file="engine/modules/lightstat.php"}

然后在你的样式表(在最底部)粘贴以下样式:

代码语言:javascript
复制
.lightstat_main * {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

.lightstat_main *:before, .lightstat_main *:after {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

.lightstat_main {
    min-width: 230px;
    width: 100%;
    margin: 0 auto;
    font-family: arial;
    box-shadow: 0 4px 10px rgba(0, 0, 0, .1);
    border-radius: 8px;
}

.lightstat_progress {
    width: 100%;
    padding: 0 10px;
}

.lightstat_progress span {
    height: 4px;
    display: block;
    float: left;
}

.lightstat_progress span:nth-of-type(1) {
    border-top-left-radius: 2px;
    border-bottom-left-radius: 2px;
}

.lightstat_progress span:nth-last-of-type(1) {
    border-top-right-radius: 2px;
    border-bottom-right-radius: 2px;
}

.lightstat_body {
    background: #242043;
    border-radius: 8px 8px 0 0;
    padding: 15px 0 1px 0;
}

.lightstat_body.border_none_user {
    border-radius: 8px;
}

.lightstat_body .result_numb div {
    padding: 0 10px 11px 10px;
    color: #bbb;
    font-size: 14px;
    text-shadow: 0 -1px 0 rgba(0, 0, 0, .6);
}

.lightstat_body .result_numb div span:nth-of-type(1) {
    width: 8px;
    height: 8px;
    display: inline-block;
    border-radius: 99px;
    margin: 4px 10px 0 0;
    vertical-align: top;
    box-shadow: 0px -1px 1px rgba(0, 0, 0, .6);
}

.lightstat_body .result_numb div span:nth-of-type(2) {
    float: right;
    color: #fff;
}

.lightstat_body .result_numb .lightstat_user span:nth-of-type(1) {
    border: 2px solid #d9823b;
}

.lightstat_body .result_numb .lightstat_guest span:nth-of-type(1) {
    border: 2px solid #a963b9;
}

.lightstat_body .result_numb .lightstat_bot span:nth-of-type(1) {
    border: 2px solid #36a7a5;
}

.lightstat_user_circle {
    background: #d9823b;
}

.lightstat_guest_circle {
    background: #a963b9;
}

.lightstat_bot_circle {
    background: #36a7a5;
}

.lightstat_is {
    color: #fff;
    font-size: 10px;
    text-transform: uppercase;
    padding: 18px 0 15px 28px;
    display: block;
    text-shadow: 0 -1px 0 rgba(0, 0, 0, .6);
}

.lightstat_user_list {
    background: #fff;
    border-radius: 0 0 8px 8px;
    position: relative;
}

.lightstat_pandoge_com {
    width: 8px;
    height: 20px;
    position: relative; 
    background: #222;
    display: block;
    position: absolute;
    top: 0;
    right: 20px;
    transition: .2s;
}

.lightstat_pandoge_com:after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 0;
    border-bottom: 4px solid #d1d5d8;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
}

.lightstat_pandoge_com:hover {
    height: 24px;
    transition: .2s;
}

.lightstat_user_list_title {
    color: #242043;
    font-size: 10px;
    text-transform: uppercase;
    padding: 18px 0 17px 28px;
    display: block;
    font-weight: 700;
}

.lightstat_user_list_item {
    padding: 0 10px 20px 10px;
    display: -ms-flexbox;
    display: -webkit-flex;
    display: flex;
    -ms-flex-wrap: wrap;
    -webkit-flex-wrap: wrap;
    flex-wrap: wrap;
    -ms-flex-pack: justify;
    -webkit-justify-content: space-between;
    justify-content: space-between;
}

.lightstat_user_list_item a {
    text-decoration: none !important;
    color: #242043;
}

.lightstat_user_list_item_avatar {
    background-size: cover !important;
    border-radius: 99px;
    width: 34px;
    height: 34px;
    display: block;
}

.lightstat_user_list_item_avatar:hover {
    opacity: .8;
}

.lightstat_user_list_item_info {
    font-size: 12px;
    font-weight: 700;
    width: calc(100% - 34px);
    padding: 1px 0 0 10px;
}

.lightstat_user_list_item_info span {
    display: block;
    font-weight: 400;
    padding: 2px 0 0 0;
    color: #888;
}

.lightstat_user_list_item_info span.online {
    color: #0e8952;
}

.lightstat_user_list_item_info a:hover {
    text-decoration: underline !important;
}

.full_list_visit {
    margin: auto;
    color: #242043;
    font-size: 10px;
    text-transform: uppercase;
    display: block;
    font-weight: 700;
    width: 120px;
    text-align: center;
    background: #fff;
    border-radius: 99px;
    height: 26px;
    line-height: 26px;
    border: 1px solid #888;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .1);
}

.full_list_visit:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, .2);
}

.full_list_visit_bg {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    border-radius: 0 0 8px 8px;
    z-index: 2;
    background: -moz-linear-gradient(bottom, rgba(255, 255, 255, .1) 0, rgba(255, 255, 255, 1) 100%);
    background: -webkit-linear-gradient(bottom, rgba(255, 255, 255, .1) 0, rgba(255, 255, 255, 1) 100%);
    background: linear-gradient(to bottom, rgba(255, 255, 255, .1) 0, rgba(255, 255, 255, 1) 100%);
    padding: 20px 0;
}

.lightstat_user_list_item {
    display: none;
}

.lightstat_user_list .lightstat_user_list_item:nth-of-type(1), .lightstat_user_list .lightstat_user_list_item:nth-of-type(2), .lightstat_user_list .lightstat_user_list_item:nth-of-type(3) {
    display: flex;
}

.lightstat_light_theme .lightstat_body {
    background: #f1f5f7;
}

.lightstat_light_theme .lightstat_body {
    background: #f1f5f7;
}

.lightstat_light_theme .lightstat_user_list_item a {
    color: #030304;
}

.lightstat_light_theme .lightstat_user_list_title {
    color: #030304;
}

.lightstat_light_theme .lightstat_body .result_numb div span:nth-of-type(2) {
    color: #283e52;
}

.lightstat_light_theme .lightstat_body .result_numb div {
    color: #030304;
    text-shadow: none;
}

.lightstat_light_theme .lightstat_is {
    text-shadow: none;
    color: #283e52;
}

.lightstat_light_theme .lightstat_body .result_numb .lightstat_user span:nth-of-type(1) {
    border: 2px solid #0bb1d6;
    box-shadow: none;
}

.lightstat_light_theme .lightstat_body .result_numb .lightstat_guest span:nth-of-type(1) {
    border: 2px solid #ff6d00;
    box-shadow: none;
}

.lightstat_light_theme .lightstat_body .result_numb .lightstat_bot span:nth-of-type(1) {
    border: 2px solid #345471;
    box-shadow: none;
}

.lightstat_light_theme .lightstat_user_circle {
    background: #0bb1d6;
}

.lightstat_light_theme .lightstat_guest_circle {
    background: #ff6d00;
}

.lightstat_light_theme .lightstat_bot_circle {
    background: #345471;
}

模块设置:

第一个设置是更改小部件的主题。如果要启用浅色主题,则使用以下代码将其激活:

代码语言:javascript
复制
{include file="engine/modules/lightstat.php?theme_light=active"}

第二个设置是根据他的组更改用户登录的类型。可以使用的样式如下:

代码语言:javascript
复制
.group_id_NUMB a {
    
    /* 你的风格 */
    
}

您将其插入到样式表中。这里“ NUMB ”是用户的组ID。您可以在“用户”-“设置用户组”部分中找到组的 ID。

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2021-10-05,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档