homepagePHP/app/Home/Widget/SidebarWidget.class.php

38 lines
1.2 KiB
PHP
Executable File

<?php
namespace Home\Widget;
use Gy_Library\DBCont;
use Gy_Library\HomeController;
class SidebarWidget extends HomeController{
public function index()
{
$public_advertisement = D('PublicAdvertisement')->where(['status'=>DBCont::YES_BOOL_STATUS])->order('sort asc,id desc')->select();
$this->advertisement =$public_advertisement;
$focus = D('Focus')->where(['status'=>DBCont::YES_BOOL_STATUS])->order('sort asc,id desc')->select();
$this->focus =$focus;
//热文排行
$map['status'] = DBCont::YES_BOOL_STATUS;
//排行新闻
$news_sort = D('News')->where($map)->order('click_time desc')->limit(10)->select();
$this->news_sort = $news_sort;
$cate_id = I('get.cate_id');
$this->cate_id =!empty($cate_id)?$cate_id:0;
$id = I('get.id');
if(!empty($id)){
$this->id =$id;
}
// 议题分类
$news_cate = D('NewsCate')->where($map)->order('sort asc,id desc')->select();
$this->news_cate = $news_cate;
$keyword_res = D('Keywords')->where(['status'=>DBCont::YES_BOOL_STATUS])->order('total_time desc,sort asc,id asc')->select();
$this->keyword =$keyword_res;
$this->display('Widget/sidebar');
}
}