会话列表排序
This commit is contained in:
@@ -140,6 +140,25 @@ function simple_decrypt(string $ciphertext, string $key): string|false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 多维数组排序
|
||||
*/
|
||||
function param_sort($chatList, $param)
|
||||
{
|
||||
usort($chatList, function ($a, $b) use($param) {
|
||||
// 将时间字符串转为时间戳,便于比较
|
||||
$timeA = strtotime($a[$param]);
|
||||
$timeB = strtotime($b[$param]);
|
||||
|
||||
// 倒序:$timeB - $timeA(正序则$timeA - $timeB)
|
||||
return $timeB - $timeA;
|
||||
});
|
||||
|
||||
return $chatList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 微信风格时间格式化(仅用原生 date/strtotime 函数,周一为一周起点)
|
||||
|
||||
Reference in New Issue
Block a user