Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ModStart
ModStartCMS
提交
388d49f1
ModStartCMS
项目概览
ModStart
/
ModStartCMS
通知
2
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
ModStartCMS
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
388d49f1
编写于
12月 12, 2021
作者:
ModStart
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
develop
上级
a855d466
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
146 addition
and
4 deletion
+146
-4
module/Vendor/Docs/release/2.1.0.md
module/Vendor/Docs/release/2.1.0.md
+1
-0
module/Vendor/Provider/IDManager/AbstractDbCacheIDManager.php
...le/Vendor/Provider/IDManager/AbstractDbCacheIDManager.php
+73
-0
module/Vendor/Provider/IDManager/AbstractIDManager.php
module/Vendor/Provider/IDManager/AbstractIDManager.php
+23
-0
module/Vendor/Provider/IDManager/IDManager.php
module/Vendor/Provider/IDManager/IDManager.php
+41
-0
vendor/modstart/modstart/src/Core/Dao/ModelUtil.php
vendor/modstart/modstart/src/Core/Dao/ModelUtil.php
+6
-2
vendor/modstart/modstart/src/Core/Util/ReUtil.php
vendor/modstart/modstart/src/Core/Util/ReUtil.php
+1
-1
vendor/modstart/modstart/views/core/grid/index.blade.php
vendor/modstart/modstart/views/core/grid/index.blade.php
+1
-1
未找到文件。
module/Vendor/Docs/release/2.1.0.md
浏览文件 @
388d49f1
-
新增:IDManager增强随机ID管理
-
优化:安装引导程序检测目录是否真实可写
module/Vendor/Provider/IDManager/AbstractDbCacheIDManager.php
0 → 100644
浏览文件 @
388d49f1
<?php
namespace
Module\Vendor\Provider\IDManager
;
use
Illuminate\Support\Facades\Cache
;
abstract
class
AbstractDbCacheIDManager
extends
AbstractIDManager
{
abstract
public
function
dbCacheAll
();
private
function
clearCache
()
{
Cache
::
forget
(
$this
->
name
()
.
'_All'
);
}
public
function
all
()
{
return
Cache
::
rememberForever
(
$this
->
name
()
.
'_All'
,
function
()
{
return
$this
->
dbCacheAll
();
});
}
public
function
add
(
$ids
)
{
$this
->
clearCache
();
}
public
function
remove
(
$ids
)
{
$this
->
clearCache
();
}
public
function
total
()
{
return
count
(
$this
->
all
());
}
private
function
idsPaginate
(
&
$ids
,
$page
,
$pageSize
)
{
$page
=
max
(
$page
,
1
);
$offset
=
max
(
$page
-
1
,
0
)
*
$pageSize
;
if
(
!
isset
(
$ids
[
$offset
]))
{
return
[];
}
$results
=
[];
for
(
$i
=
$offset
;
$i
<
$offset
+
$pageSize
;
$i
++
)
{
if
(
!
isset
(
$ids
[
$i
]))
{
break
;
}
$results
[]
=
$ids
[
$i
];
}
return
$results
;
}
public
function
paginate
(
$page
,
$pageSize
)
{
$ids
=
$this
->
all
();
return
$this
->
idsPaginate
(
$ids
,
$page
,
$pageSize
);
}
public
function
paginateRandom
(
$page
,
$pageSize
,
$cacheKey
=
'all'
,
$cacheMinutes
=
60
)
{
$ids
=
Cache
::
remember
(
$this
->
name
()
.
'_Random_'
.
$cacheKey
,
$cacheMinutes
,
function
()
{
$ids
=
$this
->
all
();
shuffle
(
$ids
);
return
$ids
;
});
return
$this
->
idsPaginate
(
$ids
,
$page
,
$pageSize
);
}
}
\ No newline at end of file
module/Vendor/Provider/IDManager/AbstractIDManager.php
0 → 100644
浏览文件 @
388d49f1
<?php
namespace
Module\Vendor\Provider\IDManager
;
abstract
class
AbstractIDManager
{
abstract
public
function
name
();
abstract
public
function
all
();
abstract
public
function
add
(
$ids
);
abstract
public
function
remove
(
$ids
);
abstract
public
function
total
();
abstract
public
function
paginate
(
$page
,
$pageSize
);
abstract
public
function
paginateRandom
(
$page
,
$pageSize
,
$cacheKey
=
'all'
,
$cacheMinutes
=
60
);
}
\ No newline at end of file
module/Vendor/Provider/IDManager/IDManager.php
0 → 100644
浏览文件 @
388d49f1
<?php
namespace
Module\Vendor\Provider\IDManager
;
class
IDManager
{
private
static
$instances
=
[];
public
static
function
register
(
$provider
)
{
self
::
$instances
[]
=
$provider
;
}
public
static
function
all
()
{
foreach
(
self
::
$instances
as
$k
=>
$v
)
{
if
(
$v
instanceof
\
Closure
)
{
self
::
$instances
[
$k
]
=
call_user_func
(
$v
);
}
else
if
(
is_string
(
$v
))
{
self
::
$instances
[
$k
]
=
app
(
$v
);
}
}
return
self
::
$instances
;
}
public
static
function
get
(
$name
)
{
$name
=
modstart_config
(
$name
,
$name
);
foreach
(
self
::
all
()
as
$manager
)
{
if
(
$manager
->
name
()
==
$name
)
{
return
$manager
;
}
}
return
null
;
}
}
\ No newline at end of file
vendor/modstart/modstart/src/Core/Dao/ModelUtil.php
浏览文件 @
388d49f1
...
...
@@ -257,7 +257,7 @@ class ModelUtil
return
ArrayUtil
::
fetchSpecifiedKeyToArray
(
$records
,
$idKey
);
}
public
static
function
values
(
$model
,
$field
,
$where
=
[])
public
static
function
values
(
$model
,
$field
,
$where
=
[]
,
$order
=
null
)
{
$flat
=
false
;
if
(
!
is_array
(
$field
))
{
...
...
@@ -266,7 +266,11 @@ class ModelUtil
}
else
{
$fields
=
$field
;
}
$ms
=
self
::
model
(
$model
)
->
where
(
$where
)
->
get
(
$fields
)
->
toArray
();
$ms
=
self
::
model
(
$model
)
->
where
(
$where
);
if
(
!
empty
(
$order
))
{
$ms
=
$ms
->
orderBy
(
$order
[
0
],
$order
[
1
]);
}
$ms
=
$ms
->
get
(
$fields
)
->
toArray
();
if
(
$flat
)
{
return
array_map
(
function
(
$item
)
use
(
$field
)
{
return
$item
[
$field
];
...
...
vendor/modstart/modstart/src/Core/Util/ReUtil.php
浏览文件 @
388d49f1
...
...
@@ -38,7 +38,7 @@ class ReUtil
{
$wild
=
str_replace
(
'*'
,
'__x__star__'
,
$wild
);
$regex
=
'/^'
.
preg_quote
(
$wild
,
'/'
)
.
'$/'
;
$regex
=
str_replace
(
'__x__star__'
,
'
[a-zA-Z0-9_]+
'
,
$regex
);
$regex
=
str_replace
(
'__x__star__'
,
'
.*
'
,
$regex
);
// echo "isWildMatch ==> $regex <-> $text\n";
return
preg_match
(
$regex
,
$text
);
}
...
...
vendor/modstart/modstart/views/core/grid/index.blade.php
浏览文件 @
388d49f1
...
...
@@ -147,7 +147,7 @@
curr
:
data
.
page
,
count
:
data
.
total
,
limit
:
data
.
pageSize
,
limits
:
[
10
,
20
,
50
,
100
,
500
,
1000
],
limits
:
[
10
,
20
,
50
,
100
],
layout
:
[
'
limit
'
,
'
prev
'
,
'
page
'
,
'
next
'
,
'
count
'
,],
jump
:
function
(
obj
,
first
)
{
if
(
!
first
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录