SupportController.php 1.3 KB
<?php
namespace app\portal\controller;

use cmf\controller\HomeBaseController;
use app\portal\model\PortalCategoryModel;
use think\Db;

class SupportController extends HomeBaseController{

  public function _initialize(){

    parent::_initialize();
    $data = Db::name('slide_item') -> where('slide_id',3) -> find();
    $this -> assign('logo',$data);

    $shuju = Db::name('nav_menu') -> select();
    $data2 = $this -> daohang($shuju);

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

  }

  public function daohang($data,$pid=0){

    $arr = [];
    foreach ($data as $key => $value) {
       if($value['parent_id'] == $pid){
          $value['son'] = $this -> daohang($data,$value['id']);
          $arr[] = $value;

       }
    }
    return $arr;


  }


  //显示内容
  public function index(){

    $id = $this -> request -> param();
    $data = Db::name('portal_category_post') -> where('category_id',$id['id']) -> find();
    $shuju = Db::name('portal_post') -> where('id',$data['post_id']) -> find();
    $shuju['post_content'] = cmf_replace_content_file_url(htmlspecialchars_decode($shuju['post_content']));
    $this -> assign('shuju',$shuju);

    $title = Db::name('portal_category') -> where('id',$id['pid']) -> find();
    $this -> assign('title',$title);

    return $this -> fetch();

  }





}







 ?>