public function lists_has_comments($documentid, $rows = 10, $order = 'creattime desc', $status = 1)
 {
     $haslist = $this->lists($documentid, $rows, $order, $status);
     if (!empty($haslist)) {
         foreach ($haslist as $key => $value) {
             if (!empty($value['fromuserid']) && !empty($value['fromuserid'])) {
                 $haslist[$key]['fromnickname'] = get_cms_username($value['fromuserid'], $value['fromusertype']);
                 $haslist[$key]['fromheadimg'] = get_cms_userpic($value['fromuserid'], $value['fromusertype']);
             }
             if (!empty($value['touserid']) && !empty($value['tousertype'])) {
                 $haslist[$key]['tonickname'] = get_cms_username($value['touserid'], $value['tousertype']);
                 $haslist[$key]['toheadimg'] = get_cms_userpic($value['touserid'], $value['tousertype']);
             }
             $haslist[$key]['creat_time'] = date('Y-m-d', $value['creattime']);
             $haslist[$key]['content'] = get_cms_samils($value['content']);
         }
     }
     return $haslist;
 }
 public function ajax_lists()
 {
     $latsp = I('post.page');
     $categoryid = I('post.category');
     if (empty($latsp) || empty($categoryid)) {
         $this->ajaxReturn(array('status' => 3, 'p' => $latsp, 'msg' => '请选择正确的分类'));
     }
     $p = $latsp + 1;
     /* 获取分类信息 */
     $category = D('Category')->info($categoryid);
     if ($category && 1 == $category['status']) {
         switch ($category['display']) {
             case 0:
                 $this->ajaxReturn(array('status' => 3, 'p' => $latsp, 'msg' => '该分类禁止显示!'));
                 break;
         }
     } else {
         $this->ajaxReturn(array('status' => 3, 'p' => $latsp, 'msg' => '分类不存在或被禁用!'));
     }
     $param = array('p' => $p, 'categoryid' => $category, 'list_row' => '', 'extend' => true);
     $newlist = api('Document/get_list', $param);
     //判断分类是否开启 评论 reply  reply_show
     if (!empty($category['reply']) && !empty($category['reply_show'])) {
         $replymodel = D('Replydocument');
         $tlocation = '岘港假期';
         foreach ($newlist as $key => $value) {
             $tongji .= $value['id'] . '|';
             $newrlist = array();
             $newrlist = $replymodel->lists_has_comments($value['id']);
             $newlist[$key]['replylist'] = $newrlist;
             $newlist[$key]['usernickname'] = get_cms_username($value['uid'], $value['usertype']);
             $newlist[$key]['create_time'] = date('Y-m-d', $value['create_time']);
             $newlist[$key]['detailurl'] = U('Article/detail?id=' . $value['id']);
             $newlist[$key]['userheadimg'] = get_cms_userpic($value['uid'], $value['usertype']);
             $newlist[$key]['tlocation'] = $tlocation;
         }
     }
     if (empty($newlist)) {
         $this->ajaxReturn(array('status' => 2, 'p' => $latsp, 'msg' => '到底咯~'));
     } else {
         $this->ajaxReturn(array('status' => 1, 'p' => $p, 'msg' => $newlist));
     }
 }