From 6f78c7d05ebbe8ff27013df859932c984ae95816 Mon Sep 17 00:00:00 2001 From: zjhsdtc Date: Mon, 14 Apr 2014 15:57:04 +0800 Subject: [PATCH] fix answer sort bug --- SEUHome/Lib/Action/QuestionAction.class.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/SEUHome/Lib/Action/QuestionAction.class.php b/SEUHome/Lib/Action/QuestionAction.class.php index 899620f..463c000 100644 --- a/SEUHome/Lib/Action/QuestionAction.class.php +++ b/SEUHome/Lib/Action/QuestionAction.class.php @@ -266,6 +266,14 @@ public function detail(){ $UltimateInfo = array_merge($AnswerInfo, $AnonymousInfo); } + foreach ($UltimateInfo as $key => $value) { + $support_count[$key] = $value['support_count']; + $create_time[$key] = $value['create_time']; + } + + array_multisort($support_count, $create_time, $UltimateInfo); + $UltimateInfo = array_reverse($UltimateInfo); + $this->assign('answers', $UltimateInfo); //判断是否是当前用户关注的问题