where($where);} if($orderby == 'rand()'){$model = $model->orderBy(\DB::raw('rand()'));}else{$model = $model->orderBy($orderby[0], $orderby[1]);} $count = $model->count(); $list = object_to_array($model->skip($skip)->take($PageSize)->get()); if(!empty($list) && $PageIndex<=10) { /* foreach($list as $key=>$row) { //$list[$key]["pubdate"] = date("Y-m-d", $list[$key]["pubdate"]); $result .= '
'; if(!empty($row['litpic']) && file_exists($_SERVER['DOCUMENT_ROOT'].$row['litpic'])) { $result .= ''.$row['title'].''; } $result .= ''.$row['title'].'

'.mb_strcut(strip_tags($row['description']),0,126,'UTF-8').'..[详情]

'; $result .= '
'.date("Y-m-d H:i",$row['pubdate']).''.$row['click'].'人阅读
'; } */ foreach($list as $key=>$row) { $list[$key]["url"] = get_front_url(array("id"=>$row['id'],"catid"=>$row['typeid'],"type"=>'content')); } $res["data"] = $list; } /* $result['List']=$list; $result['Count']=$count>0?$count:0; */ //return $res; exit(json_encode($res)); } //测试页面 public function test() { return date("Y-m-d H:i:s",strtotime("2017-04")); } }