public function get_focus_users_action()
{
$focus_users = array();
if ($focus_users_info = $this->model('question')->get_focus_users_by_question($_GET['question_id']))
{
$question_info = $this->model('question')->get_question_info_by_id($_GET['question_id']);//为什么不直接定在main.php文件直接调用而写在ajax.php文件里又要去查询问题表,这个查询不是重复了吗?
foreach($focus_users_info as $key => $val)
{
if ($val['uid'] == $question_info['published_uid'] and $question_info['anonymous'] == 1)
{
$focus_users[$key] = array(
'uid' => 0,
'user_name' => AWS_APP::lang()->_t('匿名用户'),
'avatar_file' => get_avatar_url(0, 'mid'),
);
}
else
{
$focus_users[$key] = array(
'uid' => $val['uid'],
'user_name' => $val['user_name'],
'avatar_file' => get_avatar_url($val['uid'], 'mid'),
'url' => get_js_url('/people/' . $val['url_token'])
);
}
}
}
H::ajax_json_output($focus_users);
}
$question_info = $this->model('question')->get_question_info_by_id($_GET['question_id']);//为什么不直接定在main.php文件直接调用而写在ajax.php文件里又要去查询问题表,这个查询不是重复了吗?
阅读全文
收起全文