<?php

	/***************************************************************\
	|																|
	|	房佳（专业的新房报备ERP管理系统）							|
	|																|
	|	© 2020-2022 淮南市银泰软件科技有限公司 All rights reserved	|
	|																|
	|	http://www.newshouse.cn										|
	|																|
	|	QQ号：984784483												|
	|																|
	\***************************************************************/

	namespace Admin\Controller;
	use Think\Controller;
	class PeizhiController extends CommonController {

		public function jichupeizhi(){
			$is_rbac = _rbac_node_show(257);
			if (!$is_rbac) {
				$this->redirect('Index/error');
			}
			$this->gspzs=M('jcpz')->where(array('gongsiid'=>session('gongsiid')))->count();
			$this->role=M('role_user')->where(array('user_id'=>session('uid')))->getField('role_id');
			$this->display();
		}

		//配置设置列表
		public function Pzshezhi(){
			$is_rbac = _rbac_node_show(421);
			if (!$is_rbac) {
				$this->redirect('Index/error');
			}
			$condition = "zhuangtai = 1";
			$pzfl=I('pzfl');
			$sousuo=I('sousuo');
			if ($pzfl) {
				$condition.=" and pzfl=$pzfl";
			}
			if ($sousuo) {//搜索
				$condition.=" and ((pzming like '%$sousuo%') or (zhushi like '%$sousuo%'))";
			}
			$Model = new \Think\Model();
			$count=$Model->query("select count(*) from (select count(*) from jjrxt_peizhi where {$condition} group by pzming) a");
			$Page=new \Think\Page($count['0']['count(*)'],15);
			$show=$Page->show();
			$list="select max(id),pzming,zhushi from jjrxt_peizhi where {$condition} group by pzming order by id DESC limit ".$Page->firstRow.','.$Page->listRows;
			$Peizhi=$Model->query($list);
			$this->assign('peizhi',$Peizhi);
			$this->assign('count',$count);
			$this->assign('page',$show);
			$this->pzfl=get_peizhi('pzfl',0,1);
			$this->display();
		}

	}