摘要:<?phpnamespace 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\
<?php
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();
//查詢最新發(fā)布
$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;
}
}
批改老師:查無此人批改時間:2019-06-19 09:15:33
老師總結(jié):完成的不錯。把windows系統(tǒng)激活吧,到期就用不了。繼續(xù)加油