Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
meibuyu-rpc
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
without authentication
meibuyu-rpc
Commits
a98d35df
Commit
a98d35df
authored
Jul 31, 2020
by
王源
🎧
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加判断两个对象数组是否有不同的值
parent
507e00b3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
9 deletions
+32
-9
functions.php
src/functions.php
+32
-9
No files found.
src/functions.php
View file @
a98d35df
...
@@ -426,8 +426,8 @@ if (!function_exists('putLog')) {
...
@@ -426,8 +426,8 @@ if (!function_exists('putLog')) {
* @param string $dir 目录
* @param string $dir 目录
* @param string $filename 文件名称
* @param string $filename 文件名称
* date: 2020/3/18
* date: 2020/3/18
* @throws
* @return void
* @return void
* @throws
*/
*/
function
put_log
(
$output
=
'out-mes'
,
$filename
=
''
,
$dir
=
BASE_PATH
.
'/runtime/dev/'
)
function
put_log
(
$output
=
'out-mes'
,
$filename
=
''
,
$dir
=
BASE_PATH
.
'/runtime/dev/'
)
{
{
...
@@ -450,7 +450,6 @@ if (!function_exists('putLog')) {
...
@@ -450,7 +450,6 @@ if (!function_exists('putLog')) {
}
}
}
}
if
(
!
function_exists
(
'http_to_server_url'
))
{
if
(
!
function_exists
(
'http_to_server_url'
))
{
/**
/**
* description:将前端的绝对路径转化为服务端相对路径
* description:将前端的绝对路径转化为服务端相对路径
...
@@ -462,14 +461,11 @@ if (!function_exists('http_to_server_url')) {
...
@@ -462,14 +461,11 @@ if (!function_exists('http_to_server_url')) {
*/
*/
function
http_to_server_url
(
$path
)
function
http_to_server_url
(
$path
)
{
{
$path
=
ltrim
(
parse_url
(
$path
,
PHP_URL_PATH
),
'/'
);
$path
=
ltrim
(
parse_url
(
$path
,
PHP_URL_PATH
),
'/'
);
return
'public/'
.
$path
;
return
'public/'
.
$path
;
}
}
}
}
if
(
!
function_exists
(
'empty_string_2_null'
))
{
if
(
!
function_exists
(
'empty_string_2_null'
))
{
/**
/**
* 空字符串转NULL
* 空字符串转NULL
...
@@ -663,8 +659,8 @@ if (!function_exists('make_has_relation_function')) {
...
@@ -663,8 +659,8 @@ if (!function_exists('make_has_relation_function')) {
/**
/**
* 创建我有关联关系的函数
* 创建我有关联关系的函数
* @param array $relationColumns 关联关系的列 默认['id', 'name']
* @param array $relationColumns 关联关系的列 默认['id', 'name']
* @return Closure 返回关联关系的匿名函数
* @param callable|null $callback 内嵌级联调用
* @param callable|null $callback 内嵌级联调用
* @return Closure 返回关联关系的匿名函数
* @return Closure
* @return Closure
*/
*/
function
make_has_relation_function
(
$relationColumns
=
[
'id'
,
'name'
],
callable
$callback
=
null
)
function
make_has_relation_function
(
$relationColumns
=
[
'id'
,
'name'
],
callable
$callback
=
null
)
...
@@ -678,7 +674,6 @@ if (!function_exists('make_has_relation_function')) {
...
@@ -678,7 +674,6 @@ if (!function_exists('make_has_relation_function')) {
}
}
}
}
if
(
!
function_exists
(
'int_to_chr'
))
{
if
(
!
function_exists
(
'int_to_chr'
))
{
/**
/**
* 数字转字母 (类似于Excel列标)
* 数字转字母 (类似于Excel列标)
...
@@ -696,6 +691,34 @@ if (!function_exists('int_to_chr')) {
...
@@ -696,6 +691,34 @@ if (!function_exists('int_to_chr')) {
}
}
}
}
if
(
!
function_exists
(
'check_diff_val'
))
{
/**
* 判断两个对象数组是否有不同的值
* 后者里有前者的key时,但value不一样,返回true
* 后者里没有前者的key,或有key,但value一样时,返回false
* @param array $list
* @param array $data
* @return bool
*/
function
check_diff_val
(
array
$list
,
array
$data
)
{
foreach
(
$list
as
$key
=>
$val
)
{
if
(
isset
(
$data
[
$key
])
&&
$data
[
$key
])
{
if
(
is_array
(
$val
))
{
if
(
check_diff_val
(
$val
,
$data
[
$key
]))
{
return
true
;
}
}
else
{
if
(
$list
[
$key
]
!=
$data
[
$key
])
{
return
true
;
}
}
}
}
return
false
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment