Authored by 梁志锋

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

@@ -899,17 +899,18 @@ class Helpers @@ -899,17 +899,18 @@ class Helpers
899 /** 899 /**
900 * 按照数组中指定字段排序二维数组 900 * 按照数组中指定字段排序二维数组
901 * 901 *
902 - * @param array &$array 需要排序的数组  
903 - * @param string $field 字段名称  
904 - * @param boolean $desc 时候降序排列,默认为false 902 + * @param array &$array 需要排序的数组
  903 + * @param string $field 字段名称
  904 + * @param boolean $desc 时候降序排列,默认为false
  905 + * @param int $sortType 排序方式
905 */ 906 */
906 - public static function sortArrByField(&$array, $field, $desc = false) 907 + public static function sortArrByField(&$array, $field, $desc = false, $sortType = SORT_REGULAR)
907 { 908 {
908 $fieldArr = array(); 909 $fieldArr = array();
909 foreach ($array as $k => $v) { 910 foreach ($array as $k => $v) {
910 $fieldArr[$k] = isset($v[$field]) ? $v[$field] : ''; 911 $fieldArr[$k] = isset($v[$field]) ? $v[$field] : '';
911 } 912 }
912 $sort = $desc == false ? SORT_ASC : SORT_DESC; 913 $sort = $desc == false ? SORT_ASC : SORT_DESC;
913 - array_multisort($fieldArr, $sort, $array); 914 + array_multisort($fieldArr, $sort, $array, $sortType);
914 } 915 }
915 } 916 }
@@ -824,7 +824,7 @@ class DetailModel @@ -824,7 +824,7 @@ class DetailModel
824 } 824 }
825 825
826 if(count($result) > 1) { 826 if(count($result) > 1) {
827 - Helpers::sortArrByField($result, 'orderBy', true); 827 + Helpers::sortArrByField($result, 'orderBy', true, SORT_NUMERIC);
828 } 828 }
829 829
830 return $result; 830 return $result;