// +---------------------------------------------------------------------- namespace app\home\controller; use think\Db; use think\Validate; class Pviews extends Base { public function index(){ return $this->view->fetch(':pviews'); } /** * 详细页 * @return string */ public function html(){ $contentname=input('content',''); $this->assign("contentname",$contentname); $tpath='static:' . $contentname; $this->assign("tpath",$tpath); return $this->view->fetch(':pviews'); } /** * 详细页 * @return string */ public function render(){ $contentname=input('content',''); $this->assign("contentname",$contentname); $tpath='static:' . $contentname; $tg_type=input('tg_type',1); $tgid=input('id'); $uid=session('hid'); if($tgid){ $baseinfo=Db::name('capitalbaseinfo')->where(['apply_id'=>$tgid])->find(); $tg_type=$baseinfo['apply_type']; $apply=Db::name('capitalapply')->where(['apply_id'=>$tgid,'user_id'=>$uid])->find(); if(!$apply){ $this->error("没权限查阅此项目"); } $status=isset($apply['status'])?$apply['status']:''; $showinfo=1; if($tg_type==2&&in_array($status,[10,30,40])){ $showinfo=0; } if(in_array($tg_type,[3,4])&&in_array($status,[10])){ $showinfo=0; } $this->assign('showinfo',$showinfo); } if($contentname=='tgadd'){ $this->check_login(); if($tg_type==2){ $tpath.='2'; } if($tg_type==3){ $tpath='static:gjadd'; } if($tg_type==4){ $tpath='static:xcadd'; } //挂牌需要上传的附件 $where=array(); $where['apply_id']=0; $where['status']=0; $where['isopen']=1; $where['apply_type']=$tg_type; if($tg_type==2)$where['mobile']=1; $files=Db::name('capitaluptype')->where($where)->order('forder asc')->select(); $upfiles=Db::name('capital_upfiles')->where(['new_flag'=>1,'apply_id'=>$tgid,'flag'=>1])->select(); if(count($upfiles)){ foreach ($files as $k=>$row){ $files[$k]['flag']=0; $files[$k]['path']=''; foreach ($upfiles as $jow){ if($row['ftype_id']==$jow['ftype_id']){ $files[$k]['flag']=1; $files[$k]['path']=SITE_PATH.$jow['path']; } } } } $this->assign('files', $files); $products=Db::name('capitaldetail')->where(['apply_id'=>$tgid])->select(); if(count($products)){ foreach ($products as &$item){ $item['capital_date']=$item['capital_date']?date("Y-m-d",$item['capital_date']):''; } } $this->assign('products', $products); } $this->assign("tpath",$tpath); $this->assign("tg_type",$tg_type); $this->assign("apply_id",$tgid); $bcontnt = $this->view->fetch(':pviews_begin'); $contnt = $this->view->fetch($tpath); $econtent = $this->view->fetch(':pviews_end'); return $bcontnt . $contnt . $econtent; } public function gjadd2(){ $tgid=input('apply_id',''); $this->assign('apply_id',$tgid); $tg_type=input('tg_type',3); $this->assign('tg_type',$tg_type); return $this->view->fetch('static:gjadd2'); } public function xcadd2(){ $tgid=input('apply_id',''); $this->assign('apply_id',$tgid); $tg_type=input('tg_type',4); $this->assign('tg_type',$tg_type); return $this->view->fetch('static:xcadd2'); } public function jointg3(){ $tgid=input('apply_id',''); $this->assign('apply_id',$tgid); $tg_type=input('tg_type',2); $this->assign('tg_type',$tg_type); return $this->view->fetch('static:tgadd3'); } /** * 详细页 * @return string */ public function tginfo(){ $contentname='tgadd'; $this->assign("contentname",$contentname); $tpath='static:' . $contentname; $tg_type=input('tg_type',1); $tgid=input('id'); $uid=session('hid'); if($tgid){ $baseinfo=Db::name('capitalbaseinfo')->where(['apply_id'=>$tgid])->find(); $this->assign('baseinfo',$baseinfo); $tg_type=$baseinfo['apply_type']; } if($tg_type==2){ $tpath.='2'; } if($tg_type==3){ $tpath='static:gjadd'; } if($tg_type==4){ $tpath='static:xcadd'; } $apply=Db::name('capitalapply')->where(['apply_id'=>$tgid,'user_id'=>$uid])->find(); if(!$apply){ $this->error("没权限查阅此项目"); } $status=isset($apply['status'])?$apply['status']:''; //挂牌需要上传的附件 $where=array(); $where['apply_id']=0; $where['status']=0; $where['isopen']=1; $where['apply_type']=$tg_type; if($tg_type==2)$where['mobile']=1; $files=Db::name('capitaluptype')->where($where)->order('forder asc')->select(); $where=['new_flag'=>1,'apply_id'=>$tgid]; if($tg_type!=2||($tg_type==2&&!in_array($status,[10,30,40]))){ $where['flag']=1; } if(in_array($tg_type,[1,3,4])&&in_array($status,[10])){ if(isset($where['flag']))unset($where['flag']); } $upfiles=Db::name('capital_upfiles')->where($where)->select(); if(count($files)){ foreach ($files as $k=>$row){ $files[$k]['flag']=0; $files[$k]['path']=''; $files[$k]['unique_code']=''; $files[$k]['fname']=$row['ftypedescr']; $reload=0; if($tg_type==2&&in_array($status,[10,30,40])){ $reload=1; } if(in_array($tg_type,[1,3,4])&&in_array($status,[10])){ $reload=1; } $files[$k]['reload']=$reload; foreach ($upfiles as $jow){ if($row['ftype_id']==$jow['ftype_id']){ $flag=1; if($tg_type==2&&in_array($status,[10,30,40]))$flag=$jow['flag']; if(in_array($tg_type,[3,4])&&in_array($status,[10])){ $flag=$jow['flag']; if($flag==1){ $files[$k]['reload']=0; } } $files[$k]['flag']=$flag; $files[$k]['unique_code']=$jow['unique_code']; $files[$k]['fname']=$row['ftypedescr']; $files[$k]['path']=SITE_PATH.str_replace('\\','/',$jow['path']); } } } } //} $this->assign('files', $files); $products=Db::name('capitaldetail')->where(['apply_id'=>$tgid])->select(); if(count($products)){ foreach ($products as &$item){ $item['capital_date']=$item['capital_date']?date("Y-m-d",$item['capital_date']):''; } } $this->assign('products', $products); $this->assign("tg_type",$tg_type); $this->assign("tpath",$tpath); $showinfo=1; if($tg_type==2&&in_array($status,[10,30,40])){ $showinfo=0; } if(in_array($tg_type,[3,4])&&in_array($status,[10])){ $showinfo=0; } $this->assign('showinfo',$showinfo); $this->assign('apply_id',$tgid); $this->assign('status',intval($status)); $bcontnt = $this->view->fetch(':pviews_begin'); $contnt = $this->view->fetch($tpath); $econtent = $this->view->fetch(':pviews_end'); return $bcontnt . $contnt . $econtent; } }