public function get_posts_list($post_type, $page = 1, $per_page = 10, $sort = null, $topic_ids = null, $category_id = null, $answer_count = null, $day = 30, $is_recommend = false)
{
$order_key = 'add_time DESC';
switch ($sort)
{
case 'responsed':
$answer_count = 1;
break;
case 'unresponsive':
$answer_count = 0;
break;
case 'new' :
$order_key = 'update_time DESC';
break;
}
if (is_array($topic_ids))
{
foreach ($topic_ids AS $key => $val)
{
if (!$val)
{
unset($topic_ids[$key]);
}
}
}
if ($topic_ids)
{
$posts_index = $this->get_posts_list_by_topic_ids($post_type, $post_type, $topic_ids, $category_id, $answer_count, $order_key, $is_recommend, $page, $per_page);
}
else
{
$where = array();
if (isset($answer_count))
{
$answer_count = intval($answer_count);
if ($answer_count == 0)
{
$where[] = "answer_count = " . $answer_count;
}
else if ($answer_count > 0)
{
$where[] = "answer_count >= " . $answer_count;
}
}
if ($is_recommend)
{
$where[] = 'is_recommend = 1';
}
if ($category_id)
{
$where[] = 'category_id IN(' . implode(',', $this->model('system')->get_category_with_child_ids('question', $category_id)) . ')';
}
if ($post_type)
{
$where[] = "post_type = '" . $this->quote($post_type) . "'";
}
$posts_index = $this->fetch_page('posts_index', implode(' AND ', $where), $order_key, $page, $per_page);
$this->posts_list_total = $this->found_rows();
}
return $this->process_explore_list_data($posts_index);
}
写得太乱了 看不懂!
现在官方这模型代码没有关联aws_attach表查询
阅读全文
收起全文