Skip to content

Commit facec70

Browse files
committed
优化:管理日志数据字段列表优化
1 parent 22dbba0 commit facec70

File tree

7 files changed

+266
-245
lines changed

7 files changed

+266
-245
lines changed

module/Vendor/Provider/SiteTemplate/AbstractSiteTemplateProvider.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
namespace Module\Vendor\Provider\SiteTemplate;
55

66

7+
use ModStart\Form\Form;
8+
79
/**
810
* Class AbstractSiteTemplateProvider
911
* @package Module\Vendor\Provider\SiteTemplate
@@ -19,4 +21,23 @@ public function root()
1921
{
2022
return null;
2123
}
24+
25+
/**
26+
* 主题是否有额外定制配置
27+
* @return false
28+
*/
29+
public function hasConfig()
30+
{
31+
return false;
32+
}
33+
34+
/**
35+
* 主题的配置表单
36+
* @param $form Form 表单
37+
* @param $param array 额外参数
38+
*/
39+
public function config(Form $form, $param = [])
40+
{
41+
42+
}
2243
}

module/Vendor/Provider/SiteTemplate/SiteTemplateProvider.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55

66

77
/**
8-
* Class SiteTemplateProvider
9-
* @package Module\Vendor\Provider\SiteTemplate
10-
* @since 1.5.0
8+
* 模板提供者,所有模板都需要在这里注册
119
*/
1210
class SiteTemplateProvider
1311
{

vendor/modstart/modstart/src/Admin/Controller/AdminLogController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ protected function grid()
2525
$grid->select('adminUserId', L('Admin User'))->optionModel('admin_user', 'id', 'username');
2626
$grid->type('type', L('Type'))->type(AdminLogType::class)->width(100);
2727
$grid->display('summary', L('Title'));
28-
$grid->jsonKeyValue('data.content', L('Data'));
28+
$grid->jsonKeyValue('data.content', L('Data'))->width(200);
2929
$grid->display('created_at', L('Created At'))->width(160);
3030
$grid->gridFilter(function (GridFilter $filter) {
3131
$filter->eq('adminUserId', L('Admin User'))->selectModel('admin_user', 'id', 'username');

vendor/modstart/modstart/src/Core/Dao/ModelUtil.php

Lines changed: 207 additions & 182 deletions
Large diffs are not rendered by default.

vendor/modstart/modstart/src/Core/Util/AgentUtil.php

Lines changed: 10 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Illuminate\Support\Facades\Request;
66
use Jenssegers\Agent\Facades\Agent;
7+
use ModStart\Core\Exception\BizException;
78

89
/**
910
* @Util 客户端
@@ -69,52 +70,21 @@ public static function isPC()
6970

7071
private static $robots = [
7172

72-
'/Googlebot/i' => 'Google',
73-
'/Baiduspider/i' => 'Baidu',
74-
'/360Spider/i' => '360',
75-
'/Sogou/i' => 'Sogou',
73+
'/googlebot/i' => 'Google',
74+
'/baiduspider/i' => 'Baidu',
75+
'/360spider/i' => '360',
76+
'/sogou/i' => 'Sogou',
7677
'/bingbot/i' => 'Bing',
77-
'/Bytespider/i' => 'TouTiao',
78+
'/bytespider/i' => 'TouTiao',
7879

7980
'/crawler/i' => 'Other',
8081
'/spider/i' => 'Other',
81-
// 通用匹配 XxxBot
82-
'/(?:^|[\\W])\\w+bot[\\W]*/i' => 'Other',
83-
'/Detector/' => 'Other',
82+
// xxxbot
83+
'/(?:^|[\\W])\\w*bot([\\W\\s]|$)/i' => 'Other',
84+
'/detector/' => 'Other',
8485

8586
// 其他一些爬虫
86-
'/YandexImages/i' => 'Other',
87-
'/CensysInspect/i' => 'Other',
88-
'/GoogleOther/i' => 'Other',
89-
'/duckduckgo\\.com/i' => 'Other',
90-
'/Dataprovider\\.com/i' => 'Other',
91-
'/NetcraftSurveyAgent/i' => 'Other',
92-
'/Scrapy/i' => 'Other',
93-
'/linkfluence/i' => 'Other',
94-
'/github\\-camo/i' => 'Other',
95-
'/msray/i' => 'Other',
96-
'/InternetMeasurement/i' => 'Other',
97-
'/Vue\\-Telescope/i' => 'Other',
98-
'/2ip\\.io/i' => 'Other',
99-
'/facebookexternalhit/i' => 'Other',
100-
'/Wordupindexinfo/i' => 'Other',
101-
'/researchscan/i' => 'Other',
102-
'/woorankreview/i' => 'Other',
103-
'/Avant Browser/i' => 'Other',
104-
105-
// 一些语言库、命令行
106-
'/Wget\\/\\d+/i' => 'Other',
107-
'/python\\-(http|requests|urllib)/i' => 'Other',
108-
'/curl\\/\\d+\\.\\d+\\./i' => 'Other',
109-
'/Java\\/\\d+\\.\\d+\\./i' => 'Other',
110-
'/Ruby/i' => 'Other',
111-
'/aiohttp/i' => 'Other',
112-
'/cpp\\-httplib/i' => 'Other',
113-
'/node\\-fetch/i' => 'Other',
114-
'/Go\\-http\\-client/i' => 'Other',
115-
'/okhttp/i' => 'Other',
116-
'/GuzzleHttp/i' => 'Other',
117-
'/Apache\\-HttpClient/i' => 'Other',
87+
'/ows\\.eu/i' => 'Other', // OpenWebSearch
11888
];
11989

12090
/**

vendor/modstart/modstart/src/Core/Util/PageHtmlUtil.php

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
*/
88
class PageHtmlUtil
99
{
10-
private static function itemRender($start, $end, $currentPage, $url)
10+
private static function itemRender($start, $end, $currentPage, $url, $template)
1111
{
1212
$html = [];
1313
for ($i = $start; $i <= $end; $i++) {
1414
if ($i == $currentPage) {
15-
$html[] = '<span class="current">' . $i . '</span>';
15+
$html[] = sprintf($template['current'], $i);
1616
} else {
17-
$html[] = '<a class="page" href="' . str_replace('{page}', $i, $url) . '">' . $i . '</a>';
17+
$html[] = sprintf($template['item'], str_replace('{page}', $i, $url), $i);
1818
}
1919
}
2020
return join('', $html);
@@ -57,9 +57,21 @@ public static function prevPageUrl($total, $pageSize, $currentPage, $url = '/url
5757
* @param $pageSize int 每页记录数
5858
* @param $currentPage int 当前页
5959
* @param $url string 分页链接,页码使用 {page} 占位
60+
* @param $template string 模板
6061
*/
61-
public static function render($total, $pageSize, $currentPage, $url = '/url/for/path?page={page}')
62+
public static function render($total, $pageSize, $currentPage, $url = '/url/for/path?page={page}', $template = null)
6263
{
64+
if (is_null($template)) {
65+
$template = [
66+
'warp' => '<div class="pages">%s</div>',
67+
'more' => '<span class="more">...</span>',
68+
'prev' => '<a class="page" href="%s">' . L('NextPage') . '</a>',
69+
'next' => '<a class="page" href="%s">' . L('PrevPage') . '</a>',
70+
'current' => '<span class="current">%d</span>',
71+
'item' => '<a class="page" href="%s">%d</a>',
72+
];
73+
}
74+
6375
$totalPage = ceil($total / $pageSize);
6476

6577
if ($currentPage < 1) {
@@ -70,16 +82,13 @@ public static function render($total, $pageSize, $currentPage, $url = '/url/for/
7082

7183
$html = [];
7284

73-
74-
$html[] = '<div class="pages">';
75-
7685
if ($totalPage < 6) {
7786
if ($totalPage > 0) {
78-
$html[] = self::itemRender(1, $totalPage, $currentPage, $url);
87+
$html[] = self::itemRender(1, $totalPage, $currentPage, $url, $template);
7988
}
8089
} else {
8190

82-
$html[] = self::itemRender(1, 3, $currentPage, $url);
91+
$html[] = self::itemRender(1, 3, $currentPage, $url, $template);
8392

8493
$midStart = $currentPage - 3;
8594
$midEnd = $currentPage + 3;
@@ -90,28 +99,26 @@ public static function render($total, $pageSize, $currentPage, $url = '/url/for/
9099
$midEnd = $totalPage - 3;
91100
}
92101
if ($midStart > 3 + 1) {
93-
$html[] = '<span class="more">...</span>';
102+
$html[] = $template['more'];
94103
}
95104

96-
$html[] = self::itemRender($midStart, $midEnd, $currentPage, $url);
105+
$html[] = self::itemRender($midStart, $midEnd, $currentPage, $url, $template);
97106

98107
if ($midEnd < $totalPage - 3) {
99-
$html[] = '<span class="more">...</span>';
108+
$html[] = $template['more'];
100109
}
101110

102-
$html[] = self::itemRender($totalPage - 2, $totalPage, $currentPage, $url);
111+
$html[] = self::itemRender($totalPage - 2, $totalPage, $currentPage, $url, $template);
103112
}
104113

105114
if ($currentPage > 1) {
106-
$html[] = '<a class="page" href="' . str_replace('{page}', ($currentPage - 1), $url) . '">上一页</a>';
115+
$html[] = sprintf($template['prev'], str_replace('{page}', ($currentPage - 1), $url));
107116
}
108117

109118
if ($currentPage < $totalPage) {
110-
$html[] = '<a class="page" href="' . str_replace('{page}', ($currentPage + 1), $url) . '">下一页</a>';
119+
$html[] = sprintf($template['next'], str_replace('{page}', ($currentPage + 1), $url));
111120
}
112121

113-
$html[] = '</div>';
114-
115-
return join('', $html);
122+
return sprintf($template['warp'], join('', $html));
116123
}
117124
}

vendor/modstart/modstart/views/core/field/keyValueList.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<div class="field">
1010
<div id="{{$id}}Input" v-cloak>
1111
<input type="hidden" name="{{$name}}" :value="jsonValue" />
12-
<table class="ub-table border border-all">
12+
<table class="ub-table border border-all tw-bg-white">
1313
<thead>
1414
<tr>
1515
<th width="200">{{$keyTitle}}</th>

0 commit comments

Comments
 (0)