function sorting_by_sale($arrUsers, $direction="desc"){
if(empty($arrUsers)){
return $arrUsers;
}
$direArr = array("desc"=>'SORT_DESC', 'asc'=>"SORT_ASC");
$sort = array(
'direction' => $direArr[$direction], //排序順序标志 SORT_DESC 降序;SORT_ASC 升序
'field' => 'sale_total', //排序字段
);
$arrSort = array();
foreach($arrUsers AS $uniqid => $row){
foreach($row AS $key=>$value){
$arrSort[$key][$uniqid] = $value;
}
}
if($sort['direction']){
array_multisort($arrSort[$sort['field']], constant($sort['direction']), $arrUsers);
}
return $arrUsers;
}