Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYWAP
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
Rock Zhang
9 years ago
Commit
935c9acfc90ad63f31cabdbcb5e729826efd54e4
1 parent
c8b3eb7d
修复限购商品分享详情页显示的问题
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
library/Plugin/Helpers.php
yohobuy/m.yohobuy.com/application/models/Product/Detail.php
library/Plugin/Helpers.php
View file @
935c9ac
...
...
@@ -899,17 +899,18 @@ class Helpers
/**
* 按照数组中指定字段排序二维数组
*
* @param array &$array 需要排序的数组
* @param string $field 字段名称
* @param boolean $desc 时候降序排列,默认为false
* @param array &$array 需要排序的数组
* @param string $field 字段名称
* @param boolean $desc 时候降序排列,默认为false
* @param int $sortType 排序方式
*/
public
static
function
sortArrByField
(
&
$array
,
$field
,
$desc
=
false
)
public
static
function
sortArrByField
(
&
$array
,
$field
,
$desc
=
false
,
$sortType
=
SORT_REGULAR
)
{
$fieldArr
=
array
();
foreach
(
$array
as
$k
=>
$v
)
{
$fieldArr
[
$k
]
=
isset
(
$v
[
$field
])
?
$v
[
$field
]
:
''
;
}
$sort
=
$desc
==
false
?
SORT_ASC
:
SORT_DESC
;
array_multisort
(
$fieldArr
,
$sort
,
$array
);
array_multisort
(
$fieldArr
,
$sort
,
$array
,
$sortType
);
}
}
...
...
yohobuy/m.yohobuy.com/application/models/Product/Detail.php
View file @
935c9ac
...
...
@@ -824,7 +824,7 @@ class DetailModel
}
if
(
count
(
$result
)
>
1
)
{
Helpers
::
sortArrByField
(
$result
,
'orderBy'
,
true
);
Helpers
::
sortArrByField
(
$result
,
'orderBy'
,
true
,
SORT_NUMERIC
);
}
return
$result
;
...
...
Please
register
or
login
to post a comment