相关代码如下 ,但是我不明白哪里来的model('reader') 我查看了数据库没有reader这张表
public function questions_list_action()
{
$output = array();
if ($answers = $this->model('reader')->fetch_answers_list($_GET['page'], 20))
{
foreach ($answers AS $key => $val)
{
$question_ids[$val['question_id']] = $val['question_id'];
$uids[$val['uid']] = $val['uid'];
}
$questions_info = $this->model('question')->get_question_info_by_ids($question_ids);
$users_info = $this->model('account')->get_user_info_by_uids($uids, TRUE);
foreach ($answers AS $key => $val)
{
$output['answers'][$val['answer_id']] = array(
'answer_id' => $val['answer_id'],
'question_id' => $val['question_id'],
'avatar' => get_avatar_url($val['uid'], 'mid'),
'user_name' => $users_info[$val['uid']]['user_name'],
'signature' => $users_info[$val['uid']]['signature'],
'agree_count' => $val['agree_count'],
'agree_users' => $this->model('answer')->get_vote_user_by_answer_id($val['answer_id']),
'answer_content' => FORMAT::parse_attachs(nl2br(FORMAT::parse_markdown($val['answer_content']))),
'add_time' => date_friendly($val['add_time']),
'uid' => $val['uid'],
);
}
foreach ($questions_info AS $key => $val)
{
$output['questions'][$val['question_id']] = array(
'question_id' => $val['question_id'],
'question_content' => $val['question_content'],
'question_detail' => FORMAT::parse_attachs(nl2br(FORMAT::parse_markdown($val['question_detail']))),
'answer_users' => $val['answer_users'],
'focus_count' => $val['focus_count'],
'view_count' => $val['view_count']
);
}
}
echo json_encode($output);
}
}
阅读全文
收起全文