12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- <?php
- namespace app\index\controller;
- use app\index\model\CommonModel;
- use app\index\model\ColumnModel;
- use app\index\model\ArticleModel;
- use app\index\controller\Base;
- class Index extends Base
- {
-
- public function index()//主页
- {
- $cum = new ColumnModel();//导航栏表
- $com = new CommonModel();//工具信息表
- // $cums = $cum->select();
- $column_id=input('column_id');
- //查询当前导航栏表名称
- $cid=$cum->find($column_id);
- //查询当前工具信息表下的信息
- $goods=$com->where(array('column_id'=>$column_id))->order('sort desc')->select();
-
- $this->assign([
- 'goods'=>$goods,
- 'cid'=>$cid,
- ]);
-
- return view();
-
-
- }
- public function title(){
- $id = input('id');
- $titles = db('good')->where('id',$id)->find();
-
- $this->assign([
- 'titles'=>$titles,
- ]);
- return view($titles['url']);
- }
-
- public function Homepage(){//文章页和工具页(主页)
- $aticle = new ArticleModel();//文章表
- $good = new CommonModel();//工具信息表
- $gds = $good->alias('a')
- ->field('a.*,b.catename')
- ->join('column b','a.column_id=b.id')->limit(8)->order('sort desc')->select();
- $ar = $aticle->limit(9)->order('time desc')->select();
- $this->assign([
- 'ar'=>$ar,
- 'gds'=>$gds,
- ]);
- return view();
- }
- public function Artis(){//文章页
- $aticle = new ArticleModel();//文章表
- $articles = $aticle->order('time desc')->paginate(10);
- $this->assign([
- 'articles'=>$articles,
- ]);
- return view();
- }
-
-
-
- }
|