Index.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace app\index\controller;
  3. use app\index\model\CommonModel;
  4. use app\index\model\ColumnModel;
  5. use app\index\controller\Base;
  6. class Index extends Base
  7. {
  8. public function index()//主页
  9. {
  10. $cum = new ColumnModel();//导航栏表
  11. $com = new CommonModel();//工具信息表
  12. // $cums = $cum->select();
  13. $column_id=input('column_id');
  14. //查询当前导航栏表名称
  15. $cid=$cum->find($column_id);
  16. //查询当前工具信息表下的信息
  17. $goods=$com->where(array('column_id'=>$column_id))->order('sort desc')->select();
  18. $this->assign([
  19. 'goods'=>$goods,
  20. 'cid'=>$cid,
  21. ]);
  22. return view();
  23. }
  24. public function title(){
  25. $id = input('id');
  26. $titles = db('good')->where('id',$id)->select();
  27. foreach ($titles as $val) {
  28. $column_id = $val['column_id'];
  29. }
  30. $cid=db('column')->where('id',$column_id)->select();
  31. foreach ($cid as $value) {
  32. $catename = $value['catename'];
  33. }
  34. $this->assign([
  35. 'titles'=>$titles,
  36. 'catename'=>$catename,
  37. ]);
  38. return view();
  39. }
  40. }