Authored by 梁志锋

Merge remote-tracking branch 'remotes/origin/develop/wap' into stable/wap

... ... @@ -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);
}
}
... ...
... ... @@ -824,7 +824,7 @@ class DetailModel
}
if(count($result) > 1) {
Helpers::sortArrByField($result, 'orderBy', true);
Helpers::sortArrByField($result, 'orderBy', true, SORT_NUMERIC);
}
return $result;
... ...