小型企业站前台模块

Original 2019-06-17 16:17:32 239
abstract:

namespace app\index\controller;


use think\Controller;

use think\facade\Request;

use app\index\model\Product;

use app\index\model\Slide;

use app\index\model\Newsl;

use app\index\model\System;

use app\index\model\Product as Db;



class Index extends Controller

{

public function index()

{

//轮播图

$lunbo = Slide::order('slide_id')->limit(4)->all();

//查询头牌

$toupan = Product::order('product_id')->limit(4)->all();


//最新资讯

$zixun = Newsl::order('news_id')->limit(2)->all();


//新上花魁

$huakui = Product::order('product_id')->limit(1)->all();

$this->assign('toupan',$toupan);

$this->assign('huakui',$huakui);

$this->assign('zixun',$zixun);

$this->assign('lunbo',$lunbo);

return $this->fetch();

}

public function about()

{


$gyu = System::all();

$this->assign('gyu',$gyu);

return $this->fetch();

}

public function connew()

{


$data = Request::param();



$news_id = $data['news_id'];


$news = Newsl::where('news_id',$news_id)->find();


//查询热门新闻一条

$newsrm = Newsl::order('news_id','desc')->find();

$this->assign('newsrm',$newsrm);


$this->assign('news',$news);

return $this->fetch();

}

public function conpro()

{

return $this->fetch();

}

public function news()

{

//查询新闻热点两条

$newsrmx = Newsl::order('news_id')->limit(2)->all();


//查询热门新闻一条

$newsrm = Newsl::order('news_id','desc')->limit(1)->all();


//查询最新发布

$newszx = Newsl::order('news_id','desc')->limit(4)->all();


$this->assign('newsrmx',$newsrmx);

$this->assign('newsrm',$newsrm);

$this->assign('newszx',$newszx);

return $this->fetch();

}

public function product()

{

$product = Db::order('product_id')->limit(3)->all();

$this->assign('product',$product);

return $this->fetch();

}

public function hello($name = 'ThinkPHP5')

{

return 'hello,' . $name;

}

}

[]1NVBVRS_I[D27GFW59JGO.png

Release Notes

Popular Entries