// +---------------------------------------------------------------------- namespace app\home\controller; use think\Db; use think\Validate; use app\cult4\model\Cult4uptype as UptypeModel; use app\capital\model\Capitaluptype as CapUptypeModel; use app\cult4\model\Cult4upfiles as UpFilesModel; use app\admin\model\Options; use think\Controller; /** * 列表 */ class Listn extends Base { protected $prefix=''; protected $upload_path=''; public function __construct(){ parent::__construct(); $this->prefix=config('database.prefix'); $this->upload_path=config('upload_path'); } public function index(){ $prefix=$this->prefix; $this->assign('menu_id',$this->menu_id); $keyword=input('keyword',''); $cururl=request()->url(); if($keyword&&request()->isPost()){ $rule = [ '__news__' =>'require|token:__news__' ]; $message =[ '__news__.require'=>'令牌缺失' ]; $validate=new Validate($rule,$message); $result=$validate->check(input()); if(!$result){ $this->error($validate->getError()); } } $parentid=input('pid','','intval'); $childs=[]; $menufield='id,menu_name,menu_enname,menu_content,menu_type,parentid,menu_address,menu_target'; //检索左侧导航 $current=Db::name('menu')->field($menufield)->where(['id'=>$this->menu_id,'menu_open'=>1])->find(); $parent=['menu_name'=>'','menu_enname'=>'']; if($current||$parentid){ if(empty($parentid)){ $parentid=$current['parentid']; if(empty($parentid)){ $parent=$current; $parentid=$current['id']; } } if(empty($parent)||!empty($parentid)){ $parent=Db::name('menu')->field($menufield)->where(['id'=>$parentid,'menu_open'=>1])->find(); } $childs=Db::name('menu')->field($menufield)->where(['parentid'=>$parentid,'menu_open'=>1])->order('listorder asc')->select(); if(count($childs)){ foreach ($childs as $k=>$row){ $rid=$row['id']; $sons=Db::name('menu')->field($menufield)->where(['parentid'=>$rid,'menu_open'=>1])->order('listorder asc')->select(); if(count($sons)){ $scheck=false; foreach ($sons as &$jo){ $jid=$jo['id']; $jons=Db::name('menu')->field($menufield)->where(['parentid'=>$jid,'menu_open'=>1])->order('listorder asc')->select(); $check=false; if(count($jons)){ $jcheck=false; foreach ($jons as &$ko){ $ko['active']=($cururl==$ko['menu_address'])?true:false; $ko['jump']=$ko['menu_address']; if($ko['active'])$jcheck=true; } $jo['active']=$jcheck?true:false; $jo['childs']=$jons; if($jcheck)$check=true; } if($check)$scheck=$check; $jo['active']=$check; $jo['jump']=$jo['menu_address']; } $childs[$k]['active']=$scheck; $childs[$k]['childs']=$sons; } } } } $this->assign('top',$parent); $this->assign('parent',$parent); $this->assign('current',$current); $this->assign('childs',$childs); $this->assign('keyword',$keyword); //news分类相关列表页 $kinds=[71=>6,18=>1,44=>3,41=>5,4=>6,52=>6,53=>7,54=>8,55=>9,56=>10,57=>11,58=>12,59=>13]; if(in_array($this->menu_id,array_keys($kinds))){ $kind=$kinds[$this->menu_id]; $lists=Db::name('news')->where(['n_status'=>1,'n_kind'=>$kind])->order('n_order,n_time desc')->paginate(10,false,['query'=>get_query()]); $show = $lists->render(); $this->assign('page',$show); $this->assign('current',$current); $this->assign("lists",$lists); return $this->view->fetch(":newslist"); } switch ($this->menu_id){ case 1://本所介绍 $where=['n_cid'=>1,'n_status'=>1,'n_kind'=>1]; if($keyword){ $where['n_title']=['like','%'.$keyword.'%']; } $lists=Db::name('news')->where($where)->order('n_order')->select(); $this->assign('lists',$lists); return $this->view->fetch(":about"); break; case 100://本所介绍 $cid = input('cid', 1, 'intval'); $where=['c_status'=>1,'c_type'=>$cid,'c_kind'=>12]; if($keyword){ $where['c_name']=['like','%'.$keyword.'%']; } $lists=Db::name('finance')->where($where)->order('c_order')->paginate(10,false,['query'=>get_query()]); $show = $lists->render(); $this->assign('page',$show); $mchilds=array('1'=>['menu_name'=>'艺术家'],'2'=>['menu_name'=>'专业运营机构'],'3'=>['menu_name'=>'基金管理公司']); $current=isset($mchilds[$cid])?$mchilds[$cid]:''; $this->assign('current',$current); $this->assign('menu_id',$this->menu_id); $this->assign('cid',$cid); $this->assign('mchilds',[]); $this->assign('lists',$lists); return $this->view->fetch(":finance2"); break; case 6: //case 33: //政策法规 $download_cids=Db::name('type')->where('type_type',19)->order('type_order')->select(); $this->assign('download_cids',$download_cids); $catid = input('catid', 0, 'intval'); $cid = input('cid', 0, 'intval'); if( ($cid == 0) or ($catid== 0) ){ if(in_array($this->menu_id,[6,33])) { //政策法规默认子分类 $catid = 19; $cid = 1; } } $this->assign('catid', $catid); $this->assign('cid', $cid); //分类下载的数据 $where=[]; $where['d_status'] = 1; $where['d_catlogid'] = $catid; if ($cid) $where['d_cid'] = $cid; if($keyword){ $where['d_name']=['like','%'.$keyword.'%']; } $downloads = Db::name('download')->where($where)->order('d_order,d_time desc')->select(); $downloads=$this->getIcon($downloads); $this->assign('downloads', $downloads); return $this->view->fetch(":zcfg_download"); break; case 3: case 16: case 17: //文化四板行业 $cults=Db::name('type')->where('type_type',15)->where('type_id','neq',1)->order('type_order')->select(); $this->assign('cults',$cults); $cult_cid=input('cid',0,'intval'); if(in_array($this->menu_id,[3,17]) && $cult_cid==0) $cult_cid=1; if($this->menu_id==16 && $cult_cid==0) $cult_cid=2; $where=['cu_cid'=>$cult_cid,'cu_status'=>1,'type_type'=>15]; $list=Db::name('culture')->alias('a')->join($prefix.'type b','a.cu_cid=b.type_id')->where($where)->find(); $this->assign('cult_cid',$cult_cid); $this->assign('list',$list); //该行业下3个企业 $lists=Db::name('cult4info')->alias('a')->join($prefix.'type b','a.c_ssbk=b.type_id')->where(['c_ssbk'=>$cult_cid,'c_status'=>1,'type_type'=>15])->limit(3)->select(); $this->assign('lists',$lists); return $this->view->fetch(":cult_info"); break; case 19: $where=['vd_cid'=>1,'vd_status'=>1]; $cid = input('cid', 1, 'intval'); if($cid){ $where['vd_cid']=$cid; } if($keyword){ $where['vd_name']=['like','%'.$keyword.'%']; } $id = input('id'); $sons=[]; $cateRes = Db::name('menu')->field('menu_name,menu_address')->where(['parentid' => $id,'menu_open' => 1,'top' => 1])->select(); foreach ($cateRes as $cateRow) { preg_match_all('/\d+/', $cateRow['menu_address'], $temp_str); if (empty($temp_str[0][1])) continue; $sons[$temp_str[0][1]]=[ 'id' => $temp_str[0][1], 'menu_name' => $cateRow['menu_name'], 'active' => false, 'menu_enname' => '', 'menu_type' => 3, 'parentid' => '', 'jump' => $cateRow['menu_address'], 'menu_address' => $cateRow['menu_address'], 'menu_target' => '', 'menu_content' => '' ]; } if (empty($sons)) { $sons[1]=['id'=>1,'menu_name'=>'宣传片','active'=>false,'menu_enname'=>'','menu_type'=>3,'parentid'=>'','jump'=>'/list/19/cid/1.html','menu_address'=>'/list/19/cid/1.html','menu_target'=>'','menu_content'=>'']; $sons[4]=['id'=>4,'menu_name'=>'公开课','active'=>false,'menu_enname'=>'','menu_type'=>3,'parentid'=>'','jump'=>'/list/19/cid/4.html','menu_address'=>'/list/19/cid/4.html','menu_target'=>'','menu_content'=>'']; $sons[2]=['id'=>2,'menu_name'=>'更多','active'=>false,'menu_enname'=>'','menu_type'=>3,'parentid'=>'','jump'=>'/list/19/cid/2.html','menu_address'=>'/list/19/cid/2.html','menu_target'=>'','menu_content'=>'']; } $childs[4]['childs']=$sons; $cid=input('cid',1,'intval'); if($cid!=3){ $childs[4]['active']=true; $childs[4]['childs'][$cid]['active']=true; $this->assign('childs',$childs); }else{ $childs[5]['active']=true; $this->assign('childs',$childs); $current=['menu_name'=>'宣传片','menu_enname'=>'','menu_content'=>'']; $this->assign('current',$current); } //宣传片 $lists=Db::name('video')->where($where)->order('vd_order,vd_time desc')->paginate(12,false,['query'=>get_query()]); $show = $lists->render(); $this->assign('page',$show); $this->assign("lists",$lists); return $this->view->fetch(":xcp"); break; case 20: case 35: //组织架构 //本所荣誉 $kinds=[20=>2,35=>4]; $kind=$kinds[$this->menu_id]; $where=['n_status'=>1,'n_cid'=>1,'n_kind'=>$kind]; if($keyword){ $where['n_title']=['like','%'.$keyword.'%']; } $list=Db::name('news')->where($where)->find(); $this->assign("list",$list); return $this->view->fetch(":newssingle"); break; case 5: case 26: //文化资产、国有文化资产 $parent=['menu_name'=>'国有资产','menu_enname'=>'']; $childs=[]; $childs[1]=['id'=>1,'cid'=>1,'table'=>'gyzc','menu_name'=>'业务介绍','menu_enname'=>'','menu_type'=>3,'parentid'=>'','menu_address'=>'/list/26/cid/1.html','menu_content'=>'']; $childs[2]=['id'=>2,'cid'=>2,'table'=>'gyzc','menu_name'=>'办事指南','menu_enname'=>'','menu_type'=>3,'parentid'=>'','menu_address'=>'/list/26/cid/2.html','menu_content'=>'']; $childs[3]=['id'=>3,'cid'=>4,'table'=>'bsgg','menu_name'=>'公示公告','menu_enname'=>'','menu_type'=>3,'parentid'=>'','menu_address'=>'/list/26/cid/3.html','menu_content'=>'']; $childs[4]=['id'=>4,'cid'=>'','table'=>'','menu_name'=>'国有项目','menu_enname'=>'','menu_type'=>3,'parentid'=>'','menu_address'=>'/home/listn/cult_list/type/whzc.html','menu_content'=>'']; $childs[5]=['id'=>5,'cid'=>1,'table'=>'nwwd','menu_name'=>'常见问题','menu_enname'=>'','menu_type'=>3,'parentid'=>'','menu_address'=>'/list/26/cid/5.html','menu_content'=>'']; $childs[6]=['id'=>6,'cid'=>1,'table'=>'zcfg','menu_name'=>'政策法规','active'=>false,'menu_enname'=>'','menu_type'=>3,'parentid'=>'','menu_address'=>'#','menu_content'=>'']; $childs[6]['childs']=[]; $sons=[]; $sons[1]=['id'=>1,'menu_name'=>'综合法规','active'=>false,'menu_enname'=>'','menu_type'=>3,'parentid'=>'','jump'=>'/list/26/cid/6/zc_cid/1.html','menu_content'=>'']; $sons[2]=['id'=>2,'menu_name'=>'产权法规','active'=>false,'menu_enname'=>'','menu_type'=>3,'parentid'=>'','jump'=>'/list/26/cid/6/zc_cid/2.html','menu_content'=>'']; $sons[3]=['id'=>3,'menu_name'=>'资产处置','active'=>false,'menu_enname'=>'','menu_type'=>3,'parentid'=>'','jump'=>'/list/26/cid/6/zc_cid/3.html','menu_content'=>'']; $childs[6]['childs']=$sons; $childs[7]=['id'=>7,'cid'=>1,'table'=>'gyzc','menu_name'=>'资料下载','menu_enname'=>'','menu_type'=>3,'parentid'=>'','menu_address'=>'/list/26/cid/7.html','menu_content'=>'']; $cid = input('cid', 0, 'intval'); $zc_cid = input('zc_cid', 0, 'intval'); if(isset($childs[$this->menu_id]))$current=$childs[$this->menu_id]; $this->assign('current',$current); $this->assign('parent',$parent); if(isset($childs[$cid]))$childs[$cid]['active']=true; if($zc_cid&&isset($sons[$zc_cid])){ $sons[$zc_cid]['active']=true; $childs[6]['childs']=$sons; } $this->assign('childs',$childs); $this->assign("zc_cid", $zc_cid); if($cid<7){ if (empty($cid))$cid=1; $n_cid=$childs[$cid]['cid']; $this->assign('childs',$childs); $tpl=":newssingle"; $list=[]; $table=$childs[$cid]['table']; if($cid==3||$cid==6){ $curid=$n_cid; if($cid==6)$curid=$zc_cid; $where=['n_status' => 1,'n_cid' =>$curid]; if($keyword){ $where['n_title']=['like','%'.$keyword.'%']; } $lists = Db::name($table)->where($where)->order('n_order,n_time desc')->paginate(10, false, ['query' => get_query()]); $show = $lists->render(); $this->assign('page', $show); $this->assign("lists", $lists); return $this->view->fetch(":newslist"); }elseif($n_cid){ $list = Db::name($table)->where(['n_status' => 1, 'n_cid' =>$n_cid])->find(); $this->assign("list", $list); return $this->view->fetch(":newssingle"); } }elseif ($cid == 7) { $where=[]; //资料下载(国有资产) $where['d_status'] = 1; $where['d_cid'] = 1; if($keyword){ $where['d_name']=['like','%'.$keyword.'%']; } $downloads = Db::name('download')->where($where)->order('d_order,d_time desc')->select(); $downloads=$this->getIcon($downloads); $this->assign('list', $downloads); return $this->view->fetch(":download"); } break; case 2: case 22: case 23: case 24://融资快讯 case 25: case 27: case 275: case 303: case 333: case 334: case 335: case 319: case 344: case 353: //本所动态(市场资讯) if($this->menu_id==2)$this->menu_id=22; $this->assign('menu_id',$this->menu_id); $kinds=[ 22=>[11,'bsgg'], 23=>[12,'bsyw'], 25=>[21,'bszc'], 303=>[65,'bszc'], 333=>[18,'bszc'], 334=>[10,'bszc'], 335=>[60,'bszc'], 319=>[13529,'bszc'], 344=>[13559,'bszc'], 353=>[1,'bszc'], 24=>[15,'sczcxy'], 275=>[16,'news'], ]; $current=$kinds[$this->menu_id]; $typeid=$current[0]; $table=$current[1]; //公告 $where=['n_status'=>1]; $sons=$jsons=[]; if($this->menu_id==22){ $jsons[1]=['id'=>2,'menu_name'=>'托管公告','active'=>false,'menu_enname'=>'','menu_type'=>3,'menu_target'=>'','parentid'=>'','jump'=>'/list/22/cid/2.html','menu_content'=>'']; $jsons[2]=['id'=>3,'menu_name'=>'资产托管公告','active'=>false,'menu_enname'=>'','menu_type'=>3,'menu_target'=>'','parentid'=>'','jump'=>'/list/22/cid/3.html','menu_content'=>'']; $jsons[3]=['id'=>4,'menu_name'=>'招拍挂业务公告','active'=>false,'menu_enname'=>'','menu_type'=>3,'menu_target'=>'','parentid'=>'','jump'=>'/list/22/cid/4.html','menu_content'=>'']; $cid=input('cid',1,'intval'); $childs[1]['active']=true; $sons=$childs[1]['childs']; foreach ($sons as $k=>$jow){ if(strpos($jow['menu_address'],"/cid/".$cid)!==false){ $sons[$k]['active']=true; } } if(isset($jsons[$cid-1])){ $sons[1]['active']=true; $jsons[$cid-1]['active']=true; } $sons[1]['jump']='#'; $sons[1]['childs']=$jsons; $where['a.n_cid']=$cid; } if($this->menu_id==275){ $sons=$childs[6]['childs']; $cid=input('cid',1,'intval'); $sons[$cid-1]['active']=true; $where['a.n_cid']=$cid; $where['a.n_kind']=$typeid; $childs[6]['active']=true; } if($this->menu_id==23){ $sons=$childs[0]['childs']; $cid=input('cid',1,'intval'); $sons[$cid-1]['active']=true; $where['a.n_cid']=$cid; $childs[0]['active']=true; } if($this->menu_id==24){ $where['a.n_cid']=2; if(isset($childs[2]['childs'])){ $sons=$childs[2]['childs']; $sons[0]['active']=true; } $childs[2]['active']=true; } if($this->menu_id==25){ $where['a.n_cid']=1; if(isset($childs[3]['childs'])){ $sons=isset($childs[3])?$childs[3]['childs']:[]; $sons[0]['active']=true; } $childs[3]['active']=true; } if($this->menu_id==303){ $where['a.n_cid']=2; } if($this->menu_id==333){ $where['a.n_cid']=3; } if($this->menu_id==334){ $where['a.n_cid']=4; } if($this->menu_id==335){ $where['a.n_cid']=5; } if($this->menu_id==353){ $where['a.n_cid']=6; } if($this->menu_id==319 || $this->menu_id==344){ $where['a.n_cid']=$typeid; } $db=Db::name($table)->alias('a'); if(!in_array($this->menu_id,array(23,275,319,344,353))){ $where['type_type']=$typeid; $where['type_status']=1; $db->join($prefix.'type b','a.n_cid=b.type_id'); } if($keyword){ $where['n_title']=['like','%'.$keyword.'%']; } $order='n_order,n_time desc'; if($table=='bsgg'||$table=='bsyw'){ $order='n_top desc,n_order,n_time desc'; } $lists=$db->where($where)->order($order)->paginate(16,false,['query'=>get_query()]); if($this->menu_id==23){ $childs[0]['childs']=$sons; } if($this->menu_id==275){ $childs[6]['childs']=$sons; } if($this->menu_id==24){ $childs[2]['childs']=$sons; } if($this->menu_id==25){ $childs[3]['childs']=$sons; } if($this->menu_id==22){ $childs[1]['childs']=$sons; } $this->assign('childs',$childs); $show = $lists->render(); $this->assign('page',$show); $this->assign("lists",$lists); return $this->view->fetch(":nsimglist2"); break; case 200: $parent=['menu_name'=>'专区','menu_enname'=>'']; $childs=[]; $childs[1]=['id'=>1,'menu_name'=>'金溪托管专区','menu_enname'=>'','menu_type'=>3,'parentid'=>'','menu_address'=>'/list/200/cid/1.html','menu_content'=>'']; $childs[2]=['id'=>2,'menu_name'=>'普宁托管专区','menu_enname'=>'','menu_type'=>3,'parentid'=>'','menu_address'=>'/list/200/cid/2.html','menu_content'=>'']; $cid=input('cid',1,'intval'); if(isset($childs[$cid])){ $current=$childs[$cid]; $childs[$cid]['active']=1; } $this->assign('current',$current); $this->assign('parent',$parent); $this->assign('top',$parent); $this->assign('childs',$childs); $where=[]; $where['c_kind']=11; $where['c_status']=1; $where['c_type']=$cid; $order=[]; $order['c_order']='desc'; if($keyword){ $where['c_name']=['like','%'.$keyword.'%']; } $db=Db::name('finance')->where($where); $list=$db->order($order)->paginate(15,false,['query'=>get_query()]); $page=$list->render(); $this->assign('lists',$list); $this->assign('page',''); return $this->view->fetch(":nsimglist3"); break; case 28: case 29: case 30: case 31: case 32: //会员专区(合作机构) $parent=['menu_name'=>'投资会员','menu_enname'=>'Member']; $childs=[]; $childs[28]=['id'=>28,'menu_name'=>'挂牌会员','menu_enname'=>'','menu_type'=>3,'parentid'=>'','menu_address'=>'','menu_content'=>'']; $childs[29]=['id'=>29,'menu_name'=>'推荐机构','menu_enname'=>'','menu_type'=>3,'parentid'=>'','menu_address'=>'','menu_content'=>'']; $childs[30]=['id'=>30,'menu_name'=>'服务会员','menu_enname'=>'','menu_type'=>3,'parentid'=>'','menu_address'=>'','menu_content'=>'']; $childs[31]=['id'=>31,'menu_name'=>'投资会员','menu_enname'=>'','menu_type'=>3,'parentid'=>'','menu_address'=>'','menu_content'=>'']; $childs[32]=['id'=>32,'menu_name'=>'投资会员','menu_enname'=>'','menu_type'=>3,'parentid'=>'','menu_address'=>'#','menu_content'=>'']; if(isset($childs[$this->menu_id]))$current=$childs[$this->menu_id]; $this->assign('current',$current); $this->assign('parent',$parent); $this->assign('childs',$childs); $cu_cid=input('cid',0,'intval'); $kinds=[29=>2,30=>3,28=>1,32=>5,31=>4]; if(isset($kinds[$this->menu_id]))$cu_cid=$kinds[$this->menu_id]; if(($cu_cid>0) and ($cu_cid<6)){ $where=['cu_status'=>1,'cu_cid'=>$cu_cid]; if($keyword){ $where['cu_title']=['like','%'.$keyword.'%']; } $list=Db::name('hyzq')->where($where)->order('cu_order,cu_time desc')->select(); $this->assign('list',$list); $this->assign('cu_cid',$cu_cid); return $this->view->fetch(":hyzq"); } break; case 34: $where=['n_status'=>1,'n_kind'=>14]; if($keyword){ $where['n_title']=['like','%'.$keyword.'%']; } //专家列表 $lists=Db::name('news')->where($where)->order('n_order,n_time desc')->select(); shuffle($lists); $cntNum = count($lists); $this->assign("lists",$lists); $this->assign("cntNum",$cntNum); if(!empty($lists)){ $n_id=$lists[0]['n_id']; } $this->assign('current_sub_menu_id',7); $list=Db::name('news')->where(['n_status'=>1,'n_id'=>$n_id])->find(); $this->assign('list',$list); return $this->view->fetch(":team"); break; case 40: //活动 $this->assign('n_cid',5); $where=['n_status'=>1,'type_type'=>18]; if($keyword){ $where['n_title']=['like','%'.$keyword.'%']; } $lists=Db::name('bshd')->alias('a')->join($prefix.'type b','a.n_cid=b.type_id')->where($where)->order('n_order,n_time desc')->paginate(10,false,['query'=>get_query()]); $show = $lists->render(); $this->assign('page',$show); $this->assign("lists",$lists); return $this->view->fetch(":newslist"); break; case 42: case 43: $this->assign('page',''); $this->assign("lists",[]); return $this->view->fetch(":nsimglist"); //培训 break; case 65: case 66: case 67: case 68: $parent=['menu_name'=>'市场资讯','menu_enname'=>'Market information']; $childs=[]; $childs[65]=['id'=>65,'menu_name'=>'挂牌信息','menu_enname'=>'','menu_type'=>3,'parentid'=>'','menu_address'=>'','menu_content'=>'']; $childs[66]=['id'=>66,'menu_name'=>'活动','menu_enname'=>'','menu_type'=>3,'parentid'=>'','menu_address'=>'','menu_content'=>'']; $childs[67]=['id'=>67,'menu_name'=>'挂牌企业资讯','menu_enname'=>'','menu_type'=>3,'parentid'=>'','menu_address'=>'','menu_content'=>'']; $childs[68]=['id'=>68,'menu_name'=>'政策行研','menu_enname'=>'','menu_type'=>3,'parentid'=>'','menu_address'=>'','menu_content'=>'']; if(isset($childs[$this->menu_id]))$current=$childs[$this->menu_id]; $this->assign('current',$current); $this->assign('parent',$parent); $this->assign('childs',$childs); $kinds=[24=>2,65=>1,66=>2,67=>3,68=>4]; $n_cid=''; if(isset($kinds[$this->menu_id]))$n_cid=$kinds[$this->menu_id]; $where=['n_status'=>1,'type_type'=>30,'a.n_cid'=>$n_cid]; if($keyword){ $where['n_title']=['like','%'.$keyword.'%']; } $lists=Db::name('sczcxy')->alias('a')->join($prefix.'type b','a.n_cid=b.type_id')->where($where)->order('n_order,n_time desc')->paginate(10,false,['query'=>get_query()]); $show = $lists->render(); $this->assign('page',$show); $this->assign("lists",$lists); return $this->view->fetch(":nsimglist"); break; case 3: case 33: case 36: case 37: case 38: case 39: case 46: case 47: case 60: case 72: case 86: $kinds=[72=>1,3=>1,36=>1,37=>2,38=>3,39=>4,60=>6,46=>7,86=>8,47=>9,33=>19]; if (in_array($this->menu_id,array_keys($kinds))) { $tpl=":newssingle"; $n_cid = input('cid', 0, 'intval'); if(empty($n_cid)){ $n_cid=isset($kinds[$this->menu_id])?$kinds[$this->menu_id]:''; } $current['menu_enname']='Introduction of cultural industry board'; $menu_type=isset($current['menu_type'])?$current['menu_type']:''; $this->assign('current',$current); if($this->menu_id==33){ $where=[]; $where['d_status'] = 1; $where['d_catlogid'] = $n_cid; if($keyword){ $where['d_name']=['like','%'.$keyword.'%']; } $downloads = Db::name('download')->where($where)->order('d_order,d_time desc')->select(); $downloads=$this->getIcon($downloads); $tpl=":download"; $this->assign('list', $downloads); }else{ $where=['n_status' => 1, 'n_cid' => $n_cid]; if($keyword){ $where['n_title']=['like','%'.$keyword.'%']; } $list = Db::name('whsb')->where($where)->find(); $this->assign("list", $list); } if($this->menu_id==86){ $childs=[]; $childs[86]=['id'=>86,'menu_name'=>'深圳市文化金融服务中心','menu_enname'=>'','menu_type'=>3,'parentid'=>'','menu_address'=>'','menu_content'=>'']; }else{ foreach ($childs as $key=>$row){ $cparentid=$row['id']; $childs[$key]['active']=false; $sons=Db::name('menu')->field($menufield)->where(['parentid'=>$cparentid,'menu_open'=>1])->order('listorder asc')->select(); if(count($sons)){ foreach ($sons as $index=>$son){ if($son['id']==$this->menu_id||strpos($son['menu_address'],"/list/".$this->menu_id."/")!==false){ $childs[$key]['active']=true; $sons[$index]['active']=true; } switch ($son['menu_type']){ case 2: $sons[$index]['jump']=$son['menu_address']; break; default: $sons[$index]['jump']=url('home/Listn/index',['id'=>$son['id'],'pid'=>$parentid]); } } $childs[$key]['childs']=$sons; } } } $this->assign('childs',$childs); $this->assign('cid', $n_cid); $this->assign('menu_id', $this->menu_id); return $this->view->fetch($tpl); } break; case 21: case 49: case 50: case 51: case 311: case 354: $this->_download($childs); return $this->view->fetch(":download"); break; case 80: case 81: case 82: $cid=input('cid','','intval'); $parent=['menu_name'=>'金融资讯','menu_enname'=>'Finance Information']; $childs=[]; $childs[80]=['id'=>80,'menu_name'=>'文化金融','menu_enname'=>'Cultural finance','menu_type'=>3,'parentid'=>'','menu_address'=>'','menu_content'=>'']; $childs[81]=['id'=>81,'menu_name'=>'艺术金融','menu_enname'=>'Art finance','menu_type'=>3,'parentid'=>'','menu_address'=>'','menu_content'=>'']; $childs[82]=['id'=>82,'menu_name'=>'古建资产','menu_enname'=>'','menu_type'=>3,'parentid'=>'','menu_address'=>'','menu_content'=>'']; $current=$childs[$this->menu_id]; $mchilds=[]; $mchilds[80]=array('1'=>'文化产业策略联盟挂牌平台','2'=>'招拍挂平台','3'=>'要素交易中心','4'=>'文化大数据'); $mchilds[81]=array('4'=>'艺术资产托管平台','5'=>'公馆艺拍','6'=>'艺享拍'); $mchilds[82]=array('13'=>'策略联盟','14'=>'项目进场'); if(empty($cid)){ $keys=array_keys($mchilds[$this->menu_id]); $cid=array_shift($keys); } if($cid==4){ $where=array(); $where['new_flag']=1; $where['apply_type']=6; $where['code']=['neq','']; $lists=Db::name('cult4baseinfo')->field("apply_id as c_id,code as c_code,codename as c_name,code_oper_time as c_gptime,codeprice as gp_price")->where($where)->order('apply_id desc')->paginate(10,false,['query'=>get_query()]); $page=$lists->render(); $data=[]; if(count($lists)){ $lists=$lists->toArray(); $data=$lists['data']; foreach ($data as $key =>$row) { $data[$key]['c_kind']=6; $data[$key]['c_logo']=''; $data[$key]['c_jcname']=''; $data[$key]['c_jump']=url('news/finance',['c_id'=>$row['c_id'],'kind'=>6]); } $lists['data']=$data; } $this->assign('lists',$data); }else{ $where=['c_status'=>1,'c_kind'=>$cid]; if($keyword){ $where['c_jcname|c_name']=[['like','%'.$keyword.'%'],['like',$keyword.'%'],['like','%'.$keyword],'or']; } $lists=Db::name('finance')->where($where)->order('c_order desc,c_time desc')->paginate(10,false,['query'=>get_query()]); $lists->appends('cid',$cid); $page=$lists->render(); $this->assign('lists',$lists); } $this->assign('current',$current); $this->assign('menu_id',$this->menu_id); $this->assign('parent',$parent); $this->assign('cid',$cid); $this->assign('mchilds',$mchilds[$this->menu_id]); $top=isset($mchilds[$this->menu_id][$cid])?$mchilds[$this->menu_id][$cid]:''; $this->assign('top',['menu_name'=>$top]); $this->assign('childs',$childs); $this->assign('page',$page); $this->assign('title',$current['menu_name']); $this->assign('etitle',$current['menu_enname']); return $this->view->fetch(":finance"); break; } } public function page(){ $parentid=input('pid','','intval'); $kind=input('kind','','intval'); $menu_id=input('id','','intval'); $keyword=input('keyword'); $childs=[]; $tpl=':pagesingle'; if(empty($parentid)){ $tpl=':pagesingle2'; } $childs=[]; $menufield='id,menu_name,menu_enname,menu_content,menu_type,parentid,menu_address,menu_target'; //检索左侧导航 $current=Db::name('menu')->field($menufield)->where(['id'=>$menu_id])->find(); $parent=''; $top=''; if($current){ $parent=''; if(empty($parentid)){ $parentid=$current['parentid']; if(empty($parentid)){ $parent=$current; $parentid=$current['id']; } } if(empty($parent)){ $parent=Db::name('menu')->field($menufield)->where(['id'=>$parentid,'menu_open'=>1])->find(); $top=$parent; if($parent['parentid']){ $parentid=$parent['parentid']; $parent=Db::name('menu')->field($menufield)->where(['id'=>$parentid,'menu_open'=>1])->find(); if($parent['parentid']){ $parent=Db::name('menu')->field($menufield)->where(['id'=>$parentid,'menu_open'=>1])->find(); $parentid=$parent['parentid']; } } } $childs=Db::name('menu')->field($menufield)->where(['parentid'=>$parentid,'menu_open'=>1])->order('listorder asc')->select(); if(count($childs)){ foreach ($childs as $k=>$row){ $rid=$row['id']; $sons=Db::name('menu')->field($menufield)->where(['parentid'=>$rid,'menu_open'=>1])->order('listorder asc')->select(); if(count($sons)){ $check=false; foreach ($sons as &$jo){ if(!$check)$check=$jo['id']==$menu_id; $jo['active']=($jo['id']==$menu_id)?true:false; $jo['jump']=$jo['menu_address']; $jid=$jo['id']; $jons=Db::name('menu')->field($menufield)->where(['parentid'=>$jid,'menu_open'=>1])->order('listorder asc')->select(); if(count($jons)){ $jcheck=false; foreach ($jons as &$ko){ if(!$jcheck)$jcheck=$ko['id']==$menu_id; $ko['active']=($ko['id']==$menu_id)?true:false; $ko['jump']=$ko['menu_address']; } $jo['active']=$jcheck?true:false; $jo['childs']=$jons; if($jcheck)$check=true; } } $childs[$k]['active']=$check?true:false; $childs[$k]['childs']=$sons; } } } $this->assign('parent',$parent); } if(in_array($parentid,[140,72,61,301,304])){ $this->assign('showchild',1); } $this->assign('menu_id',$menu_id); $list=Db::name('page')->where(['status'=>1,'kind'=>$kind])->find(); if(empty($current)&&$list){ $current=['menu_name'=>$list['title'],'menu_enname'=>$list['title']]; } $this->assign("list",$list); $this->assign('parent',$parent); $this->assign('top',$top); $this->assign('current',$current); $this->assign('childs',$childs); $this->assign('keyword',$keyword); return $this->view->fetch($tpl); } /** * 下载相关页面 */ protected function _download($childs=[]){ $downloadcids=Db::name('type')->where('type_type','in','10,17,18')->order('type_order')->select(); $cidslist=[]; $cidslist[10]=[];//规则制度 $cidslist[17]=[]; //业务指引 $cidslist[18]=[]; //相关协议 $kinds=[49=>10,21=>10,50=>17,51=>18,354=>19]; $rkinds=[10=>21,17=>50,18=>51,19=>354]; $catid = input('catid', 0, 'intval'); $cid = input('cid',1, 'intval'); if(empty($catid)&&isset($kinds[$this->menu_id])){ $catid=$kinds[$this->menu_id]; } $this->assign('catid', $catid); $this->assign('cid', $cid); foreach ($downloadcids as $row){ $type=$row['type_type']; $id=isset($rkinds[$type])?$rkinds[$type]:''; $row['jump']=url('home/Listn/index',['id'=>$id,'catid'=>$type,'cid'=>$row['type_id']]); $row['menu_name']=$row['type_name']; $row['id']=$row['type_id']; $row['active']=false; if($catid&&$cid){ if($row['type_type']==$catid&&$row['id']==$cid)$row['active']=true; } if(isset($cidslist[$type]))array_push($cidslist[$type],$row); } $current=['menu_name'=>'资料下载','menu_enname'=>'Download','menu_content'=>'']; $this->assign('current',$current); //分类下载的数据 $where=[]; $where['d_status'] = 1; $where['d_catlogid'] = $catid; if($cid)$where['d_cid'] = $cid; $keyword=input('keyword',''); if($keyword){ $where['d_name']=['like','%'.$keyword.'%']; } $downloads = Db::name('download')->where($where)->order('d_order,d_time desc')->select(); $downloads=$this->getIcon($downloads); $this->assign('list', $downloads); } protected function getIcon($downloads){ foreach ($downloads as &$download) { $suff = $download['d_url'] ? pathinfo($download['d_url'], PATHINFO_EXTENSION) : ''; switch (strtolower($suff)) { case 'pdf': $icon = 'fa-file-pdf-o'; break; case 'xlsx': case 'xls': case 'csv': $icon = 'fa-file-excel-o'; break; case 'docx': case 'doc': case 'rtf': $icon = 'fa-file-word-o'; break; case 'png': case 'bmp': case 'jpg': case 'jpeg': $icon = 'fa-file-photo-o'; break; case 'txt': $icon = 'fa-file-text-o'; break; case 'zip': case 'rar': case '7-zip': $icon = 'fa-file-zip-o'; break; default: $icon = 'fa-file'; break; } $download['icon']=$icon; } return $downloads; } /** * 全局检索 * @return string */ public function search(){ $keyword = input("keyword"); $rule = [ 'keyword'=>'require' ]; $message = [ 'keyword'=>'关键词必填' ]; $querys=get_query(); if(request()->isPost()){ $rule['__topsearch__']='require|token:__topsearch__'; $message['__topsearch__.require']='非法提交'; if(isset($querys['__topsearch__'])){ unset($querys['__topsearch__']); } } $validate=new Validate($rule,$message); $result=$validate->check(input()); if(!$result){ return $this->error($validate->getError()); } $this->assign('keyword',$keyword); //范围 1新闻bsyw(news表结构) 2公告bsgg(news表结构) 3政策法规zcfg(news表结构) 4你问我答nwwd(news表结构) 5专家团队zjtd(news表结构) 6视频video 7下载download $type=input('type','','intval'); $kinds=[]; $kinds[1]=['table'=>'bsyw','title'=>'新闻动态','key'=>'n_title','status'=>'n_status','order'=>'n_order,n_time desc']; $kinds[2]=['table'=>'bsgg','title'=>'公示公告','key'=>'n_title','status'=>'n_status','order'=>'n_order,n_time desc']; $kinds[3]=['table'=>'zcfg','title'=>'政策法规','key'=>'n_title','status'=>'n_status','order'=>'n_order,n_time desc']; $kinds[4]=['table'=>'nwwd','title'=>'你问我答','key'=>'n_title','status'=>'n_status','order'=>'n_order,n_time desc']; $kinds[5]=['table'=>'zjtd','title'=>'专家团队','key'=>'n_title','status'=>'n_status','order'=>'n_order,n_time desc']; $kinds[6]=['table'=>'video','title'=>'活动视频','key'=>'vd_name','status'=>'vd_status','order'=>'vd_order,vd_time desc']; $kinds[7]=['table'=>'download','title'=>'资料下载','key'=>'d_name','status'=>'d_status','order'=>'d_order,d_time desc']; $list_count=0; $lists=[]; $show=''; $title=""; foreach ($kinds as $index=>$row){ $status=$row['status']; $key=$row['key']; $table=$row['table']; $item=Db::name($table)->where($key,'like','%'.$keyword.'%')->where($status,1)->count(); $list_count+=$item; $this->assign('list_'.$index,$item); if($type==$index||($title==""&&$item>0)){ if(empty($type))$type=$index; $order=$row['order']; $title=$kinds[$type]['title']; $lists=Db::name($table)->where($key,'like','%'.$keyword.'%')->where($status,1)->order($order)->paginate(8,false,['query'=>$querys]); $lists->appends('type',$type); $show = $lists->render(); } } $this->assign('lists',$lists); $this->assign('page',$show); $this->assign('list_count',$list_count); $this->assign('type',$type); $this->assign('title',$title); return $this->view->fetch(':search'); } public function cult_list(){ $type=input('type','cult'); $this->assign('type', $type); $keyword=input('keyword',''); $this->assign('keyword',$keyword); $where=[]; $where['c_status']=1; if($keyword) $where['c_name|c_jcname|c_code']=['like','%'.$keyword.'%']; $parent=['menu_name'=>'挂牌企业','menu_enname'=>'Listed companies','menu_id'=>'']; $kinds=[]; $kinds['whzc']=['id'=>'1','active'=>false,'menu_address'=>'/home/listn/cult_list/type/whzc.html','menu_name'=>'文化资产','type'=>4,'table'=>'otinfo','menu_content'=>'','menu_id'=>'','key'=>'c_gyxm']; $kinds['fwhzc']=['id'=>'2','active'=>false,'menu_address'=>'/home/listn/cult_list/type/fwhzc.html','menu_name'=>'非文化资产','type'=>4,'table'=>'otinfo','menu_content'=>'','menu_id'=>'','key'=>'c_gyxm']; $kinds['cult']=['id'=>'3','active'=>false,'menu_address'=>'/home/listn/cult_list/type/cult.html','menu_name'=>'文化产业板','type'=>1,'table'=>'cult4info','menu_content'=>'','menu_id'=>'','key'=>'c_hylb']; if(!in_array($type,array_keys($kinds)))$type='cult'; $current=$kinds[$type]; $kinds[$type]['active']=true; $table=$current['table']; $ttype=$current['type']; $gyxm=Db::name('type')->where('type_type',$ttype)->select(); $this->assign('gyxm', $gyxm); $this->assign('parent',$parent); $this->assign('childs',$kinds); $this->assign('current',$current); $c_gyxm=input('c_gyxm',0,'intval'); $this->assign('c_gyxm', $c_gyxm); $this->assign('menu_id', ''); if($c_gyxm) { $key=$current['key']; $where[$key]=$c_gyxm; } if($type!='cult'){ $c_type=($type=='whzc')?1:2; $where['c_type']=array('in','0,'.$c_type); } $title='选择行业'; if($type!='cult')$title='国有项目'; $this->assign('title',$title); $lists=Db::name($table)->where($where)->order('c_order,c_time desc')->paginate(10,false,['query'=>get_query()]); $show =$lists?$lists->render():''; $this->assign('page',$show); $this->assign("lists",$lists); if(request()->isAjax()){ return json(['html'=>$this->view->fetch(':ajax_cult_list'),'code'=>1,'c_gyxm'=>$c_gyxm]); }else{ return $this->view->fetch(':cult_list'); } } public function download_file(){ $d_id=input('d_id',0,'intval'); $rst=Db::name('download')->find($d_id); if($rst && $rst['d_url']){ Db::name('download')->where('d_id',$d_id)->setInc('d_count'); if(stripos($rst['d_url'],'http')!==false){ $file=$rst['d_url']; }else{ $file='.'.$rst['d_url']; } if(file_exists($file)) force_download_content(pathinfo($file,PATHINFO_BASENAME),file_get_contents($file)); else return json(['code'=>0,'msg'=>'文件不存在']); return json(['code'=>1,'msg'=>'成功']); }else{ return json(['code'=>0,'msg'=>'文件不存在']); } } public function nwwd(){ $prefix=$this->prefix; //你问我答类型 $nwwd_cids=Db::name('type')->where('type_type',13)->order('type_order')->column('*','type_id'); $this->assign('nwwd_cids', $nwwd_cids); //数据 $n_cid=input('n_cid',2,'intval'); $lists=Db::name('nwwd')->alias('a')->join($prefix.'type b','a.n_cid=b.type_id')->where(['type_type'=>13,'n_status'=>1,'n_cid'=>$n_cid])->order('n_order,n_time desc')->select(); $this->assign('n_cid', $n_cid); $this->assign('lists', $lists); return $this->view->fetch(':nwwd'); } public function gp_add(){ $gp_type=input("gp_type",'','intval'); $c_type=input("c_type",1,'intval'); $level= input('gplevel',4,'intval'); $this->assign('level', $level); $this->assign('c_type', $c_type); $ktype=2; if($gp_type==4||$gp_type==5||$gp_type==6)$ktype=3; //为了兼容IE8,改为isPost if(request()->isPost()){ $post=input('post.'); if(!session('hid')){ $this->error('请重新登录后在提交'); } if($gp_type==1||$gp_type==4||$gp_type==6){ if($gp_type==1){ if(isset($post['c_intellectual_prop_type'])&& $post['c_intellectual_prop_type']) { $c_type=$post['c_intellectual_prop_type']; $c_type = join('', $c_type); $typelist=[1=>1,2=>2,3=>3,12=>4,13=>5,23=>6,123=>7]; $post['c_intellectual_prop_type']=isset($typelist[$c_type])?$typelist[$c_type]:$post['c_intellectual_prop_type']; }else{ $post['c_intellectual_prop_type']=0; } $rule = [ ['c_name','require|max:50','企业名称不能为空|企业名称不能超过50字符'], ['c_enname','max:50|alpha','英文名称不能超过50字符|英文名称只能输入英文字母'], ['c_appl_date','require|dateFormat:Y-m-d','申请日期不能为空|申请日期格式错误'], ['c_reg_date','require|dateFormat:Y-m-d','成立日期不能为空|成立日期格式错误'], ['c_reg_capital','require|number|max:20','注册资本不能为空|注册资本必须为数字|注册资本长度不能超过20'], ['c_legal_person','require|max:50','法人代表不能为空|法人代表长度不能超过50字符'], ['c_legal_person_tel','require|regex:^1[3-9]\d{9}$','法人手机号不能为空|法人手机号格式错误'], ['c_agent_email','email','邮箱格式错误'], ['c_agent','max:50','委托人姓名不能超过50字符'], ['c_agent_mobile','regex:^1[3-9]\d{9}$','委托人手机号码格式错误'], ['c_reg_addr','require|max:100','企业注册地址不能为空|企业注册地址不能超过100字符'], ['c_business_model_descr','require|max:200','产品描述不能为空|产品描述不能超过200字符'], ['c_reason','require|max:500','挂牌诉求不能为空|挂牌诉求不能超过500字符'], ['member_recmd','require','推荐机构不能为空'], ['p_name','require|max:50','项目名称不能为空|项目名称超过50字符'], ['p_start_date','require|dateFormat:Y-m-d','项目启动日期不能为空|项目启动日期格式错误'], //['p_amount','require|number|max:20','项目金额不能为空|项目金额必须为数字|项目金额超过20字符'], ['p_leader','require|max:20','项目负责人不能为空|项目负责人超过20字符'], ['p_leader_tel','require|regex:^1[3-9]\d{9}$','项目负责人手机号不能为空|项目负责人手机号格式错误'], ['p_leader_cardno','require','项目负责人证件号码不能为空'], ['p_ownership','require|max:200','项目权属情况不能为空|项目权属情况超过200字符'], ['p_descr','require|max:200','项目简介不能为空|项目简介超过200字符'] ]; $checks=array( 'c_name'=>$post['c_name'], 'c_enname'=>$post['c_enname'], 'c_appl_date'=>$post['c_appl_date'], 'c_reg_date'=>$post['c_reg_date'], 'c_reg_capital'=>$post['c_reg_capital'], 'c_legal_person'=>$post['c_legal_person'], 'c_legal_person_tel'=>$post['c_legal_person_tel'], 'c_agent_email'=>$post['c_agent_email'], 'c_agent'=>$post['c_agent'], 'c_agent_tel'=>$post['c_agent_tel'], 'c_agent_mobile'=>$post['c_agent_mobile'], 'c_reg_addr'=>$post['c_reg_addr'], 'c_business_model_descr'=>$post['c_business_model_descr'], 'c_reason'=>$post['c_reason'], 'member_recmd'=>$post['member_recmd'], 'p_name'=>$post['p_name'], 'p_start_date'=>$post['p_start_date'], //'p_amount'=>$post['p_amount'], 'p_leader'=>$post['p_leader'], 'p_leader_tel'=>$post['p_leader_tel'], 'p_leader_cardno'=>$post['p_leader_cardno'], 'p_descr'=>$post['p_descr'], 'p_ownership'=>$post['p_ownership'] ); } if ($gp_type==4||$gp_type==6){ $rule =[ ['c_name','require|max:50','企业名称不能为空|企业名称不能超过50字符'], ]; $checks=array( 'c_name'=>$post['c_name'] ); } $validate = new Validate($rule); $rst= $validate->check($checks); }elseif ($gp_type==2||$gp_type==5){ $rule = [ ['p_reason','require|max:200','挂牌诉求不能为空|挂牌诉求超过200字符'], ['p_business_model_descr','require|max:200','商业模式不能为空|联商业模式超过200字符'] ]; if($gp_type==2){ //项目 if(1 !==check_cardno($post['p_leader_cardtype'],$post['p_leader_cardno'])){ $this->error("项目负责人证件号码格式错误"); } array_push($rule,['p_name','require|max:50','项目名称不能为空|项目名称超过50字符']); array_push($rule,['p_start_date','require|dateFormat:Y-m-d','项目启动日期不能为空|项目启动日期格式错误']); array_push($rule,['p_leader','require|max:20','项目负责人不能为空|项目负责人超过20字符']); array_push($rule,['p_leader_tel','require|regex:^1[3-9]\d{9}$','项目负责人手机号不能为空|项目负责人手机号格式错误']); array_push($rule,['p_leader_cardno','require','项目负责人证件号码不能为空']); array_push($rule,['p_ownership','require|max:200','项目权属情况不能为空|项目权属情况超过200字符']); array_push($rule,['p_descr','require|max:200','项目简介不能为空|项目简介超过200字符']); array_push($rule,['member_recmd','require','推荐机构不能为空']); } $p_type=input('p_type',1,'intval'); if($p_type==1){ $rule[]=['p_com_name','require|max:50','项目企业名称不能为空|项目企业名称超过50字符']; $rule[]=['p_reg_date','require|dateFormat:Y-m-d','项目企业成立日期不能为空|项目企业成立日期格式错误']; $rule[]=['p_reg_addr','require|max:50','注册地址不能为空|注册地址超过50字符']; $rule[]=['p_reg_capital','require|number|max:20','注册资本名称不能为空|注册资本必须为整数|注册资本超过20字符']; $rule[]=['p_legal_person','require|max:20','法人代表不能为空|法人代表超过20字符']; $rule[]=['p_legal_person_tel','require|regex:^1[3-9]\d{9}$','法人手机号不能为空|法人手机号格式错误']; $validate = new Validate($rule); $checks=array( 'p_reason'=>$post['p_reason'], 'p_business_model_descr'=>$post['p_business_model_descr'], 'p_com_name'=>$post['p_com_name'], 'p_reg_date'=>$post['p_reg_date'], 'p_reg_addr'=>$post['p_reg_addr'], 'p_reg_capital'=>$post['p_reg_capital'], 'p_legal_person'=>$post['p_legal_person'], 'p_legal_person_tel'=>$post['p_legal_person_tel'] ); }else{ $rule[]=['p_natural_name','require|max:20','自然人名称不能为空|自然人名称超过20字符']; $rule[]=['p_natural_tel|regex:^1[3-9]\d{9}$','require','联系电话不能为空|联系电话格式错误']; $rule[]=['p_natural_cardno','require|max:30','自然人证件号码不能为空|自然人证件号码超过60字符']; $validate = new Validate($rule); $checks=array( 'p_reason'=>$post['p_reason'], 'p_business_model_descr'=>$post['p_business_model_descr'], 'p_natural_name'=>$post['p_natural_name'], 'p_natural_tel'=>$post['p_natural_tel'], 'p_natural_cardno'=>$post['p_natural_cardno'] ); } if($gp_type==2){ array_push($checks,['p_name'=>$post['p_name']]); array_push($checks,['p_start_date'=>$post['p_start_date']]); array_push($checks,['p_leader'=>$post['p_leader']]); array_push($checks,['p_leader_tel'=>$post['p_leader_tel']]); array_push($checks,['p_leader_cardno'=>$post['p_leader_cardno']]); array_push($checks,['p_descr'=>$post['p_descr']]); array_push($checks,['p_ownership'=>$post['p_ownership']]); array_push($checks,['member_recmd'=>$post['member_recmd']]); } $rst= $validate->check($checks); if($p_type==2) { if (1 !== check_cardno($post['p_natural_cardtype'], $post['p_natural_cardno'])) { $this->error("证件号码格式错误"); } } }else{ //人才 $rule = [ ['t_apply_username','require','申请人名称不能为空'], ['t_apply_engname','max:50|alpha','英文名称超过50字符|英文名称只能是英文字母'], ['t_appl_date','require|dateFormat:Y-m-d','申请日期不能为空|申请日期格式错误'], ['t_home_addr','require|max:100','住所不能为空|住所超过100字符'], ['t_tel','require|regex:^1[3-9]\d{9}$','申请人手机号不能为空|申请人手机号格式错误'], ['t_apply_cardno','require','申请人证件号码不能为空'], ['t_work','require|max:20','现有工作不能为空|现有工作超过20字符'], ['t_contact_addr','require|max:100','联系地址不能为空|联系地址超过100字符'], ['t_apply_workdescr','require|max:500','申请人简介不能为空|申请人简介超过500字符'], ['t_apply_descr','require|max:500','申请人专利简介不能为空|申请人专利简介超过500字符'], ['t_apply_cert','require|max:500','申请人资格证书不能为空|申请人资格证书超过500字符'], ['member_recmd','require','推荐机构不能为空'] ]; if($post['agentpeople']==1){ if(1 !==check_cardno($post['t_agent_cardtype'],$post['t_agent_cardno'])){ $this->error("委托人证件号码格式错误"); } $rule[]=['t_agent','require|max:20','委托人姓名不能为空|委托人姓名超过20字符']; $rule[]=['t_agent_tel','require|regex:^1[3-9]\d{9}$','委托人手机号不能为空|委托人手机号格式错误']; $rule[]=['t_agent_cardno','require|max:30','委托人证件号不能为空|委托人证件号超过60字符']; } $validate = new Validate($rule); $vdata= array( 't_apply_username'=>$post['t_apply_username'], 't_appl_date'=>$post['t_appl_date'], 't_home_addr'=>$post['t_home_addr'], 't_tel'=>$post['t_tel'], 't_apply_cardno'=>$post['t_apply_cardno'], 't_work'=>$post['t_work'], 't_contact_addr'=>$post['t_contact_addr'], 't_agent'=>$post['t_agent'], 't_agent_tel'=>$post['t_agent_tel'], 't_contact_addr'=>$post['t_contact_addr'], 't_apply_workdescr'=>$post['t_apply_workdescr'], 't_apply_descr'=>$post['t_apply_descr'], 't_apply_cert'=>$post['t_apply_cert'], 'member_recmd'=>$post['member_recmd'] ); if($post['agentpeople']==1){ $vdata['t_agent']=$post['t_agent']; $vdata['t_agent_tel']=$post['t_agent_tel']; $vdata['t_agent_cardno']=$post['t_agent_cardno']; } $rst= $validate->check($vdata); if(1 !==check_cardno($post['t_apply_cardtype'],$post['t_apply_cardno'])){ $this->error("申请人证件号码格式错误"); } } if(true !==$rst){ $error=is_array($validate->getError())?join('|',$validate->getError()):$validate->getError(); if(empty($error)){ $error="上传失败,请重新提交"; } $this->error($error); } foreach ($post as $key){ if(checkHTMLTag($key)){ $this->error("输入值含有非法字符!"); } } //防止重复提交 if (!checkToken(input('TOKEN'))) { // $this->error('请勿重复提交'); } Db::transaction(function() use($post){ //插入主表 $data=[ 'user_id'=>session('hid'), 'status'=>1, 'create_user_id'=>session('hid'), 'create_user_type'=>1, 'create_time'=>time() ]; $apply_id=Db::name('cult4apply')->insertGetId($data); //上传附件 //5.29修改 $files = request()->file(''); $payment_info=''; $payment_url=''; if ($files) { foreach ($files as $key=>$file) { if($file->getInfo('size')>(20*1024*1024)){ session('TOKEN', input('TOKEN')); $this->error('上传文件不能大于20M!'); } if(!in_array(strtoupper(substr(strrchr($file->getInfo('name'), '.'), 1)),['PDF','JPG','DOC','DOCX'])){ session('TOKEN', input('TOKEN')); $this->error('上传文件类型错误!'); } if(in_array($key,['payment_url','payment_info'])){ if(strtoupper(substr(strrchr($file->getInfo('name'), '.'), 1))!=='PDF'){ session('TOKEN', input('TOKEN')); $this->error('上传文件类型错误!'); } $upath=$this->upload_path . DS . date('Y-m-d'); $validate = config('upload_validate'); $info = $file->validate($validate)->rule('md5')->move(ROOT_PATH .$upath); if ($info) { $img_url=$upath.DS.$info->getFilename(); if($key=='payment_url')$payment_url=$img_url; if($key=='payment_info')$payment_info=$img_url; }else { $error=$file->getError(); if(empty($error))$error="文件上传失败"; $this->error($error); } }else{ //处理file_one2,得到ftype_id $ftype_id=intval(substr($key,8)); if(!check_upfiletype('cult4uptype',$ftype_id,substr(strrchr($file->getInfo('name'), '.'), 1))){ session('TOKEN', input('TOKEN')); $this->error('上传文件类型错误!'); } $upath=$this->upload_path . DS . date('Y-m-d'); $validate = config('upload_validate'); $info = $file->validate($validate)->rule('md5')->move(ROOT_PATH .$upath); if ($info) { $img_url = $upath.DS.$info->getFilename(); //写入数据表cult4upfiles $data=[ 'apply_id'=>$apply_id, 'user_id'=>session('hid'), 'user_type'=>1, 'status'=>0, 'upload_time'=>time(), 'ftype_id'=>$ftype_id, 'ftype'=>1, 'filesize'=>$info->getSize(), 'path'=>$img_url, 'flag'=>0 ]; Db::name('cult4upfiles')->insert($data); } else { $error=$file->getError(); if(empty($error))$error="文件上传失败"; $this->error($error); } } } } //插入缴费表 $data=['apply_id'=>$apply_id,'fee_flag'=>0,'update_time'=>time()]; Db::name('cult4fee')->insertGetId($data); $pgp_type=intval($post['gp_type']); $pc_type=isset($post['c_type'])?intval($post['c_type']):''; $ktype=2; if($pgp_type==4||$pgp_type==5||$pgp_type==6)$ktype=3; //插入信息表 if($pgp_type==1||$pgp_type==4||$pgp_type==6){ if($pgp_type==1){ $data=[ 'c_name'=>$post['c_name'], 'c_enname'=>$post['c_enname'], 'c_appl_date'=>strtotime($post['c_appl_date']), 'c_reg_date'=>strtotime($post['c_reg_date']), 'c_reg_capital'=>$post['c_reg_capital'], 'c_type'=>$post['c_type'], 'c_legal_person'=>$post['c_legal_person'], 'c_legal_person_tel'=>$post['c_legal_person_tel'], 'c_agent'=>$post['c_agent'], 'c_agent_tel'=>$post['c_agent_tel'], 'c_agent_mobile'=>$post['c_agent_mobile'], 'c_agent_email'=>$post['c_agent_email'], 'c_reg_addr'=>$post['c_reg_addr'], 'c_contact_addr'=>$post['c_contact_addr'], 'c_business_model_descr'=>$post['c_business_model_descr'], 'c_intellectual_prop_type'=>$post['c_intellectual_prop_type'], 'c_intellectual_prop_descr'=>0, 'c_reason'=>$post['c_reason'], 'p_name'=>$post['p_name'], 'p_start_date'=>strtotime($post['p_start_date']), 'p_leader_tel'=>$post['p_leader_tel'], 'p_leader'=>$post['p_leader'], 'p_leader_cardtype'=>$post['p_leader_cardtype'], 'p_leader_cardno'=>$post['p_leader_cardno'], 'p_addr_province'=>$post['p_addr_province'], 'p_addr_city'=>$post['p_addr_city'], 'p_addr_district'=>$post['p_addr_district'], 'p_addr2_province'=>$post['p_addr2_province'], 'p_addr2_city'=>$post['p_addr2_city'], 'p_addr2_district'=>$post['p_addr2_district'], 'p_type'=>$post['p_type'], 'p_descr'=>$post['p_descr'], 'p_ownership'=>$post['p_ownership'] ]; } if($pgp_type==4){ $data=[ 'c_name'=>$post['c_name'], 'c_type'=>$pc_type, 'c_base'=>isset($post['c_base'])&&is_array($post['c_base'])?json_encode($post['c_base']):'', 'c_notice'=>isset($post['c_notice'])&&is_array($post['c_notice'])?json_encode($post['c_notice']):'', ]; switch ($pc_type){ case 1: $data['c_equity']=isset($post['c_equity'])&&is_array($post['c_equity'])?json_encode($post['c_equity']):''; $data['c_finance']=isset($post['c_finance'])&&is_array($post['c_finance'])?json_encode($post['c_finance']):''; $data['c_decision']=isset($post['c_decision'])&&is_array($post['c_decision'])?json_encode($post['c_decision']):''; $data['c_transferee']=isset($post['c_transferee'])&&is_array($post['c_transferee'])?json_encode($post['c_transferee']):''; break; case 2: $data['c_investor']=isset($post['c_investor'])&&is_array($post['c_investor'])?json_encode($post['c_investor']):''; break; case 3: $data['c_transferor']=isset($post['c_transferor'])&&is_array($post['c_transferor'])?json_encode($post['c_transferor']):''; $data['c_transferee']=isset($post['c_transferee'])&&is_array($post['c_transferee'])?json_encode($post['c_transferee']):''; break; case 4: $data['c_transferor']=isset($post['c_transferor'])&&is_array($post['c_transferor'])?json_encode($post['c_transferor']):''; $data['c_transferee']=isset($post['c_transferee'])&&is_array($post['c_transferee'])?json_encode($post['c_transferee']):''; break; case 5: $data['c_transferor']=isset($post['c_transferor'])&&is_array($post['c_transferor'])?json_encode($post['c_transferor']):''; break; } } if($pgp_type==6){ $data=[ 'c_name'=>$post['c_name'], 'c_base'=>isset($post['c_base'])&&is_array($post['c_base'])?json_encode($post['c_base']):'', 'c_notice'=>isset($post['c_notice'])&&is_array($post['c_notice'])?json_encode($post['c_notice']):'', ]; $data['c_transferor']=isset($post['c_transferor'])&&is_array($post['c_transferor'])?json_encode($post['c_transferor']):''; } }elseif ($pgp_type==2||$pgp_type==5){ $data=[ 'p_com_name'=>$post['p_com_name'], 'p_reg_date'=>strtotime($post['p_reg_date']), 'p_reg_capital'=>$post['p_reg_capital'], 'p_reg_addr'=>$post['p_reg_addr'], 'p_legal_person'=>$post['p_legal_person'], 'p_legal_person_tel'=>$post['p_legal_person_tel'], 'p_agent'=>$post['p_agent'], 'p_agent_tel'=>$post['p_agent_tel'], 'p_agent_mobile'=>$post['p_agent_mobile'], 'p_natural_name'=>$post['p_natural_name'], 'p_natural_tel'=>$post['p_natural_tel'], 'p_natural_cardtype'=>$post['p_natural_cardtype'], 'p_natural_cardno'=>$post['p_natural_cardno'], 'p_business_model_descr'=>$post['p_business_model_descr'], 'p_reason'=>$post['p_reason'], 'p_type'=>$post['p_type'], ]; if($pgp_type==2){ array_push($data,['p_name'=>$post['p_name']]); array_push($data,['p_start_date'=>strtotime($post['p_start_date'])]); array_push($data,['p_leader_tel'=>$post['p_leader_tel']]); array_push($data,['p_leader'=>$post['p_leader']]); array_push($data,['p_leader_cardtype'=>$post['p_leader_cardtype']]); array_push($data,['p_leader_cardno'=>$post['p_leader_cardno']]); array_push($data,['p_addr_province'=>$post['p_addr_province']]); array_push($data,['p_addr_city'=>$post['p_addr_city']]); array_push($data,['p_addr_district'=>$post['p_addr_district']]); array_push($data,['p_addr2_province'=>$post['p_addr2_province']]); array_push($data,['p_addr2_city'=>$post['p_addr2_city']]); array_push($data,['p_addr2_district'=>$post['p_addr2_district']]); array_push($data,['p_descr'=>$post['p_descr']]); array_push($data,['p_ownership'=>$post['p_ownership']]); } }elseif ($pgp_type==3){ $data=[ 't_apply_username'=>$post['t_apply_username'], 't_apply_engname'=>$post['t_apply_engname'], 't_appl_date'=>strtotime($post['t_appl_date']), 't_tel'=>$post['t_tel'], 't_home_addr'=>$post['t_home_addr'], 't_work'=>$post['t_work'], 't_apply_cardtype'=>$post['t_apply_cardtype'], 't_apply_cardno'=>$post['t_apply_cardno'], 't_agent'=>$post['t_agent'], 't_agent_tel'=>$post['t_agent_tel'], 't_agent_cardtype'=>$post['t_agent_cardtype'], 't_agent_cardno'=>$post['t_agent_cardno'], 't_contact_addr'=>$post['t_contact_addr'], 't_apply_workdescr'=>$post['t_apply_workdescr'], 't_apply_descr'=>$post['t_apply_descr'], 't_apply_cert'=>$post['t_apply_cert'], ]; } $data['gplevel']=input('gplevel',4,'intval'); $data['member_recmd']=isset($post['member_recmd'])?$post['member_recmd']:''; $data['apply_id']=$apply_id; $data['apply_type']=$pgp_type; $data['create_user_id']=session('hid'); $data['create_user_type']=1; $data['create_time']=time(); $data['k_type']=$ktype; $data['payment_url']=$payment_url; $data['payment_info']=$payment_info; Db::name('cult4baseinfo')->insert($data); }); $this->success('挂牌提交成功!',url('home/Center/my')); }else{ $user=session('user'); if(!session('hid')||!$user) $this->redirect('home/Login/index'); $groupid=$user['member_list_groupid']; $rst=false; if($groupid!=5){ //判断当前状态 $where['user_id']=session('hid'); $rst=Db::name('cult4apply')->where(['user_id'=>session('hid')])->where('status','gt',0)->where('status','neq',31)->where('status','neq',24)->find(); if($rst){ //已有待处理挂牌,转到我的挂牌 $this->redirect('home/Center/my'); } } //创建token creatToken(); //推荐会员 $member_recmds=Db::name('member_list')->where(['member_list_id'=>['neq',session('hid')],'member_list_groupid'=>4,'member_list_open'=>1,'user_status'=>1])->select(); $this->assign('member_recmds', $member_recmds); //挂牌需要上传的附件 $where=array(); $where['apply_id']=0; $where['status']=0; $where['isopen']=1; if($gp_type==4){ $where['c_type']=$c_type; }else{ $where['k_type']=$ktype; } $files=Db::name('cult4uptype')->where($where)->whereIn("apply_type",[$gp_type,'0'])->whereIn("gp_level",[$level,'0'])->order('forder')->select(); $this->assign('files', $files); $this->assign('gp_type', $gp_type); $province = Db::name('region')->where ( array('pid'=>1) )->select (); $this->assign('province',$province); return $this->view->fetch(':gp_add'); } } public function gp_check(){ $prefix=$this->prefix; if(!session('hid')) return json(['code'=>0,'msg'=>'未登录','url'=>url('home/Login/index')]); $role_id=Db::name('member_list')->where('member_list_id',session('hid'))->value('member_list_groupid'); //判断是否激活 if(!$this->user['user_status']){ $current_user=$this->user; $email = $current_user['member_list_email']; $this->assign("email",$email); return json(['code'=>4,'msg'=>'请先激活您的账号!','url'=>url('home/Login/index')]); } if($role_id==5){ return json(['code'=>1,'msg'=>'成功']); } if($role_id!=1)return json(['code'=>3,'msg'=>'您无权挂牌!','url'=>url('home/Center/my')]); //可以挂牌 return json(['code'=>1,'msg'=>'成功']); //判断当前状态 $where['user_id']=session('hid'); $rst=Db::name('cult4apply')->alias('a') ->join($prefix.'cult4baseinfo b','b.apply_id=a.apply_id') ->where(['user_id'=>session('hid'),'b.new_flag'=>1])->where('status','gt',0)->where('status','neq',24)->find();//->where('status','neq',31) if($rst){ //已有待处理挂牌,转到我的挂牌 return json(['code'=>2,'msg'=>'已有待处理挂牌']); }else{ //可以挂牌 return json(['code'=>1,'msg'=>'成功']); } } public function contact(){ return $this->view->fetch(':contact'); } public function gp_baseedit(){ $prefix=$this->prefix; $uid=session('hid'); $apply_id=input('apply_id',0,'intval'); if(!$apply_id) $this->error('参数错误'); //原数据 $list=Db::name('cult4apply')->alias('a') ->join(config('database.prefix').'cult4baseinfo b','b.apply_id=a.apply_id') ->where(['a.apply_id'=>$apply_id,'b.new_flag'=>1,'user_id'=>$uid,'status'=>['in',[3,33,7,10,40,18,26,44,49,52,26]]]) ->order('addorder desc') ->find(); $full=input('full',false,'boolval'); if($full==true) { $list = Db::name('cult4apply')->alias('a') ->join($prefix.'cult4baseinfo b', 'b.apply_id=a.apply_id') ->where(['a.apply_id' => $apply_id, 'b.new_flag' => 1, 'status' => ['in', [3,7,10,26,32,33,35, 37, 38, 41, 42, 43, 45, 50, 53]]]) ->order('addorder desc') ->find(); } if(request()->isAjax()){ if(!$uid){ $this->error('请重新登录后在提交'); } $post=input('post.'); $apply_type=intval($list['apply_type']); if($apply_type==1||$apply_type==4){ //企业 if($apply_type==4){ $rule =[ ['c_name','require|max:50','企业名称不能为空|企业名称不能超过50字符'], ]; $checks=array( 'c_name'=>$post['c_name'] ); }else{ if(isset($post['c_intellectual_prop_type']) && $post['c_intellectual_prop_type']){ $c_type=$post['c_intellectual_prop_type']; $c_type=join('',$c_type); $typelist=[1=>1,2=>2,3=>3,12=>4,13=>5,23=>6,123=>7]; $post['c_intellectual_prop_type']=isset($typelist[$c_type])?$typelist[$c_type]:$post['c_intellectual_prop_type']; }else{ $post['c_intellectual_prop_type']=0; } $rule = [ ['c_name','require','企业名称不能为空'], ['c_appl_date','require','申请日期不能为空'], ['c_reg_date','require','成立日期不能为空'], ['c_reg_capital','require|number','注册资本不能为空|注册资本必须为数字'], ['c_legal_person','require','法人代表不能为空'], ['c_legal_person_tel','require','法人手机号不能为空'], ['p_name','require','项目名称不能为空'], ['p_start_date','require','项目启动日期不能为空'], ['p_leader','require','项目负责人不能为空'], ['p_leader_tel','require','项目负责人手机号不能为空'], ['p_leader_cardno','require','项目负责人证件号码不能为空'] ]; $checks=array( 'c_name'=>$post['c_name'], 'c_appl_date'=>$post['c_appl_date'], 'c_reg_date'=>$post['c_reg_date'], 'c_reg_capital'=>$post['c_reg_capital'], 'c_legal_person'=>$post['c_legal_person'], 'c_legal_person_tel'=>$post['c_legal_person_tel'], 'p_name'=>$post['p_name'], 'p_start_date'=>$post['p_start_date'], 'p_leader'=>$post['p_leader'], 'p_leader_tel'=>$post['p_leader_tel'], 'p_leader_cardno'=>$post['p_leader_cardno'] ); } $validate = new Validate($rule); $rst= $validate->check($checks); if(true !==$rst){ $error=is_array($validate->getError())?join('|',$validate->getError()):$validate->getError(); $this->error($error); } }elseif($apply_type==2||$apply_type==5){ //项目 $p_type=input('p_type',1,'intval'); $checks=$rule=[]; if($apply_type==2){ $checks=[ 'p_name'=>$post['p_name'], 'p_start_date'=>$post['p_start_date'], 'p_leader'=>$post['p_leader'], 'p_leader_tel'=>$post['p_leader_tel'], 'p_leader_cardno'=>$post['p_leader_cardno'] ]; $rule = [ ['p_name','require','项目名称不能为空'], ['p_start_date','require','项目启动日期不能为空'], ['p_leader','require','项目负责人不能为空'], ['p_leader_tel','require','项目负责人手机号不能为空'], ['p_leader_cardno','require','项目负责人证件号码不能为空'] ]; } if($p_type==1){ $rule[]=['p_com_name','require','项目企业名称不能为空']; $rule[]=['p_reg_date','require','项目企业成立日期不能为空']; $rule[]=['p_reg_capital','require|number','注册资本名称不能为空|注册资本必须为整数']; $rule[]=['p_legal_person','require','法人代表不能为空']; $rule[]=['p_legal_person_tel','require','法人手机号不能为空']; $validate = new Validate($rule); $other=array( 'p_com_name'=>$post['p_com_name'], 'p_reg_date'=>$post['p_reg_date'], 'p_reg_capital'=>$post['p_reg_capital'], 'p_legal_person'=>$post['p_legal_person'], 'p_legal_person_tel'=>$post['p_legal_person_tel'], ); $checks=array_merge($checks,$other); $rst= $validate->check($checks); }else{ $rule[]=['p_natural_name','require','自然人名称不能为空']; $rule[]=['p_natural_tel','require','联系电话不能为空']; $rule[]=['p_natural_cardno','require','自然人证件号码不能为空']; $validate = new Validate($rule); $other=array( 'p_natural_name'=>$post['p_natural_name'], 'p_natural_tel'=>$post['p_natural_tel'], 'p_natural_cardno'=>$post['p_natural_cardno'], ); $checks=array_merge($checks,$other); $rst= $validate->check($checks); } if(true !==$rst){ $error=is_array($validate->getError())?join('|',$validate->getError()):$validate->getError(); $this->error($error); } }else{ //人才 $rule = [ ['t_apply_username','require','申请人名称不能为空'], ['t_appl_date','require','申请日期不能为空'], ['t_home_addr','require','住所不能为空'], ['t_tel','require','申请人手机号不能为空'], ['t_apply_cardno','require','申请人证件号码不能为空'] ]; $validate = new Validate($rule); $rst= $validate->check(array( 't_apply_username'=>$post['t_apply_username'], 't_appl_date'=>$post['t_appl_date'], 't_home_addr'=>$post['t_home_addr'], 't_tel'=>$post['t_tel'], 't_apply_cardno'=>$post['t_apply_cardno'], )); if(true !==$rst){ $error=is_array($validate->getError())?join('|',$validate->getError()):$validate->getError(); $this->error($error); } } $lstatus=$list['status']; $status=1; $slist=[3=>1,33=>2,7=>5,10=>6,18=>15,26=>30,44=>25,49=>29,52=>48]; if(isset($slist[$lstatus]))$status=$slist[$lstatus]; if($lstatus==40){ $fee_flag=Db::name('cult4fee')->where('apply_id',$apply_id)->value('fee_flag'); $status=$fee_flag?12:9; } Db::startTrans(); try{ //cult4baseinfo插入新记录 $gplvevl =Db::name('cult4baseinfo')->where('apply_id',$list['apply_id'])->value('gplevel'); $sdata=[]; $sdata['gplevel']=$gplvevl; $sdata['apply_id']=$apply_id; $sdata['member_recmd']=isset($post['member_recmd'])?$post['member_recmd']:''; $sdata['create_user_id']=session('hid'); $sdata['create_user_type']=1; $sdata['create_time']=time(); $sdata['addorder']=$list['addorder']+1; $pc_type=intval($list['c_type']); if($apply_type==1||$apply_type==4){ if($apply_type==4){ $data=[ 'apply_type'=>$apply_type, 'c_name'=>$post['c_name'], 'c_type'=>$pc_type, 'c_base'=>isset($post['c_base'])&&is_array($post['c_base'])?json_encode($post['c_base']):'', 'c_notice'=>isset($post['c_notice'])&&is_array($post['c_notice'])?json_encode($post['c_notice']):'', ]; switch ($pc_type){ case 1: $data['c_equity']=isset($post['c_equity'])&&is_array($post['c_equity'])?json_encode($post['c_equity']):''; $data['c_finance']=isset($post['c_finance'])&&is_array($post['c_finance'])?json_encode($post['c_finance']):''; $data['c_decision']=isset($post['c_decision'])&&is_array($post['c_decision'])?json_encode($post['c_decision']):''; $data['c_transferee']=isset($post['c_transferee'])&&is_array($post['c_transferee'])?json_encode($post['c_transferee']):''; break; case 2: $data['c_investor']=isset($post['c_investor'])&&is_array($post['c_investor'])?json_encode($post['c_investor']):''; break; case 3: $data['c_transferor']=isset($post['c_transferor'])&&is_array($post['c_transferor'])?json_encode($post['c_transferor']):''; $data['c_transferee']=isset($post['c_transferee'])&&is_array($post['c_transferee'])?json_encode($post['c_transferee']):''; break; case 4: $data['c_transferor']=isset($post['c_transferor'])&&is_array($post['c_transferor'])?json_encode($post['c_transferor']):''; $data['c_transferee']=isset($post['c_transferee'])&&is_array($post['c_transferee'])?json_encode($post['c_transferee']):''; break; case 5: $data['c_transferor']=isset($post['c_transferor'])&&is_array($post['c_transferor'])?json_encode($post['c_transferor']):''; break; } }else{ $data=[ 'apply_type'=>$apply_type, 'c_name'=>$post['c_name'], 'c_enname'=>$post['c_enname'], 'c_appl_date'=>strtotime($post['c_appl_date']), 'c_reg_date'=>strtotime($post['c_reg_date']), 'c_reg_capital'=>$post['c_reg_capital'], 'c_type'=>$post['c_type'], 'c_legal_person'=>$post['c_legal_person'], 'c_legal_person_tel'=>$post['c_legal_person_tel'], 'c_agent'=>$post['c_agent'], 'c_agent_tel'=>$post['c_agent_tel'], 'c_agent_mobile'=>$post['c_agent_mobile'], 'c_agent_email'=>$post['c_agent_email'], 'c_reg_addr'=>$post['c_reg_addr'], 'c_contact_addr'=>$post['c_contact_addr'], 'c_business_model_descr'=>$post['c_business_model_descr'], 'c_intellectual_prop_type'=>$post['c_intellectual_prop_type'], 'c_intellectual_prop_descr'=>$post['c_intellectual_prop_descr'], 'c_reason'=>$post['c_reason'], 'p_name'=>$post['p_name'], 'p_start_date'=>strtotime($post['p_start_date']), //'p_amount'=>$post['p_amount'], 'p_leader_tel'=>$post['p_leader_tel'], 'p_leader'=>$post['p_leader'], 'p_leader_cardtype'=>$post['p_leader_cardtype'], 'p_leader_cardno'=>$post['p_leader_cardno'], 'p_addr_province'=>$post['p_addr_province'], 'p_addr_city'=>$post['p_addr_city'], 'p_addr_district'=>$post['p_addr_district'], 'p_addr2_province'=>$post['p_addr2_province'], 'p_addr2_city'=>$post['p_addr2_city'], 'p_addr2_district'=>$post['p_addr2_district'], 'p_type'=>$post['p_type'], 'p_descr'=>$post['p_descr'], 'p_ownership'=>$post['p_ownership'] ]; } }elseif ($apply_type==2||$apply_type==5){ $data=[ 'apply_type'=>$apply_type, 'p_com_name'=>$post['p_com_name'], 'p_reg_date'=>strtotime($post['p_reg_date']), 'p_reg_capital'=>$post['p_reg_capital'], 'p_reg_addr'=>$post['p_reg_addr'], 'p_legal_person'=>$post['p_legal_person'], 'p_legal_person_tel'=>$post['p_legal_person_tel'], 'p_agent'=>$post['p_agent'], 'p_agent_tel'=>$post['p_agent_tel'], 'p_agent_mobile'=>$post['p_agent_mobile'], 'p_natural_name'=>$post['p_natural_name'], 'p_natural_tel'=>$post['p_natural_tel'], 'p_natural_cardtype'=>$post['p_natural_cardtype'], 'p_natural_cardno'=>$post['p_natural_cardno'], 'p_business_model_descr'=>$post['p_business_model_descr'], 'p_reason'=>$post['p_reason'], 'p_type'=>$post['p_type'] ]; if($apply_type==2){ array_push($data,['p_name'=>$post['p_name']]); array_push($data,['p_start_date'=>strtotime($post['p_start_date'])]); array_push($data,['p_leader_tel'=>$post['p_leader_tel']]); array_push($data,['p_leader'=>$post['p_leader']]); array_push($data,['p_leader_cardtype'=>$post['p_leader_cardtype']]); array_push($data,['p_leader_cardno'=>$post['p_leader_cardno']]); array_push($data,['p_addr_province'=>$post['p_addr_province']]); array_push($data,['p_addr_city'=>$post['p_addr_city']]); array_push($data,['p_addr_district'=>$post['p_addr_district']]); array_push($data,['p_addr2_province'=>$post['p_addr2_province']]); array_push($data,['p_addr2_city'=>$post['p_addr2_city']]); array_push($data,['p_addr2_district'=>$post['p_addr2_district']]); array_push($data,['p_descr'=>$post['p_descr']]); array_push($data,['p_ownership'=>$post['p_ownership']]); } }else{ $data=[ 'apply_type'=>3, 't_apply_username'=>$post['t_apply_username'], 't_apply_engname'=>$post['t_apply_engname'], 't_appl_date'=>strtotime($post['t_appl_date']), 't_tel'=>$post['t_tel'], 't_home_addr'=>$post['t_home_addr'], 't_work'=>$post['t_work'], 't_apply_cardtype'=>$post['t_apply_cardtype'], 't_apply_cardno'=>$post['t_apply_cardno'], 't_agent'=>$post['t_agent'], 't_agent_tel'=>$post['t_agent_tel'], 't_agent_cardtype'=>$post['t_agent_cardtype'], 't_agent_cardno'=>$post['t_agent_cardno'], 't_contact_addr'=>$post['t_contact_addr'], 't_apply_workdescr'=>$post['t_apply_workdescr'], 't_apply_descr'=>$post['t_apply_descr'], 't_apply_cert'=>$post['t_apply_cert'] ]; } $data['k_type']=$list['k_type']; $idata=array_merge($sdata,$data); Db::name('cult4baseinfo')->insertGetId($idata); //修改旧记录 $data=['base_id'=>$list['base_id'],'new_flag'=>0]; Db::name('cult4baseinfo')->update($data); //修改主表 $data=[ 'apply_id'=>$list['apply_id'], 'apply_admin_id'=>0, 'update_time'=>time(), 'update_user_id'=>session('hid'), 'update_user_type'=>1, 'pay_img'=>'', 'seq'=>0, 'status'=>$status ]; Db::name('cult4apply')->update($data); // 提交事务 Db::commit(); } catch (\Exception $e) { // 回滚事务 Db::rollback(); $this->error('提交失败'); } $this->success('提交成功',url('home/Center/my')); }else{ if(!$uid) $this->redirect(url('home/Login/index')); if(!$list) $this->error('该挂牌资料不在修改状态中'); if(in_array($list['apply_type'],[1,2,4,5])){ $ppid=$list['p_addr_province']; $pcid=$list['p_addr_city']; $ppid2=$list['p_addr2_province']; $pcid2=$list['p_addr2_city']; $maps=[1,$ppid,$pcid,$ppid2,$pcid2]; $province=$addr_city=$addr_town=$addr2_city=$addr2_town=[]; $regions=Db::name('region')->where ('pid','in',$maps)->select(); foreach ($regions as $item){ switch ($item['pid']){ case 1: array_push($province,$item); break; case $ppid: array_push($addr_city,$item); break; case $pcid: array_push($addr_town,$item); break; case $ppid2: array_push($addr2_city,$item); break; case $pcid2: array_push($addr2_town,$item); break; } } $this->assign('province',$province); //项目地址 $this->assign('addr_city',$addr_city); $this->assign('addr_town',$addr_town); //联系地址 $this->assign('addr2_city',$addr2_city); $this->assign('addr2_town',$addr2_town); } if($list['apply_type']==1){ $c_type=$list['c_intellectual_prop_type']; $c_checked=[0,0,0]; $checkedlist=[1=>[1,0,0],[0,1,0],[0,0,1],[1,1,0],[1,0,1],[0,1,1],[1,1,1]]; if(isset($checkedlist[$c_type]))$c_checked=$checkedlist[$c_type]; $this->assign('c_intellectual_prop_type_checked',$c_checked); } if($list['apply_type']==4){ $cequity=$list['c_equity']?json_decode($list['c_equity'],true):[]; $cfinance=$list['c_finance']?json_decode($list['c_finance'],true):[]; $cdecision=$list['c_decision']?json_decode($list['c_decision'],true):[]; $ctransferee=$list['c_transferee']?json_decode($list['c_transferee'],true):[]; $cnotice=$list['c_notice']?json_decode($list['c_notice'],true):[]; $cbase=$list['c_base']?json_decode($list['c_base'],true):[]; $ctransferor=$list['c_transferor']?json_decode($list['c_transferor'],true):[]; $cinvestor=$list['c_investor']?json_decode($list['c_investor'],true):[]; $this->assign('cequity',$cequity); $this->assign('cfinance',$cfinance); $this->assign('ctransferee',$ctransferee); $this->assign('cnotice',$cnotice); $this->assign('cbase',$cbase); $this->assign('ctransferor',$ctransferor); $this->assign('cinvestor',$cinvestor); $this->assign('cdecision',$cdecision); } $this->assign('list',$list); return $this->view->fetch(':gp_baseedit'); } } public function gp_fullcheck(){ return $this->gp_editcheck(true); } public function gp_editcheck($full=false){ $prefix=$this->prefix; $uid=session('hid'); if(!$uid) return $this->redirect(url('home/Login/index')); $apply_id=input('apply_id',0,'intval'); if(!$apply_id) return $this->redirect(url('home/Center/notice')); //原数据 $list=Db::name('cult4apply')->alias('a') ->join(config('database.prefix').'cult4baseinfo b','b.apply_id=a.apply_id') ->where(['a.apply_id'=>$apply_id,'b.new_flag'=>1,'user_id'=>$uid,'status'=>['in',[3,33,7,10,40,18,26,44,49,52,26]]]) ->order('addorder desc') ->find(); if(!$list) { if($full==true){ $list=Db::name('cult4apply')->alias('a') ->join($prefix.'cult4baseinfo b','b.apply_id=a.apply_id') ->where(['a.apply_id'=>$apply_id,'b.new_flag'=>1,'status'=>['in',[32,35,37,38,41,42,43,45,50,53,26]]]) ->order('addorder desc') ->find(); if(!$list) return $this->redirect(url('home/Center/notice')); }else{ return $this->redirect(url('home/Center/notice')); } } if($full==true) { return $this->redirect(url('home/Listn/gp_baseedit',['apply_id' => $apply_id,'full'=>true])); }else{ return $this->redirect(url('home/Listn/gp_baseedit',['apply_id' => $apply_id,'full'=>true])); } } public function gp_runbasecode(){ $prefix=$this->prefix; $uid=session('hid'); if(!$uid) $this->redirect(url('home/Login/index')); $apply_id=input('apply_id',0,'intval'); $this->assign('apply_id',$apply_id); if(!$apply_id) $this->error('参数错误'); //原数据 $list=Db::name('cult4apply')->alias('a') ->join($prefix.'cult4baseinfo b','b.apply_id=a.apply_id') ->where(['a.apply_id'=>$apply_id,'b.new_flag'=>1,'user_id'=>$uid,'status'=>['in',[27]]]) ->order('addorder desc') ->find(); $post=input('post.'); $file = request()->file('file_one'); if(!empty($file)) { $validate = config('upload_validate'); unset($validate['ext']);//不限制后缀 //单图 $info = $file[0]->validate($validate)->rule('md5')->move(ROOT_PATH . $this->upload_path . DS . date('Y-m-d')); if ($info) { $file_url = $this->upload_path . '/' . date('Y-m-d') . '/' . $info->getFilename(); } }else { $this->error('提交失败'); } $status=48;//公告资料提交中(已提交基础信息):48 Db::startTrans(); try{ //cult4baseinfo修改记录 $data = [ 'logo' => $file_url, 'shortname' => $post['shortname'], 'codetype' => $post['codetype'], 'code_id' => empty($post['selno'])?0:$post['selno'], 'addorder' => $list['addorder'] + 1, ]; $where = [ 'apply_id' => $apply_id, 'new_flag' => 1, ]; Db::name('cult4baseinfo')->where($where)->update($data); //修改主表 $data = [ 'apply_admin_id' => 0, 'update_time' => time(), 'update_user_id' => session('hid'), 'update_user_type' => 1, 'seq' => 0, 'status' => $status ]; $where2 = [ 'apply_id' => $apply_id, ]; Db::name('cult4apply')->where($where2)->update($data); if(!empty($post['selno'])){ //修改特殊号码表 $data = [ 'salestatus' => 1 ]; $where3 = [ 'id' => $post['selno'], ]; Db::name('cult4number')->where($where3)->update($data); } // 提交事务 Db::commit(); } catch (\Exception $e) { // 回滚事务 Db::rollback(); $this->error('提交失败'.$e->getMessage()); } $this->success('提交成功',url('home/Center/my')); } public function gp_basecode(){ $prefix=$this->prefix; $uid=session('hid'); if(!$uid) $this->redirect(url('home/Login/index')); $apply_id=input('apply_id',0,'intval'); $this->assign('apply_id',$apply_id); if(!$apply_id) $this->error('参数错误'); //原数据 $list=Db::name('cult4apply')->alias('a') ->join($prefix.'cult4baseinfo b','b.apply_id=a.apply_id') ->where(['a.apply_id'=>$apply_id,'b.new_flag'=>1,'user_id'=>$uid,'status'=>['in',[27]]]) ->order('addorder desc') ->find(); if(!$list) $this->error('该挂牌资料不在修改状态中'); $this->assign('list',$list); $pageno=input('page',0,'intval'); $this->assign('pageno',$pageno); $where = [ 'status' => 1, 'salestatus' => 0, ]; $nolist=Db::name('cult4number')->where($where)->paginate(config('paginate.list_rows'),false,['query'=>get_query()]); $page = $nolist->render(); $this->assign('nolist',$nolist); $this->assign('page',$page); return $this->view->fetch(':gp_basecode'); } public function gp_editcode(){ $prefix=$this->prefix; $uid=session('hid'); if(!$uid) return json(['code'=>0,'msg'=>'未登录','url'=>url('home/Login/index')]); $apply_id=input('apply_id',0,'intval'); if(!$apply_id) return json(['code'=>0,'msg'=>'参数错误','url'=>url('home/Center/notice')]); //原数据 $list=Db::name('cult4apply')->alias('a') ->join($prefix.'cult4baseinfo b','b.apply_id=a.apply_id') ->where(['a.apply_id'=>$apply_id,'b.new_flag'=>1,'user_id'=>$uid,'status'=>['in',[27]]]) ->order('addorder desc') ->fetchSql()->find(); if(!$list) { return json(['code'=>0,'msg'=>'该挂牌资料不在修改状态中','url'=>url('home/Center/notice')]); } return json(['code' => 1, 'msg' => '可以修改', 'url' => url('home/Listn/gp_basecode', ['apply_id' => $apply_id])]); } public function gp_upcheck($apply_id=0,$arr=false){ $prefix=$this->prefix; $uid=session('hid'); if(!$uid) return $this->redirect(url('home/Login/index')); $apply_id=$apply_id?:input('apply_id',0,'intval'); if(!$apply_id) return $this->redirect(url('home/Center/notice')); //原数据 $list=Db::name('cult4apply')->alias('a') ->join($prefix.'cult4baseinfo b','b.apply_id=a.apply_id') ->where(['a.apply_id'=>$apply_id,'b.new_flag'=>1,'status'=>['in',[32,35,37,38,41,42,43,45,50,53]]]) ->order('addorder desc') ->find(); if(!$list) return $this->redirect(url('home/Center/notice')); //取得是否有需要上传的资料 $rst=get_unuploadfiles($apply_id,$list['status'],-1,$uid,-1,0); if($rst){ return $arr?['code'=>1,'files'=>$rst,'msg'=>'可以上传','url'=>url('home/Listn/gp_upedit',['apply_id'=>$apply_id])]:json(['code'=>1,'files'=>$rst,'msg'=>'可以上传','url'=>url('home/Listn/gp_upedit',['apply_id'=>$apply_id])]); }else{ $this->error("该挂牌申请已经上传材料或您无权限上传"); } } public function gp_upedit(){ $prefix=$this->prefix; $uid=session('hid'); $apply_id=input('apply_id',0,'intval'); if(!$apply_id) $this->error('参数错误'); $rst=$this->gp_upcheck($apply_id,true); if($rst['code']==0){ $this->error($rst['msg'],$rst['url']); } //原数据 $list=Db::name('cult4apply')->alias('a') ->join($prefix.'cult4baseinfo b','b.apply_id=a.apply_id') ->where(['a.apply_id'=>$apply_id,'b.new_flag'=>1,'status'=>['in',[32,35,37,38,41,42,43,45,50,53]]]) ->order('addorder desc') ->find(); //5.29修改,为兼容IE8,修改为isPost if(request()->isPost()){ if(!$uid){ $this->error('请重新登录后在提交'); } //提交 $files_uptype=$rst['files']; Db::startTrans(); try{ //上传附件 //5.29修改 $files = request()->file(''); $payment_url=''; $payment_info=''; if ($files) { foreach ($files as $key=>$file) { if($file->getInfo('size')>(20*1024*1024)){ session('TOKEN', input('TOKEN')); Db::rollback(); return json(['code'=>0,'msg'=>'上传文件不能大于20M!']); } if(!in_array(strtoupper(substr(strrchr($file->getInfo('name'), '.'), 1)),['PDF','JPG','DOC','DOCX'])){ session('TOKEN', input('TOKEN')); Db::rollback(); return json(['code'=>0,'msg'=>'上传文件类型错误!']); } if(in_array($key,['payment_url','payment_info'])){ if(strtoupper(substr(strrchr($file->getInfo('name'), '.'), 1))!=='PDF'){ session('TOKEN', input('TOKEN')); $this->error('上传文件类型错误!'); } $upath=$this->upload_path . DS . date('Y-m-d'); $info = $file->rule('md5')->move(ROOT_PATH .$upath); if ($info) { $img_url=$upath.DS.$info->getFilename(); if($key=='payment_url')$payment_url=$img_url; if($key=='payment_info')$payment_info=$img_url; }else { $error=$file->getError(); if(empty($error))$error="文件上传失败"; $this->error($error); } }else{ //处理file_one2,得到ftype_id $ftype_id=intval(substr($key,8)); if(!check_upfiletype('cult4uptype',$ftype_id,substr(strrchr($file->getInfo('name'), '.'), 1))){ session('TOKEN', input('TOKEN')); $this->error('上传文件类型错误!'); } $info = $file->rule('md5')->move(ROOT_PATH . $this->upload_path . DS . date('Y-m-d')); if ($info) { $img_url = $this->upload_path. '/' . date('Y-m-d') . '/' . $info->getFilename(); //写入数据表cult4upfiles $data=[ 'apply_id'=>$apply_id, 'user_id'=>session('hid'), 'user_type'=>1, 'status'=>1, 'upload_time'=>time(), 'ftype_id'=>$ftype_id, 'ftype'=>($files_uptype[$ftype_id]['apply_id']==0)?1:2, 'filesize'=>$info->getSize(), 'path'=>$img_url, 'flag'=>0 ]; Db::name('cult4upfiles')->insertGetId($data); } } } } //判断是否还存在未上传资料 $unupfile=get_unuploadfiles($apply_id,$list['status'],-1,-1,-1,0); $lstatus=$list['status']; $status=$lstatus; if(!$unupfile){ $status=1; $statuslist=[32=>1,35=>2,37=>5,38=>6,42=>15,43=>16,45=>25,50=>29,53=>30]; if(isset($statuslist[$lstatus]))$status=$statuslist[$lstatus]; if($lstatus==41){ $fee_flag=Db::name('cult4fee')->where('apply_id',$apply_id)->value('fee_flag'); $status=$fee_flag?12:9; } } if($lstatus==38){ $status=6; } if($lstatus==43){ $status=30; } //修改主表 $data=[ 'apply_id'=>$list['apply_id'], 'apply_admin_id'=>0, 'update_time'=>time(), 'update_user_id'=>session('hid'), 'update_user_type'=>1, 'seq'=>0, 'status'=>$status ]; Db::name('cult4apply')->update($data); if($payment_info&&$payment_url){ Db::name('cult4baseinfo')->where(['apply_id'=>$apply_id])->update(['payment_url'=>$payment_url,'payment_info'=>$payment_info]); } // 提交事务 Db::commit(); } catch (\Exception $e) { // 回滚事务 Db::rollback(); $this->error('提交失败'); } $this->success('提交成功',url('home/Center/my')); }else{ if(!$uid) $this->redirect(url('home/Login/index')); //只显示当前有权限的未上传的 $files=$rst['files']; $this->assign('files',$files); $this->assign('list',$list); return $this->view->fetch(':gp_upedit'); } } public function gp_jtcheck(){ $prefix=$this->prefix; $uid = session('hid'); if(!$uid) return json(['code'=>0,'msg'=>'未登录','url'=>url('home/Login/index')]); $role_id=Db::name('member_list')->where('member_list_id',$uid)->value('member_list_groupid'); if($role_id !=4) return json(['code'=>0,'msg'=>'您无权尽职调查!','url'=>url('home/Center/notice')]); $apply_id=input('apply_id',0,'intval'); if(!$apply_id) return json(['code'=>0,'msg'=>'参数错误','url'=>url('home/Center/notice')]); //原数据 $list=Db::name('cult4apply')->alias('a') ->join($prefix.'cult4baseinfo b','b.apply_id=a.apply_id') ->where(['a.apply_id'=>$apply_id,'b.new_flag'=>1,'status'=>['in',[2,32,35,37,38,41,42,43,45,50,53]],'member_recmd'=>$uid]) ->order('addorder desc') ->find(); if(!$list){ return json(['code'=>0,'msg'=>'该挂牌资料不在尽职调查中或您无权尽职调查','url'=>url('home/Center/notice')]); } //判断是否存在要上传资料 $unupfile=get_unuploadfiles($apply_id,$list['status'],-1,$uid,-1,0); if(!$unupfile){ return json(['code'=>0,'msg'=>'该挂牌资料不在尽职调查中或您无权尽职调查','url'=>url('home/Center/notice')]); } return json(['code'=>1,'msg'=>'可以尽职调查','url'=>url('home/Listn/gp_jzdc',['apply_id'=>$apply_id])]); } public function gp_jzdc() { $prefix=$this->prefix; $uid = session('hid'); if(!$uid) $this->redirect(url('home/Login/index')); $role_id=Db::name('member_list')->where('member_list_id',$uid)->value('member_list_groupid'); if($role_id !=4) $this->error('您无权尽职调查!',url('home/Center/notice')); $apply_id=input('apply_id',0,'intval'); if(!$apply_id) $this->error('参数错误',url('home/Center/notice')); //原数据 $list=Db::name('cult4apply')->alias('a') ->join($prefix.'cult4baseinfo b','b.apply_id=a.apply_id') ->where(['a.apply_id'=>$apply_id,'b.new_flag'=>1,'status'=>['in',[2,32,35,37,38,41,42,43,45,50,53]],'member_recmd'=>$uid]) ->order('addorder desc') ->find(); if(!$list) { $this->error('该挂牌资料不在尽职调查中或您无权尽职调查', url('home/Center/notice')); } //判断是否存在要上传资料 $unupfile=get_unuploadfiles($apply_id,$list['status'],-1,$uid,-1,0); if(!$unupfile){ $this->error('该挂牌资料不在尽职调查中或您无权尽职调查', url('home/Center/notice')); } //尽职调查 $this->assign('baseinfo',$list); //证件类型表 $cardtype=Db::name('cult4cardtype')->order('id')->select(); $this->assign('cardtype',$cardtype); //项目对应列表信息 $apid=$list['p_addr_province']; $acid=$list['p_addr_city']; $apid2=$list['p_addr2_province']; $acid2=$list['p_addr2_city']; $regions=Db::name('Region')->where ('pid','in',[1,$apid,$acid,$apid2,$acid2])->select(); $province=$city=$town=$city2=$town2=[]; foreach ($regions as $item){ switch ($item['pid']){ case 1: array_push($province, $item); break; case $apid: array_push($city, $item); break; case $acid: array_push($town, $item); break; case $apid2: array_push($city2, $item); break; case $acid2: array_push($town2, $item); break; } } $this->assign('province',$province);//省份表 $this->assign('city',$city);//项目地址市表 $this->assign('town',$town);//项目地址区表 $this->assign('city2',$city2);//联系地址市表 $this->assign('town2',$town2); //联系地址区表 $whereType=array('apply_id'=>$apply_id,'new_flag'=>1); $info=Db::name('cult4baseinfo')->field('apply_type,c_type,p_type,k_type')->where($whereType)->find(); $apply_type=''; $c_type=''; $p_type=''; $k_type=''; if($info){ $apply_type=$info['apply_type']; $c_type=$info['c_type']; $p_type=$info['p_type']; $k_type=$info['k_type']; } //取得apply_id对应的用户录入状态下的所有固定文件类型最新记录 $apply_uptypelist=UptypeModel::getList($apply_type,$c_type,$p_type,$apply_id,1,0,1,'ftype_id,status,apply_id,isopen',-1,$k_type); $this->assign('apply_uptypelist',$apply_uptypelist); $this->assign('status',$list['status']); $this->assign('apply_id',$apply_id); //取得apply_id对应的用户初审状态下的所有固定文件类型最新记录 $apply_uptypelist_check=UptypeModel::getList($apply_type,$c_type,$p_type,$apply_id,1,array(1,19),1,'ftype_id,status,apply_id,isopen',-1,$k_type); $this->assign('apply_uptypelist_check',$apply_uptypelist_check); //取得apply_id对应的用户初审状态下的所有补充文件类型最新记录 $apply_uptypelist_tempcheck=UptypeModel::getList($apply_type,$c_type,$p_type,$apply_id,2,array(1,19),1,'ftype_id,status,apply_id,isopen',-1,$k_type); $this->assign('apply_uptypelist_tempcheck',$apply_uptypelist_tempcheck); //取得apply_id对应的用户尽调状态下的所有固定文件类型最新记录 $apply_uptypelist_checkdd=UptypeModel::getList($apply_type,$c_type,$p_type,$apply_id,1,array(2,36),1,'ftype_id,status,apply_id,isopen',-1,$k_type); $this->assign('apply_uptypelist_checkdd',$apply_uptypelist_checkdd); //取得apply_id对应的用户尽调状态下的所有补充文件类型最新记录 $apply_uptypelist_tempcheckdd=UptypeModel::getList($apply_type,$c_type,$p_type,$apply_id,2,array(2,36),1,'ftype_id,status,apply_id,isopen',-1,$k_type); $this->assign('apply_uptypelist_tempcheckdd',$apply_uptypelist_tempcheckdd); return $this->view->fetch(':gp_jzdc'); } public function gp_jzdc_up(){ $apply_id=input('apply_id'); $user_id=session('hid'); if(!$user_id){ return json_encode(['code'=>0,'msg'=>'请先登陆!']); } //当前前台用户对应的组 $groupid=Db::name('member_list')->where('member_list_id',$user_id)->value('member_list_groupid'); if($groupid !=4){ return json_encode(['code'=>0,'msg'=>'您无权尽职调查!']); } $list=Db::name('cult4apply')->where('apply_id',$apply_id)->find(); if(!$list){ return json_encode(['code'=>0,'msg'=>'上传失败,申请不存在!']); } //取得所有未上传文件,上传资料列表提交 $unupfile=get_unuploadfiles($apply_id,$list['status'],-1,$user_id,-1,0); foreach($unupfile as $k=>$v){ //找到当前最大addorder $addorder=0; $where4=array( 'apply_id'=>$apply_id, 'ftype_id'=>$v['ftype_id'], ); $check=Db::name('cult4upfiles')->where($where4)->order('addorder desc') ->find (); if(!empty($check)){ $addorder = $check['addorder'] + 1; } //上传资料部分 //支持多个字段单文件 $file = request()->file('file'.$v['ftype_id']); if(!empty($file)){ //更新所有历史记录new_flag为0 Db::name('cult4upfiles')->where($where4)->update(['new_flag'=>0]); $validate = config('upload_validate'); unset($validate['ext']);//不限制后缀 $info = $file->validate($validate)->rule('md5')->move(ROOT_PATH . $this->upload_path . DS . date('Y-m-d')); if ($info) { $file_url = $this->upload_path. '/' . date('Y-m-d') . '/' . $info->getFilename(); //写入数据库 $data['apply_id'] = $apply_id; $data['user_id'] = $user_id; $data['user_type'] = 1;//前台 $data['status'] = $v['status']; $data['upload_time'] = time(); $data['ftype_id'] = $v['ftype_id']; $data['ftype'] = $v['apply_id']==0?1:0; $data['filesize'] = $info->getSize(); $data['path'] = $file_url; $data['addorder'] = $addorder; $data['new_flag'] = 1;//最新 $data['flag'] = 0;//前台上传,需再审 $rst=Db::name('cult4upfiles')->insert($data); if(!$rst){ return json_encode(['code'=>0,'msg'=>'上传失败']); } } else {//否则就是上传错误,显示错误原因 return json_encode(['code'=>0,'msg'=>$file->getError()]); } } } //判断是否还存在未上传资料 $unupfile2=get_unuploadfiles($apply_id,$list['status'],-1,-1,-1,0); if(!$unupfile2){ $status=1; $statuslist=[2=>2,32=>1,35=>2,37=>5,38=>6,42=>15,45=>25,50=>29,53=>30]; $lstatus=$list['status']; if(isset($statuslist[$lstatus]))$status=$statuslist[$lstatus]; if($lstatus==41){ $fee_flag=Db::name('cult4fee')->where('apply_id',$apply_id)->value('fee_flag'); $status=$fee_flag?12:9; } }else{ $status=$list['status']; } //修改主表 $data=[ 'apply_id'=>$list['apply_id'], 'apply_admin_id'=>0, 'update_time'=>time(), 'update_user_id'=>session('hid'), 'update_user_type'=>1, 'seq'=>0, 'status'=>$status ]; Db::name('cult4apply')->update($data); return json_encode(['code'=>1,'msg'=>'上传成功','url'=>url('home/Center/notice')]); } public function tg_procheck(){ $prefix=$this->prefix; if(!session('hid')) return json(['code'=>0,'msg'=>'未登录','url'=>url('home/Login/index')]); $role_id=Db::name('member_list')->where('member_list_id',session('hid'))->value('member_list_groupid'); if($role_id !=6) return json(['code'=>0,'msg'=>'您无权专家评审!','url'=>url('home/Center/capnotice')]); $apply_id=input('apply_id',0,'intval'); $mobile=input('mobile',0,'intval'); if(!$apply_id) return json(['code'=>0,'msg'=>'参数错误','url'=>url('home/Center/capnotice')]); //原数据 $list=Db::name('capitalapply')->alias('a') ->join($prefix.'capitalbaseinfo b','b.apply_id=a.apply_id') ->join($prefix.'capitalproassign c','c.apply_id=a.apply_id') ->where(['a.apply_id'=>$apply_id,'c.user_id'=>session('hid'),'c.assign_type'=>0,'c.del_flag'=>0,'status'=>40]) ->order('b.base_id desc') ->find(); if($list){ if($mobile){ $jump=url('mobile/Center/tg_pro',['apply_id'=>$apply_id]); }else{ $jump=url('home/Listn/tg_pro',['apply_id'=>$apply_id]); } return json(['code'=>1,'msg'=>'可以专家评审','url'=>$jump]); }else{ if($mobile){ $jump=url('mobile/Center/notice'); }else{ $jump=url('home/Center/capnotice'); } return json(['code'=>0,'msg'=>'该托管项目不在可专家评审中或您无权专家评审','url'=>$jump]); } } public function tg_pro(){ $prefix=$this->prefix; if(!session('hid')) $this->redirect(url('home/Login/index')); $role_id=Db::name('member_list')->where('member_list_id',session('hid'))->value('member_list_groupid'); if($role_id !=6) $this->error('您无权专家评审!',url('home/Center/myscore')); $apply_id=input('apply_id',0,'intval'); if(!$apply_id) $this->error('参数错误',url('home/Center/myscore')); //原数据 $list=Db::name('capitalapply')->alias('a') ->join($prefix.'capitalbaseinfo b','b.apply_id=a.apply_id') ->join($prefix.'capitalproassign c','c.apply_id=a.apply_id') ->where(['a.apply_id'=>$apply_id,'c.user_id'=>session('hid'),'c.assign_type'=>0,'c.del_flag'=>0,'status'=>40]) ->order('b.base_id desc') ->find(); if($list){ if(request()->isAjax()){ $pro_id=input('pro_id'); $advice=htmlspecialchars_decode(input('advice','')); if($advice==''){ $this->error('请输入专家评分意见!',url('home/Listn/tg_pro#pro',array('apply_id'=>$apply_id,'snd'=>rand(10000,99999)))); } $score=input('score'.$pro_id); if($score<=0){ $this->error('请录入评分!',url('home/Listn/tg_pro#pro',array('apply_id'=>$apply_id,'snd'=>rand(10000,99999)))); } $dids=input('dids'); $cnames=input('cnames'); $cprices=input('cprices'); $check=false; if($dids&&$cnames){ try { $dids=explode(";",$dids); $cnames=explode(";",$cnames); $cprices=explode(";",$cprices); $set=[]; foreach ($dids as $k=>$jo){ $name=isset($cnames[$k])?$cnames[$k]:''; $price=isset($cprices[$k])?$cprices[$k]:''; $ret=Db::name('capitaldetail')->where(['id'=>$jo,'apply_id'=>$apply_id])->update(['zj_name'=>$name,'capital_gprice'=>$price]); if($ret&&!$check)$check=true; } } catch (Exception $e) { } } //更新评分表cult4apply $sl_data['score']=$score; $sl_data['advice']=$advice; $sl_data['update_id']=session('hid'); $sl_data['update_type']=1;//前台 $sl_data['update_time']=time(); $where=array('pro_id'=>$pro_id); $query=Db::name('capitalproassign')->where($where)->update($sl_data); if($query&&$check){ Db::name('capitalbaseinfo')->where(['apply_id'=>$apply_id])->update(['proassign'=>1]); } $this->success('评分成功',url('home/Center/myscore'));//专家评分确认后返回到通知列表 }else{ $list['tg_type']=$list['tg_type']?explode(',', $list['tg_type']):[]; $this->assign('baseinfo',$list); //证件类型表 $cardtype=Db::name('cult4cardtype')->order('id')->select(); $this->assign('cardtype',$cardtype); //取得apply_id对应的用户录入状态下的所有固定文件类型最新记录 $apply_type=$list['apply_type']; $products = Db::name('capitaldetail')->where(['apply_id'=>$apply_id])->select(); if(!empty($products)){ if(count($products)){ foreach ($products as $key=>$row){ $reason=explode(",", $row['hoster_reason']); $str=''; if(in_array(1,$reason))$str.='资产背书'; if(in_array(2,$reason))$str.='、协议转让'; if(in_array(3,$reason))$str.='、资产拍卖'; if(in_array(4,$reason))$str.='、资产管理计划(产品设计)'; $products[$key]['hoster_reason']=$str; $products[$key]['capital_files']=explode(";", $row['capital_files']); } } } $this->assign('products',$products); $mobile=''; if($apply_type==2)$mobile=1; $apply_uptypelist=CapUptypeModel::getList($apply_type,$apply_id,1,0,1,'ftype_id,status,apply_id,isopen',-1,$mobile); foreach ($apply_uptypelist as $k=>$row){ $ftype_id=$row['ftype_id']; $where['ftype_id']=array('eq', $ftype_id); $where['new_flag']=array('eq', 1); $where['apply_id']=array('eq', $apply_id); $fileInfo = db('capital_upfiles')->where($where)->order('addorder desc')->find(); $row['flag']=''; $row['path']=''; $row['file_id']=''; $row['upload_time']=''; $row['filesize']=''; if($fileInfo){ $row['flag']=$fileInfo['flag']; $row['filesize']=$fileInfo['filesize']; $row['path']=$fileInfo['path']; $row['file_id']=$fileInfo['file_id']; $row['upload_time']=$fileInfo['upload_time']; } $apply_uptypelist[$k]=$row; } $this->assign('apply_uptypelist',$apply_uptypelist); $this->assign('status',2); $this->assign('apply_id',$apply_id); //缴费状态 $where=array( 'apply_id'=>$apply_id ); $fee_flag=Db::name('capitalfee')->where($where)->value('fee_flag'); $this->assign('fee_flag',$fee_flag); //已分配专家及分配专家评分 $pro=Db::name('capitalproassign')->where(['del_flag'=>0,'apply_id'=>$apply_id,'user_id'=>session('hid')])->find(); $this->assign('pro',$pro); $checkinfo = Db::name('capitalcheck')->where(['apply_id'=>$apply_id])->select(); $config=require_once APP_PATH.'capital/config.php'; $status=isset($config['status'.$apply_type])?$config['status'.$apply_type]:[]; if($checkinfo){ foreach ($checkinfo as $k=>$row){ $check_type=$row['check_type']; $checkinfo[$k]['infor']=$status[$check_type]; } } $this->assign('checkinfo',$checkinfo); return $this->view->fetch(':tg_pro'); } }else{ $this->error('该托管资料不在专家评审中或您无权专家评审',url('home/Center/myscore')); } } public function gp_procheck(){ $prefix=$this->prefix; if(!session('hid')) return json(['code'=>0,'msg'=>'未登录','url'=>url('home/Login/index')]); $role_id=Db::name('member_list')->where('member_list_id',session('hid'))->value('member_list_groupid'); if($role_id !=3) return json(['code'=>0,'msg'=>'您无权专家评审!','url'=>url('home/Center/notice')]); $apply_id=input('apply_id',0,'intval'); if(!$apply_id) return json(['code'=>0,'msg'=>'参数错误','url'=>url('home/Center/notice')]); //原数据 $list=Db::name('cult4apply')->alias('a') ->join($prefix.'cult4baseinfo b','b.apply_id=a.apply_id') ->join($prefix.'cult4proassign c','c.apply_id=a.apply_id') ->where(['a.apply_id'=>$apply_id,'b.new_flag'=>1,'c.user_id'=>session('hid'),'c.assign_type'=>0,'c.del_flag'=>0,'status'=>['in',[15]]]) ->order('b.addorder desc') ->find(); if($list){ return json(['code'=>1,'msg'=>'可以专家评审','url'=>url('home/Listn/gp_pro',['apply_id'=>$apply_id])]); }else{ return json(['code'=>0,'msg'=>'该挂牌资料不在可专家评审中或您无权专家评审','url'=>url('home/Center/notice')]); } } public function gp_pro(){ $prefix=$this->prefix; if(!session('hid')) $this->redirect(url('home/Login/index')); $role_id=Db::name('member_list')->where('member_list_id',session('hid'))->value('member_list_groupid'); if($role_id !=3) $this->error('您无权专家评审!',url('home/Center/notice')); $apply_id=input('apply_id',0,'intval'); if(!$apply_id) $this->error('参数错误',url('home/Center/notice')); //原数据 $list=Db::name('cult4apply')->alias('a') ->join($prefix.'cult4baseinfo b','b.apply_id=a.apply_id') ->join($prefix.'cult4proassign c','c.apply_id=a.apply_id') ->where(['a.apply_id'=>$apply_id,'b.new_flag'=>1,'c.user_id'=>session('hid'),'c.assign_type'=>0,'c.del_flag'=>0,'status'=>['in',[15]]]) ->order('b.addorder desc') ->find(); if($list){ if(request()->isAjax()){ $pro_id=input('pro_id'); $advice=htmlspecialchars_decode(input('advice','')); if($advice==''){ $this->error('请输入专家评分意见!',url('home/Listn/gp_pro#pro',array('apply_id'=>$apply_id,'snd'=>rand(10000,99999)))); } $score=input('score'.$pro_id); if($score<=0){ $this->error('请录入评分!',url('home/Listn/gp_pro#pro',array('apply_id'=>$apply_id,'snd'=>rand(10000,99999)))); } //更新评分表cult4apply $sl_data['score']=$score; $sl_data['advice']=$advice; $sl_data['update_id']=session('hid'); $sl_data['update_type']=1;//前台 $sl_data['update_time']=time(); $where=array( 'pro_id'=>$pro_id, ); Db::name('cult4proassign')->where($where)->update($sl_data); $this->success('评分成功',url('home/Center/notice'));//专家评分确认后返回到通知列表 }else{ $this->assign('baseinfo',$list); //证件类型表 $cardtype=Db::name('cult4cardtype')->order('id')->select(); $this->assign('cardtype',$cardtype); //项目对应列表信息 //省份表 $province = Db::name('Region')->where ( array('pid'=>1) )->select (); $this->assign('province',$province); //项目地址市表 $city=Db::name('Region')->where ( array('pid'=>$list['p_addr_province']) )->select (); $this->assign('city',$city); //项目地址区表 $town=Db::name('Region')->where ( array('pid'=>$list['p_addr_city']) )->select (); $this->assign('town',$town); //联系地址市表 $city2=Db::name('Region')->where ( array('pid'=>$list['p_addr2_province']) )->select (); $this->assign('city2',$city2); //联系地址区表 $town2=Db::name('Region')->where ( array('pid'=>$list['p_addr2_city']) )->select (); $this->assign('town2',$town2); //取得apply_id对应的用户录入状态下的所有固定文件类型最新记录 $whereType=array( 'apply_id'=>$apply_id, 'new_flag'=>1, ); $baseinfo=Db::name('cult4baseinfo')->field('apply_type,c_type,p_type,k_type')->where($whereType)->find(); $apply_type=$baseinfo['apply_type']; $c_type=$baseinfo['c_type']; $p_type=$baseinfo['p_type']; $k_type=$baseinfo['k_type']; $apply_uptypelist=UptypeModel::getList($apply_type,$c_type,$p_type,$apply_id,1,0,1,'ftype_id,status,apply_id,isopen',-1,$k_type); $this->assign('apply_uptypelist',$apply_uptypelist); $this->assign('status',2); $this->assign('apply_id',$apply_id); //取得apply_id对应的用户初审状态下的所有固定文件类型最新记录 $apply_uptypelist_check=UptypeModel::getList($apply_type,$c_type,$p_type,$apply_id,1,array(1,19),1,'ftype_id,status,apply_id,isopen',-1,$k_type); $this->assign('apply_uptypelist_check',$apply_uptypelist_check); //取得apply_id对应的用户初审状态下的所有补充文件类型最新记录 $apply_uptypelist_tempcheck=UptypeModel::getList($apply_type,$c_type,$p_type,$apply_id,2,array(1,19),1,'ftype_id,status,apply_id,isopen',-1,$k_type); $this->assign('apply_uptypelist_tempcheck',$apply_uptypelist_tempcheck); //取得apply_id对应的用户尽调状态下的所有固定文件类型最新记录 $apply_uptypelist_checkdd=UptypeModel::getList($apply_type,$c_type,$p_type,$apply_id,1,array(2,36),1,'ftype_id,status,apply_id,isopen',-1,$k_type); $this->assign('apply_uptypelist_checkdd',$apply_uptypelist_checkdd); //取得apply_id对应的用户尽调状态下的所有补充文件类型最新记录 $apply_uptypelist_tempcheckdd=UptypeModel::getList($apply_type,$c_type,$p_type,$apply_id,2,array(2,36),1,'ftype_id,status,apply_id,isopen',-1,$k_type); $this->assign('apply_uptypelist_tempcheckdd',$apply_uptypelist_tempcheckdd); //取得apply_id对应的用户复审状态下的所有固定文件类型最新记录 $apply_uptypelist_checkreview=UptypeModel::getList($apply_type,$c_type,$p_type,$apply_id,1,array(5,20),1,'ftype_id,status,apply_id,isopen',-1,$k_type); $this->assign('apply_uptypelist_checkreview',$apply_uptypelist_checkreview); //取得apply_id对应的用户复审状态下的所有补充文件类型最新记录 $apply_uptypelist_tempcheckreview=UptypeModel::getList($apply_type,$c_type,$p_type,$apply_id,2,array(5,20),1,'ftype_id,status,apply_id,isopen',-1,$k_type); $this->assign('apply_uptypelist_tempcheckreview',$apply_uptypelist_tempcheckreview); //取得apply_id对应的用户风控审核状态下的所有固定文件类型最新记录 $apply_uptypelist_checkrisk=UptypeModel::getList($apply_type,$c_type,$p_type,$apply_id,1,array(6,21),1,'ftype_id,status,apply_id,isopen',-1,$k_type); $this->assign('apply_uptypelist_checkrisk',$apply_uptypelist_checkrisk); //取得apply_id对应的用户风控审核状态下的所有补充文件类型最新记录 $apply_uptypelist_tempcheckrisk=UptypeModel::getList($apply_type,$c_type,$p_type,$apply_id,2,array(6,21),1,'ftype_id,status,apply_id,isopen',-1,$k_type); $this->assign('apply_uptypelist_tempcheckrisk',$apply_uptypelist_tempcheckrisk); //取得apply_id对应的用户缴费确认状态下的所有固定文件类型最新记录 $apply_uptypelist_checkfee=UptypeModel::getList($apply_type,$c_type,$p_type,$apply_id,1,array(9,12,33,22),1,'ftype_id,status,apply_id,isopen',-1,$k_type); $this->assign('apply_uptypelist_checkfee',$apply_uptypelist_checkfee); //取得apply_id对应的用户缴费确认状态下的所有补充文件类型最新记录 $apply_uptypelist_tempcheckfee=UptypeModel::getList($apply_type,$c_type,$p_type,$apply_id,2,array(9,12,33,22),1,'ftype_id,status,apply_id,isopen',-1,$k_type); $this->assign('apply_uptypelist_tempcheckfee',$apply_uptypelist_tempcheckfee); //缴费状态 $where=array( 'apply_id'=>$apply_id, 'new_flag'=>1, ); $fee_flag=Db::name('cult4fee')->where($where)->value('fee_flag'); $this->assign('fee_flag',$fee_flag); //取得apply_id对应的专家评分中(专家已分配)状态下的所有固定文件类型最新记录 $apply_uptypelist_checkpro=UptypeModel::getList($apply_type,$c_type,$p_type,$apply_id,1,array(14,15,23),1,'ftype_id,status,apply_id,isopen',-1,$k_type); $this->assign('apply_uptypelist_checkpro',$apply_uptypelist_checkpro); //取得apply_id对应的专家评分中(专家已分配)状态下的所有补充文件类型最新记录 $apply_uptypelist_tempcheckpro=UptypeModel::getList($apply_type,$c_type,$p_type,$apply_id,2,array(14,15,23),1,'ftype_id,status,apply_id,isopen',-1,$k_type); $this->assign('apply_uptypelist_tempcheckpro',$apply_uptypelist_tempcheckpro); //已分配专家及分配专家评分 $pro=Db::name('cult4proassign') ->where(['del_flag'=>0,'apply_id'=>$apply_id,'user_id'=>session('hid')]) ->find(); $this->assign('pro',$pro); return $this->view->fetch(':gp_pro'); } }else{ $this->error('该挂牌资料不在专家评审中或您无权专家评审',url('home/Center/notice')); } } public function gp_proup(){ $apply_id=input('apply_id'); $user_id=session('hid'); //当前前台用户对应的组 $groupid=Db::name('member_list')->where('member_list_id',$user_id)->value('member_list_groupid'); //上传资料列表提交 //取得apply_id对应的用户对应状态下的所有固定文件类型最新记录 $whereType=array( 'apply_id'=>$apply_id, 'new_flag'=>1, ); $baseinfo=Db::name('cult4baseinfo')->field('apply_type,c_type,p_type,k_type')->where($whereType)->find(); $apply_type=$baseinfo['apply_type']; $c_type=$baseinfo['c_type']; $p_type=$baseinfo['p_type']; $k_type=$baseinfo['k_type']; $apply_uptypelist_checkdd=UptypeModel::getList($apply_type,$c_type,$p_type,$apply_id,1,array(14,15,23),1,'ftype_id,status,apply_id,isopen',-1,$k_type); foreach($apply_uptypelist_checkdd as $k=>$v){ //如果后台有上传权限 if( (($v['upload_role_type']==1) and ($v['upload_role_id']==$groupid) ) or (($v['upload_role_type2']==1) and ($v['upload_role_id2']==$groupid)) ){ //找到当前最大addorder $addorder=0; $where4=array( 'apply_id'=>$apply_id, 'ftype_id'=>$v['ftype_id'], 'ftype'=>1,//固定 'flag'=>0,//未审核 ); $check=Db::name('cult4upfiles')->where($where4)->order('addorder desc') ->find (); if(!empty($check)){ $addorder = $check['addorder'] + 1; } //上传资料部分 //支持多个字段单文件 $file = request()->file('file'.$v['ftype_id']); if(!empty($file)){ //更新所有历史记录new_flag为0 Db::name('cult4upfiles')->where($where4)->update(['new_flag'=>0]); $validate = config('upload_validate'); unset($validate['ext']);//不限制后缀 $info = $file->validate($validate)->rule('md5')->move(ROOT_PATH . $this->upload_path . DS . date('Y-m-d')); if ($info) { $file_url = $this->upload_path. '/' . date('Y-m-d') . '/' . $info->getFilename(); //写入数据库 $data=[]; $data['apply_id'] = $apply_id; $data['user_id'] = $user_id; $data['user_type'] = 1;//前台 $data['status'] = $v['status']; $data['upload_time'] = time(); $data['ftype_id'] = $v['ftype_id']; $data['ftype'] = 1;//固定 $data['filesize'] = $info->getSize(); $data['path'] = $file_url; $data['addorder'] = $addorder; $data['new_flag'] = 1;//最新 $data['flag'] = 0;//前台上传,需再审 $rst=Db::name('cult4upfiles')->insert($data); if(!$rst){ return json_encode(['code'=>0,'msg'=>'上传失败']); } } else { //否则就是上传错误,显示错误原因 return json_encode(['code'=>0,'msg'=>$file->getError()]); } } } } //取得apply_id对应的用户对应状态下的所有补充文件类型最新记录 $apply_uptypelist_tempcheckdd=UptypeModel::getList($apply_type,$c_type,$p_type,$apply_id,2,array(14,15,23),1,'ftype_id,status,apply_id,isopen',-1,$k_type); foreach($apply_uptypelist_tempcheckdd as $k=>$v){ //如果后台有上传权限 if( (($v['upload_role_type']==1) and ($v['upload_role_id']==$groupid) ) or (($v['upload_role_type2']==1) and ($v['upload_role_id2']==$groupid)) ){ //找到当前最大addorder $addorder=0; $where5=array( 'apply_id'=>$apply_id, 'ftype_id'=>$v['ftype_id'], 'ftype'=>2,//临时 'flag'=>0,//未审核 ); $check=Db::name('cult4upfiles')->where($where5)->order('addorder desc') ->find (); if(!empty($check)){ $addorder = $check['addorder'] + 1; } //上传资料部分 //支持多个字段单文件 $file = request()->file('file'.$v['ftype_id']); if(!empty($file)){ //更新所有历史记录new_flag为0 Db::name('cult4upfiles')->where($where5)->update(['new_flag'=>0]); $validate = config('upload_validate'); unset($validate['ext']);//不限制后缀 $info = $file->validate($validate)->rule('md5')->move(ROOT_PATH . $this->upload_path . DS . date('Y-m-d')); if ($info) { $file_url = $this->upload_path. '/' . date('Y-m-d') . '/' . $info->getFilename(); //写入数据库 $data=[]; $data['apply_id'] = $apply_id; $data['user_id'] = $user_id; $data['user_type'] = 1;//前台 $data['status'] = $v['status']; $data['upload_time'] = time(); $data['ftype_id'] = $v['ftype_id']; $data['ftype'] = 2;//临时 $data['filesize'] = $info->getSize(); $data['path'] = $file_url; $data['addorder'] = $addorder; $data['new_flag'] = 1;//最新 $data['flag'] = 0;//前台上传,需再审 $rst=Db::name('cult4upfiles')->insert($data); if(!$rst){ return json_encode(['code'=>0,'msg'=>'上传失败']); } } else { //否则就是上传错误,显示错误原因 return json_encode(['code'=>0,'msg'=>$file->getError()]); } } } } return json_encode(['code'=>1,'msg'=>'上传成功','url'=>url('home/Listn/gp_pro',['apply_id'=>$apply_id])]); } public function audio(){ $lists=Db::name('video')->where(['vd_status'=>1,'vd_cid'=>3])->order('vd_order,vd_time desc')->select(); $rst=[]; foreach ($lists as $list){ $rst[]=['title'=>$list['vd_name'],'artist'=>'www.szcaee.cn','mp3'=>$list['vd_video'],'poster'=>get_imgurl($list['vd_img'])]; } $this->assign('lists',json_encode($rst)); //导航 $this->menu_id=1; $this->menu_arr=get_menu_parents($this->menu_id); if($this->menu_arr){ $this->curren_menu_id=$this->menu_arr[0]; } $this->assign('curren_menu_id',$this->curren_menu_id); $this->assign('menu_arr',$this->menu_arr); return $this->view->fetch(':audio'); } public function jf_insert(){ $apply_id=input('apply_id'); return $this->redirect(url('home/Listn/applyjf',['apply_id' => $apply_id])); } public function tsjfzm(){ $apply_id=input('apply_id'); $this->assign('apply_id',$apply_id); $cult4apply= Db::name('cult4apply')->where('apply_id',$apply_id)->find(); $this->assign('cult4apply',$cult4apply); $baseinfo = Db::name('cult4baseinfo')->where('apply_id',$apply_id)->order('addorder desc') ->find(); $this->assign('baseinfo',$baseinfo); return $this->view->fetch(':applytsjfzm'); } public function applyjf(){ $lists=Db::name('video')->where(['vd_status'=>1,'vd_cid'=>3])->order('vd_order,vd_time desc')->select(); $rst=[]; foreach ($lists as $list){ $rst[]=['title'=>$list['vd_name'],'artist'=>'www.szcaee.cn','mp3'=>$list['vd_video'],'poster'=>get_imgurl($list['vd_img'])]; } $this->assign('lists',json_encode($rst)); //导航 $apply_id=input('apply_id'); $this->assign('apply_id',$apply_id); $cult4apply= Db::name('cult4apply')->where('apply_id',$apply_id)->find(); $this->assign('cult4apply',$cult4apply); return $this->view->fetch(':applyjf'); } public function ts_insert(){ $apply_id=input('apply_id'); return $this->redirect(url('home/Listn/applyts',['apply_id' => $apply_id])); } //公用跳转 public function ts_insert_gy(){ $apply_id=input('apply_id'); $this->success('更新成功',url('home/Listn/applyts',array('apply_id'=>$apply_id,'snd'=>rand(10000,99999)))); } //上传特殊号码跳转 public function ts_insert_hm(){ $apply_id=input('apply_id'); $this->success('更新成功',url('home/Listn/applyts',array('apply_id'=>$apply_id,'snd'=>rand(10000,99999)))); } //上传logo跳转 public function ts_insert_logo(){ $apply_id=input('apply_id'); $this->success('上传成功',url('home/Listn/applyts',array('apply_id'=>$apply_id,'snd'=>rand(10000,99999)))); } //上传失败logo跳转 public function ts_insert_logosb(){ $apply_id=input('apply_id'); $this->success('上传失败',url('home/Listn/applyts',array('apply_id'=>$apply_id,'snd'=>rand(10000,99999)))); } /* * 公告资料提交对应的挂牌代码录入 */ public function apply_runaddcode() { $apply_id=input('apply_id'); $user_id=session('admin_auth.aid'); $chkStatusArray = array(48);//源代码48 //权限检查 $chkStatus=0; foreach ($chkStatusArray as $v) { if(check_cult4UserRight($apply_id,$user_id,$v)!=0){ $chkStatus=$v; break; } } if($chkStatus==0)$this->error('无权限',url('home/Listn/ts_insert_hm#nm',array('apply_id'=>$apply_id,'snd'=>rand(10000,99999)))); $codename=input('codename'); if(empty($codename)){ $this->error('请输入挂牌名称!',url('home/Listn/ts_insert_hm#nm',array('apply_id'=>$apply_id,'snd'=>rand(10000,99999)))); } $status = 29;//公告资料审核中(公告资料已提交):29 //防止重复提交 if (!checkToken(input('TOKEN'))) { return; } Db::startTrans(); try{ //更新基本信息表为已审核cult4baseinfo $sl_data2=[]; $sl_data2['base_id']=input('base_id'); $sl_data2['apply_id']=input('apply_id'); $sl_data2['codename']=$codename; $sl_data2['code_oper_id']=$user_id; $sl_data2['code_oper_type']=2;//后台 $sl_data2['code_oper_time']=time(); $where2=array( 'base_id'=>input('base_id'), ); Db::name('cult4baseinfo')->where($where2)->update($sl_data2); $sl_data3=[]; //更新主表cult4apply $sl_data3['apply_id']=$apply_id; $sl_data3['status']=48; $sl_data3['update_user_id']=$user_id; $sl_data3['update_user_type']=2;//后台 $sl_data3['update_time']=time(); //$sl_data3['apply_admin_id']=0;//还由本人操作 $where3=array( 'apply_id'=>$apply_id, 'status'=>$chkStatus, ); Db::name('cult4apply')->where($where3)->update($sl_data3); //更新文件表当前所有未通过的记录为历史记录,上传人需要重新上传 if(config('cult4files.checknm')==1){ $where4=array( 'apply_id'=>$apply_id, 'new_flag'=>1,//当前最新记录 'flag'=>0,//未审核通过 ); $sl_data4['new_flag']=0; Db::name('cult4upfiles')->where($where4)->update($sl_data4); } // 提交事务 Db::commit(); } catch (\Exception $e) { // 回滚事务 Db::rollback(); $this->error('挂牌资料录入失败'); } $this->success('挂牌资料录入成功',url('home/center/my#nm')); } /* * 后台上传操作 */ public function apply_runuploadlogo(){ $apply_id=input('apply_id'); $user_id=session('admin_auth.aid'); //权限检查 if ((check_cult4UserRight($apply_id, $user_id, 27) == 0) && (check_cult4UserRight($apply_id, $user_id, 48) == 0) && (check_cult4UserRight($apply_id, $user_id, 29) == 0)) { $this->error('无权限',url('home/Listn/ts_insert_gy')); } $file = request()->file('filelogo'); if(!empty($file)) { $validate = config('upload_validate'); unset($validate['ext']);//不限制后缀 //单图 $info = $file->validate($validate)->rule('uniqid')->move(ROOT_PATH . $this->upload_path . DS . date('Y-m-d')); if ($info) { $file_url = $this->upload_path . '/' . date('Y-m-d') . '/' . $info->getFilename(); } }else { $this->error('Logo上传失败',url('home/Listn/ts_insert_gy#nm',array('apply_id'=>$apply_id,'snd'=>rand(10000,99999)))); } $data = ['logo' => $file_url]; $where = ['apply_id' => $apply_id,'new_flag' => 1]; Db::name('cult4baseinfo')->where($where)->update($data); $this->success('上传成功',url('home/Listn/ts_insert_logo#nm',array('apply_id'=>$apply_id,'snd'=>rand(10000,99999)))); } /** * 保存选择号码操作 */ public function apply_runbasecode(){ $apply_id=input('apply_id'); $user_id=session('admin_auth.aid'); //权限检查 if ((check_cult4UserRight($apply_id, $user_id, 27) == 0) && (check_cult4UserRight($apply_id, $user_id, 14) == 0) && (check_cult4UserRight($apply_id, $user_id, 29) == 0)) { $this->error('无权限',url('home/Listn/applyts',array('apply_id'=>$apply_id,'snd'=>rand(10000,99999)))); } $codename=input('codename'); if(empty($codename)){ $this->error('请输入挂牌名称!',url('home/Listn_insert_hm#nm',array('apply_id'=>$apply_id,'snd'=>rand(10000,99999)))); } if(checkHTMLTag($codename)){ $this->error('企业名称含有非法字符!'); } if(checkHTMLTag(input('shortname'))){ $this->error('企业简称含有非法字符!'); } $codetype =input('codetype'); $status=$codetype==0?18:48;//特殊号码缴费通知 Db::startTrans(); try{ $data = ['pay_img' => ""]; $where = ['apply_id' => $apply_id]; Db::name('cult4apply')->where($where)->update($data); //cult4baseinfo修改记录 $data = [ 'shortname' => input('shortname'), 'codetype' => input('codetype'), 'code_id' => input('saleno',0), 'codename'=>$codename, ]; if(input('codetype')==0){ $data['code_id']=''; } $where = [ 'apply_id' => $apply_id, 'new_flag' => 1, ]; Db::name('cult4baseinfo')->where($where)->update($data); //修改主表 $data = [ 'update_time' => time(), 'update_user_id' => session('hid'), 'update_user_type' => 1, 'seq' => 0, //'status' => $status ]; $where2 = [ 'apply_id' => $apply_id, ]; Db::name('cult4apply')->where($where2)->update($data); if(input('codetype')==1){ $sl_data = ['salestatus' => 1]; $where3 = ['id' => input('saleno',0)]; Db::name('cult4number')->where($where3)->update($sl_data); } $saleno=Db::name('cult4number')->where('id',input('saleno',0))->value('saleno');//挂牌号码 $price=Db::name('cult4number')->where('id',input('saleno',0))->value('price');//挂牌价格 if($status==48){ //取得基础数据 $apply=Db::name('cult4apply')->find($apply_id); $baseinfo=Db::name('cult4baseinfo')->find(input('base_id')); /** * 增加通知推送,by rainfer */ if($baseinfo['apply_type']==1){ $baseinfo_name=$baseinfo['c_name']; }elseif ($baseinfo['apply_type']==2){ $baseinfo_name=$baseinfo['p_name']; }else{ $baseinfo_name=$baseinfo['t_apply_username']; } //风控审核通过则发送挂牌上市缴费通知 $username=get_cult4UserName($apply['user_id'],1); $notice_title = '【' . $baseinfo_name . '】特殊号码缴费通知书!'; $contents=Options::get_options('number_options','zh-cn'); $contents['content_tpl']=isset($contents['content_tpl'])?$contents['content_tpl']:''; $notice=$contents['content_tpl']; $notice=str_replace('#COMNAME#',$username,$notice); $notice=str_replace('#CODE#',$saleno,$notice); $notice=str_replace('#PRICE#',$price,$notice); $notice=str_replace('#DATE#',date('Y年m月d日', time()),$notice); $sl_data=[ 'notice_title'=>$notice_title, 'notice'=>$notice, 'apply_id'=>$apply_id, 'user_id'=>$apply['user_id'], 'create_id'=>session('hid'), 'create_type'=>1, 'create_time'=>time() ]; Db::name('cult4notice')->insert($sl_data); } // 提交事务 Db::commit(); } catch (\Exception $e) { // 回滚事务 Db::rollback(); $this->error('更新失败',url('home/Listn/applyts#nm',array('apply_id'=>$apply_id,'snd'=>rand(10000,99999))));//home/Listn/applyts } $this->success('更新成功',url('/home/center/notice')); } /** * 跳转特殊号码选择 * @return string */ public function applyts(){ $lists=Db::name('video')->where(['vd_status'=>1,'vd_cid'=>3])->order('vd_order,vd_time desc')->select(); $rst=[]; foreach ($lists as $list){ $rst[]=['title'=>$list['vd_name'],'artist'=>'www.szcaee.cn','mp3'=>$list['vd_video'],'poster'=>get_imgurl($list['vd_img'])]; } $a=input('logo_id'); $this->assign('lists',json_encode($rst)); $apply_id=input('apply_id'); $this->assign('apply_id',$apply_id); $where=array('status' => 1); $this->assign('logo_id',input('logo_id')); $salenolist = Db::name('cult4number')->where($where)->select(); $this->assign('salenolist',$salenolist); $baseinfo = Db::name('cult4baseinfo')->where('apply_id',$apply_id)->order('addorder desc') ->find (); $this->assign('baseinfo',$baseinfo); $status=Db::name('cult4apply')->where('apply_id',$apply_id)->value('status');//判断当前状态情况 $this->assign('status',$status); $cult4apply=Db::name('cult4apply')->where('apply_id',$apply_id) ->find (); $this->assign('cult4apply',$cult4apply); return $this->view->fetch(':applyts'); } /** * 上传特殊号码缴费凭证 * @return string */ public function tsjf(){ $apply_id=input('apply_id'); $user_id=session('admin_auth.aid'); $codetype=input('codetype'); $file = request()->file('filelogo'); if(!empty($file)) { $validate = config('upload_validate'); unset($validate['ext']);//不限制后缀 //单图 $info = $file->validate($validate)->rule('uniqid')->move(ROOT_PATH . $this->upload_path . DS . date('Y-m-d')); if ($info) { $file_url = $this->upload_path . '/' . date('Y-m-d') . '/' . $info->getFilename(); } }else { $this->error('缴费证明上传失败',url('home/Listn/tsjfzm#nm',array('apply_id'=>$apply_id,'snd'=>rand(10000,99999)))); } $data = ['pay_img' => $file_url]; $where = ['apply_id' => $apply_id]; Db::name('cult4apply')->where($where)->update($data); //修改主表 $data2 = [ 'update_time' => time(), 'update_user_id' => session('hid'), 'update_user_type' => 1, 'seq' => 0 ]; $where2 = ['apply_id' => $apply_id]; Db::name('cult4apply')->where($where2)->update($data2); return $this->success('上传成功',url('/home/Center/my',array('apply_id'=>$apply_id,'snd'=>rand(10000,99999)))); } /** * 跳转上传缴费凭证页面 * @return string */ public function jfimg(){ $apply_id=input('apply_id'); $cult4apply= Db::name('cult4apply')->where('apply_id',$apply_id)->find(); $this->assign('cult4apply',$cult4apply); $this->assign('apply_id',$apply_id); return $this->view->fetch(':applyjf'); } /** * 上传缴费凭证 * @return string */ public function jf(){ $apply_id=input('apply_id'); $user_id=session('admin_auth.aid'); $file = request()->file('filelogo'); if(!empty($file)) { if($file->getInfo('size')>(20*1024*1024)){ $this->error('上传文件不能大于20M!'); } if(!in_array(strtoupper(substr(strrchr($file->getInfo('name'), '.'), 1)),['PNG','JPG','GIF'])){ $this->error('上传文件类型错误!'); } $validate = config('upload_validate'); unset($validate['ext']);//不限制后缀 //单图 $info = $file->validate($validate)->rule('uniqid')->move(ROOT_PATH . $this->upload_path . DS . date('Y-m-d')); if ($info) { $file_url = $this->upload_path . '/' . date('Y-m-d') . '/' . $info->getFilename(); } }else { $this->error('缴费证明上传失败',url('home/listn/jfimg',array('apply_id'=>$apply_id,'snd'=>rand(10000,99999)))); } $data = [ 'c_proof_of_payment_url' => $file_url, 'status'=>9 ]; $where = [ 'apply_id' => $apply_id, ]; Db::name('cult4apply')->where($where)->update($data); $this->success('上传成功',url('/home/Center/my',array('apply_id'=>$apply_id,'snd'=>rand(10000,99999)))); } public function tsjfimg(){ $apply_id=input('apply_id'); $user_id=session('admin_auth.aid'); $file = request()->file('filelogo'); if(!empty($file)) { if($file->getInfo('size')>(20*1024*1024)){ $this->error('上传文件不能大于20M!'); } if(!in_array(strtoupper(substr(strrchr($file->getInfo('name'), '.'), 1)),['PNG','JPG','GIF'])){ $this->error('上传文件类型错误!'); } $validate = config('upload_validate'); unset($validate['ext']);//不限制后缀 //单图 $info = $file->validate($validate)->rule('uniqid')->move(ROOT_PATH . $this->upload_path . DS . date('Y-m-d')); if ($info) { $file_url = $this->upload_path . '/' . date('Y-m-d') . '/' . $info->getFilename(); } }else { $this->error('Logo上传失败',url('home/center/my#nm',array('apply_id'=>$apply_id,'snd'=>rand(10000,99999)))); } $data = [ 'logo' => $file_url, ]; $where = [ 'apply_id' => $apply_id, ]; Db::name('cult4baseinfo')->where($where)->update($data); $this->success('Logo上传成功',url('home/Listn/applyts',array('apply_id'=>$apply_id,'snd'=>rand(10000,99999)))); } /** * 检查是否允许托管 * @return string */ public function tg_check() { if(!session('hid')) return json(['code'=>0,'msg'=>'未登录','url'=>url('home/Login/index')]); return json(['code'=>1]); $role_id=Db::name('member_list')->where('member_list_id',session('hid'))->value('member_list_groupid'); if(!in_array($role_id,[1,5])) return json(['code'=>0,'msg'=>'您无权托管!','url'=>url('home/Center/my')]); //判断是否激活 if(!$this->user['user_status']){ $current_user=$this->user; $email = $current_user['member_list_email']; $this->assign("email",$email); return json(['code'=>0,'msg'=>'请先激活您的账号!','url'=>url('home/Login/index')]); } //判断当前状态 $where['user_id']=session('hid'); $rst=Db::name('capitalapply')->where(['user_id'=>session('hid')])->where('apply_status',0)->find(); if($rst){ //已有待处理托管,转到我的托管 return json(['code'=>0,'msg'=>'已有待处理托管','url'=>url('home/Center/mytg')]); }else{ //可以托管 return json(['code'=>1]); } } /** * 托管申请 * @return string */ public function tg_add() { if(!session('hid')) return json(['code'=>0,'msg'=>'未登录','url'=>url('home/Login/index')]); $tg_type=input('tg_type',1,'intval'); //为了兼容IE8,改为isPost if(request()->isPost()){ $post=input('post.'); $rule = [ ['tg_type','require','挂牌类型不能为空!'], ['tg_org','max:50','推荐机构不能超过50字符!'], ['tg_apply_org','require|max:50','企业名称不能为空!|企业名称不能超过50字符'] ]; $validate = new Validate($rule); $rst= $validate->check(array( 'tg_type'=>$post['tg_type'], 'tg_org'=>$post['tg_org'], 'tg_apply_org'=>$post['tg_apply_org'] )); if(true !==$rst){ $error=is_array($validate->getError())?join('|',$validate->getError()):$validate->getError(); //$this->error($error); return json(['code'=>0,'msg'=>$error]); } if(checkHTMLTag($post['tg_org'])){ return json(['code'=>0,'msg'=>'推荐机构含有非法字符']); } if(checkHTMLTag($post['tg_apply_org'])){ return json(['code'=>0,'msg'=>'企业名称含有非法字符']); } //防止重复提交 if (!checkToken(input('TOKEN'))) { return json(['code'=>0,'msg'=>'请勿重复提交!']); } Db::transaction(function() use($post){ //插入主表 $data=[ 'tg_uid'=>session('hid'), 'tg_status'=>12, 'tg_type'=>input('tg_type',1,'intval'), 'tg_org'=>input('tg_org'), 'tg_apply_org'=>input('tg_apply_org'), 'tg_time'=>time(), ]; if(input('tg_type',1,'intval')==1){//企业股权 $count=Db::name('cult4apply')->where(['user_id'=>session('hid')])->where('status','eq',31)->count(); $data['tg_isgp']=$count>0?1:2; } $apply_id=Db::name('trusteeship_apply')->insertGetId($data); //上传附件 $files = request()->file(''); if ($files) { foreach ($files as $key=>$file) { if($file->getInfo('size')>(20*1024*1024)){ session('TOKEN', input('TOKEN')); $this->error('上传文件不能大于20M!'); } if(!in_array(strtoupper(substr(strrchr($file->getInfo('name'), '.'), 1)),['PDF','JPG','DOC','DOCX'])){ session('TOKEN', input('TOKEN')); $this->error('上传文件类型错误!'); } //处理file_one2,得到ftype_id $ftype_id=intval(substr($key,8)); if(!check_upfiletype('trusteeship_uptype',$ftype_id,substr(strrchr($file->getInfo('name'), '.'), 1))){ session('TOKEN', input('TOKEN')); $this->error('上传文件类型错误!'); } $info = $file->rule('md5')->move(ROOT_PATH . $this->upload_path . DS . date('Y-m-d')); if ($info) { $img_url = $this->upload_path. '/' . date('Y-m-d') . '/' . $info->getFilename(); //写入数据表cult4upfiles $data=[ 'apply_id'=>$apply_id, 'user_id'=>session('hid'), 'user_type'=>1, 'status'=>0, 'upload_time'=>time(), 'ftype_id'=>$ftype_id, 'ftype'=>1, 'filesize'=>$info->getSize(), 'path'=>$img_url, 'flag'=>0 ]; Db::name('trusteeship_upfiles')->insertGetId($data); } else { //$this->error($file->getError()); return json(['code'=>0,'msg'=>$file->getError()]); } } } }); return json(['code'=>1,'msg'=>'托管提交成功!','url'=>url('home/Center/mytg')]); }else{ creatToken(); //判断当前状态 $where['user_id']=session('hid'); $rst=Db::name('trusteeship_apply')->where(['tg_uid'=>session('hid')])->where('tg_status','gt',0)->where('tg_status','neq',11)->find(); if($rst){ //已有待处理托管,转到我的托管 $this->redirect('home/Center/mytg'); }else{ //创建token //推荐会员 $member_recmds=Db::name('member_list')->where(['member_list_id'=>['neq',session('hid')],'member_list_groupid'=>4,'member_list_open'=>1,'user_status'=>1])->select(); $this->assign('member_recmds', $member_recmds); //挂牌需要上传的附件 $where=array(); $where['apply_id']=0; $where['status']=0; $where['isopen']=1; $where['apply_type']=array('in','0,'.$tg_type); if(input('tg_type',1,'intval')==1){//企业股权 $count=Db::name('cult4apply')->where(['user_id'=>session('hid')])->where('status','eq',31)->count(); $where['isgp']=$count>0?array('in','0,1'):array('in','0,2'); } $files=Db::name('trusteeship_uptype')->where($where)->select(); if($tg_type==1){//企业股权 $count=Db::name('cult4apply')->where(['user_id'=>session('hid')])->where('status','eq',31)->count(); if($count>0){ $this->assign('isgp', 1); } } $this->assign('files', $files); $this->assign('tg_type', $tg_type); return $this->view->fetch(':tg_add'); } } } /** 重新上传托管文件 * @param int $apply_id * @param bool $arr * @return array */ public function tg_upcheck($tg_id=0,$arr=false){ $uid=session('hid'); if(!$uid) return $arr?['code'=>0,'msg'=>'未登录','url'=>url('home/Login/index')]:json(['code'=>0,'msg'=>'未登录','url'=>url('home/Login/index')]); $tg_id=$tg_id?:input('apply_id',0,'intval'); if(!$tg_id) return $arr?['code'=>0,'msg'=>'参数错误','url'=>url('home/Center/notice')]:json(['code'=>0,'msg'=>'参数错误','url'=>url('home/Center/notice')]); //原数据 $apply=Db::name('trusteeship_apply')->alias('a') ->where(['a.tg_id'=>$tg_id,'tg_status'=>['in',[3,7,8,9,10,13]]]) ->order('tg_time desc') ->find(); if(!$apply) return $arr?['code'=>0,'msg'=>'该托管资料不在需补充材料状态中','url'=>url('home/Center/notice')]:json(['code'=>0,'msg'=>'该挂牌资料不在需补充材料状态中','url'=>url('home/Center/notice')]); //取得是否有需要上传的资料 if($apply['tg_status']==3 ||$apply['tg_status']==9){//上传缴费凭证 $files = Db::name('trusteeship_uptype')->where(['status'=>3,'isopen'=>1])->select(); }else{//修改上传文件 $where=array(); $where['apply_id']=0; $where['status']=0; $where['isopen']=1; $where['apply_type']=$apply['tg_type']; $sql = 'SELECT * FROM wjs_trusteeship_uptype where ftype_id in(select ftype_id from wjs_trusteeship_upfiles where apply_id=? and flag=0 and new_flag=1) and isopen=1'; $sql = $sql.' and apply_type in(?,0)'; $files=Db::query($sql,[$apply['tg_id'],$apply['tg_type']]); } if($files){ return $arr?['code'=>1,'files'=>$files,'msg'=>'可以上传','url'=>url('home/Listn/tg_upedit',['tg_id'=>$apply['tg_id']])]:json(['code'=>1,'files'=>$files,'msg'=>'可以上传','url'=>url('home/Listn/tg_upedit',['tg_id'=>$apply['tg_id']])]); }else{ return $arr?['code'=>0,'msg'=>'该托管申请已经上传材料或您无权限上传','url'=>url('home/Center/notice')]:json(['code'=>0,'msg'=>'该托管申请已经上传材料或您无权限上传','url'=>url('home/Center/notice')]); } } /** * 托管修改 * @return string */ public function tg_upedit(){ $uid=session('hid'); if(!$uid) $this->redirect(url('home/Login/index')); $tg_id=input('tg_id',0,'intval'); if(!$tg_id) $this->json(['code'=>0,'msg'=>'参数错误']); $rst=$this->tg_upcheck($tg_id,true); if($rst['code']==0){ $this->error($rst['msg'],$rst['url']); } //原数据 $apply=Db::name('trusteeship_apply')->where('tg_id',$tg_id)->find(); //5.29修改,为兼容IE8,修改为isPost if(request()->isPost()){ //提交 $files_uptype=$rst['files']; Db::startTrans(); try{ //上传附件 //5.29修改 $files = request()->file(''); if ($files) { foreach ($files as $key=>$file) { if($file->getInfo('size')>(20*1024*1024)){ session('TOKEN', input('TOKEN')); Db::rollback(); return json(['code'=>0,'msg'=>'上传文件不能大于20M!']); } if(!in_array(strtoupper(substr(strrchr($file->getInfo('name'), '.'), 1)),['PDF','JPG','DOC','DOCX'])){ session('TOKEN', input('TOKEN')); Db::rollback(); return json(['code'=>0,'msg'=>'上传文件类型错误!']); } //处理file_one2,得到ftype_id $ftype_id=intval(substr($key,8)); if(!check_upfiletype('trusteeship_uptype',$ftype_id,substr(strrchr($file->getInfo('name'), '.'), 1))){ session('TOKEN', input('TOKEN')); $this->error('上传文件类型错误!'); } $info = $file->rule('md5')->move(ROOT_PATH . $this->upload_path . DS . date('Y-m-d')); if ($info) { $img_url = $this->upload_path. '/' . date('Y-m-d') . '/' . $info->getFilename(); //写入数据表cult4upfiles $data=[ 'apply_id'=>$tg_id, 'user_id'=>session('hid'), 'user_type'=>1, 'status'=>$files_uptype[0]['status'], 'upload_time'=>time(), 'ftype_id'=>$ftype_id, 'ftype'=>($files_uptype[0]['ftype']==0)?1:2, 'filesize'=>$info->getSize(), 'path'=>$img_url, 'flag'=>0 ]; if($files_uptype[0]['status']==3){ $data['flag']=1; } Db::name('trusteeship_upfiles')->where(['apply_id'=>$tg_id,'ftype_id'=>$ftype_id,'status'=>$files_uptype[0]['status'],'flag'=>'0'])->update(['new_flag'=>0]); Db::name('trusteeship_upfiles')->insertGetId($data); } } } $tgstatus=$apply['tg_status']; $statuslist=[7=>1,8=>2,9=>4,3=>4,10=>6,13=>12]; if(isset($statuslist[$tgstatus])){ $status=$statuslist[$tgstatus]; }else{ $this->error('状态错误'); } //修改主表 $data=[ 'apply_admin_id'=>0, 'update_time'=>time(), 'update_user_id'=>session('hid'), 'update_user_type'=>1, 'tg_status'=>$status ]; Db::name('trusteeship_apply')->where('tg_id',$apply['tg_id'])->update($data); // 提交事务 Db::commit(); } catch (\Exception $e) { // 回滚事务 Db::rollback(); //$this->error('提交失败'); return json(['code'=>0,'msg'=>'提交失败']); } //$this->success('提交成功',url('home/Center/my')); return json(['code'=>1,'msg'=>'提交成功','url'=>url('home/Center/mytg')]); }else{ //只显示当前有权限的未上传的 $files=$rst['files']; $this->assign('files',$files); $this->assign('apply',$apply); return $this->view->fetch(':tg_upedit'); } } /** * 校验是否可以合作机构申请 * @return string */ public function org_check(){ if(!session('hid')) return json(['code'=>0,'msg'=>'未登录','url'=>url('home/Login/index')]); $role_id=Db::name('member_list')->where('member_list_id',session('hid'))->value('member_list_groupid'); if($role_id !=1) return json(['code'=>0,'msg'=>'您无权申请!','url'=>url('home/Center/my')]); //判断是否激活 if(!$this->user['user_status']){ $current_user=$this->user; $email = $current_user['member_list_email']; $this->assign("email",$email); return json(['code'=>0,'msg'=>'请先激活您的账号!','url'=>url('home/Login/index')]); } //判断当前状态 $rst=Db::name('org_apply')->where(['uid'=>session('hid')])->where('status','gt',0)->where('status','neq',10)->find(); if($rst){ //已有待处理托管,转到我的托管 return json(['code'=>0,'msg'=>'已有待处理托管','url'=>url('home/Center/myorg')]); }else{ //可以托管 return json(['code'=>1]); } } /** * 合作机构申请 * @return string */ public function org_add() { if(!session('hid')) return json(['code'=>0,'msg'=>'未登录','url'=>url('home/Login/index')]); $org_name=input('org_name'); $org_type=input('org_type'); //为了兼容IE8,改为isPost if(request()->isPost()){ $post=input('post.'); $rule = [ ['comname','require|max:50','公司名称不能为空!|公司名称不能超过50字符!'] ]; $validate = new Validate($rule); $rst= $validate->check(array( 'comname'=>$post['comname'] )); if(true !==$rst){ $error=is_array($validate->getError())?join('|',$validate->getError()):$validate->getError(); //$this->error($error); return json_encode(['code'=>0,'msg'=>$error,'url'=>'']); } if(checkHTMLTag($post['comname'])){ return json_encode(['code'=>0,'msg'=>'公司名称含有非法字符','url'=>'']); } //防止重复提交 if (!checkToken(input('TOKEN'))) { return json_encode(['code'=>0,'msg'=>'请勿重复提交!']); } Db::transaction(function() use($post){ //插入主表 $data=[ 'org_name'=>input('org_name'), 'org_type'=>input('org_type'), 'comname'=>input('comname'), 'uid'=>session('hid'), 'status'=>1, 'create_time'=>time(), ]; Db::name('org_apply')->insert($data); }); return json_encode(['code'=>1,'msg'=>'提交成功!','url'=>url('home/Center/myorg')]); }else{ creatToken(); //判断当前状态 $where['user_id']=session('hid'); $rst=Db::name('org_apply')->where(['uid'=>session('hid')])->where('status','gt',0)->where('status','neq',10)->find(); if($rst){ //已有待处理托管,转到我的合作机构 $this->redirect('home/Center/myorg'); }else{ $this->assign('org_type', $org_type); $this->assign('org_name', $org_name); return $this->view->fetch(':org_add'); } } } /** * 检查合作机构上传文件 * @return string */ public function org_upcheck($id=0,$arr=false) { $uid=session('hid'); if(!$uid) return $arr?['code'=>0,'msg'=>'未登录','url'=>url('home/Login/index')]:json(['code'=>0,'msg'=>'未登录','url'=>url('home/Login/index')]); $id=$id?:input('apply_id',0,'intval'); if(!$id) return $arr?['code'=>0,'msg'=>'参数错误','url'=>url('home/Center/notice')]:json(['code'=>0,'msg'=>'参数错误','url'=>url('home/Center/notice')]); //原数据 $apply=Db::name('org_apply')->alias('a') ->where(['a.id'=>$id,'status'=>['in',[2,4,8,9,11,12,13,14]]]) ->order('create_time desc') ->find(); if(!$apply) return $arr?['code'=>0,'msg'=>'该合作机构申请资料不在需补充材料状态中','url'=>url('home/Center/notice')]:json(['code'=>0,'msg'=>'该挂牌资料不在需补充材料状态中','url'=>url('home/Center/notice')]); if($apply['status']==8){ return $arr?['code'=>1,'msg'=>'可以上传','url'=>url('home/Listn/org_info',['id'=>$apply['id']])]:json(['code'=>1,'msg'=>'可以上传','url'=>url('home/Listn/org_info',['id'=>$apply['id']])]); } //取得是否有需要上传的资料 if($apply['status']==2 ||$apply['status']==11){//上传缴费凭证 $files = Db::name('org_uptype')->where(['status'=>2,'isopen'=>1])->select(); }elseif($apply['status']==4){//上传申请资料 $files = Db::query('select * from wjs_org_uptype where status=4 and isopen=1 and apply_type in(?,0)',[$apply['org_name']]); }else{//修改上传文件 $sql = 'SELECT * FROM wjs_org_uptype where ftype_id in(select ftype_id from wjs_org_upfiles where apply_id=? and flag=0 and new_flag=1) and isopen=1'; $sql = $sql.' and apply_type in(?,0)'; $files=Db::query($sql,[$apply['id'],$apply['org_name']]); } if($files){ return $arr?['code'=>1,'files'=>$files,'msg'=>'可以上传','url'=>url('home/Listn/org_upedit',['id'=>$apply['id']])]:json(['code'=>1,'files'=>$files,'msg'=>'可以上传','url'=>url('home/Listn/org_upedit',['id'=>$apply['id']])]); }else{ return $arr?['code'=>0,'msg'=>'该申请已经上传材料或您无权限上传','url'=>url('home/Center/myorg')]:json(['code'=>0,'msg'=>'该申请已经上传材料或您无权限上传','url'=>url('home/Center/myorg')]); } } /** * 合作机构修改 * @return string */ public function org_upedit(){ $uid=session('hid'); if(!$uid) return json(['code'=>0,'msg'=>'未登录','url'=>url('home/Login/index')]); $id=input('id',0,'intval'); if(!$id) $this->error('参数错误'); $rst=$this->org_upcheck($id,true); if($rst['code']==0){ $this->error($rst['msg'],$rst['url']); } //原数据 $apply=Db::name('org_apply')->where('id',$id)->find(); if(request()->isPost()){ //提交 $files_uptype=$rst['files']; Db::startTrans(); try{ //上传附件 //5.29修改 $files = request()->file(''); if ($files) { foreach ($files as $key=>$file) { if($file->getInfo('size')>(20*1024*1024)){ session('TOKEN', input('TOKEN')); Db::rollback(); return json(['code'=>0,'msg'=>'上传文件不能大于20M!']); } if(!in_array(strtoupper(substr(strrchr($file->getInfo('name'), '.'), 1)),['PDF','JPG','DOC','DOCX'])){ session('TOKEN', input('TOKEN')); Db::rollback(); return json(['code'=>0,'msg'=>'上传文件类型错误!']); } //处理file_one2,得到ftype_id $ftype_id=intval(substr($key,8)); if(!check_upfiletype('org_uptype',$ftype_id,substr(strrchr($file->getInfo('name'), '.'), 1))){ session('TOKEN', input('TOKEN')); $this->error('上传文件类型错误!'); } //处理file_one2,得到ftype_id $ftype_id=intval(substr($key,8)); $info = $file->rule('md5')->move(ROOT_PATH . $this->upload_path . DS . date('Y-m-d')); if ($info) { $img_url = $this->upload_path. '/' . date('Y-m-d') . '/' . $info->getFilename(); //写入数据表cult4upfiles $data=[ 'apply_id'=>$id, 'user_id'=>session('hid'), 'user_type'=>1, 'status'=>$files_uptype[0]['status'], 'upload_time'=>time(), 'ftype_id'=>$ftype_id, 'ftype'=>1, 'filesize'=>$info->getSize(), 'path'=>$img_url, 'flag'=>0 ]; if($files_uptype[0]['status']==2){ $data['flag']=1; } Db::name('org_upfiles')->where(['apply_id'=>$id,'ftype_id'=>$ftype_id,'status'=>$files_uptype[0]['status'],'flag'=>'0'])->update(['new_flag'=>0]); Db::name('org_upfiles')->insertGetId($data); } } } $tgstatus=$apply['status']; $statuslist=[12=>5,11=>3,2=>3,13=>6,14=>7,4=>5]; if(isset($statuslist[$tgstatus])){ $status=$statuslist[$tgstatus]; } //修改主表 $data=[ 'apply_admin_id'=>0, 'update_time'=>time(), 'update_user_id'=>session('hid'), 'update_user_type'=>1, 'status'=>$status ]; if(!empty(input("org_type"))){ $data['org_type']=input("org_type"); } if(!empty(input("org_name"))){ $data['org_name']=input("org_name"); } Db::name('org_apply')->where('id',$apply['id'])->update($data); // 提交事务 Db::commit(); } catch (\Exception $e) { // 回滚事务 Db::rollback(); return json(['code'=>0,'msg'=>'提交失败']); } return json(['code'=>1,'msg'=>'提交成功','url'=>url('home/Center/myorg')]); }else{ // 只显示当前有权限的未上传的 $files=$rst['files']; $this->assign('files',$files); $this->assign('apply',$apply); return $this->view->fetch(':org_upedit'); } } //上传企业信息 public function org_info(){ $uid=session('hid'); if(!$uid) $this->redirect(url('home/Login/index')); $id=input('id',0,'intval'); if(!$id) $this->error('参数错误'); //原数据 $apply=Db::name('org_apply')->where('id',$id)->find(); if($apply['status']!=8){ $this->error('状态错误!'); } if(request()->isPost()){ $rule = [ ['enterprise_name','require|max:90','企业名称不能为空!|企业名称不能超过30字符!'], ['enterprise_desc','require|max:3000','企业简介不能为空!|企业简介不能超过1000字符!'], ['enterprise_address','require|max:600','企业地址不能为空!|企业地址不能超过200字符!'], ['legal_person','require|max:90','企业承办人不能为空!|企业承办人不能超过30字符!'], ['contact','require|max:11','联系方式不能为空!|联系方式不能超过11字符!'], ]; $validate = new Validate($rule); $rst= $validate->check(array( 'enterprise_name'=>input('enterprise_name'), 'enterprise_desc'=>input('enterprise_desc'), 'enterprise_address'=>input('enterprise_address'), 'legal_person'=>input('legal_person'), 'contact'=>input('contact') )); if(true !==$rst){ $error=is_array($validate->getError())?join('|',$validate->getError()):$validate->getError(); return json(['code'=>0,'msg'=>$error]); } $data=[ 'enterprise_name'=>input('enterprise_name'), 'enterprise_desc'=>input('enterprise_desc'), 'enterprise_address'=>input('enterprise_address'), 'legal_person'=>input('legal_person'), 'contact'=>input('contact'), 'status'=>9 ]; $files = request()->file(''); if(!empty($files['enterprise_logo']) && !empty($files['person_pic'])){ if($files['enterprise_logo']->getInfo('size')>(20*1024*1024)){ return json(['code'=>0,'msg'=>'上传文件不能大于20M!']); } if(!in_array(strtoupper(substr(strrchr($files['enterprise_logo']->getInfo('name'), '.'), 1)),['JPG','PNG'])){ return json(['code'=>0,'msg'=>'上传文件类型错误!']); } if($files['person_pic']->getInfo('size')>(20*1024*1024)){ return json(['code'=>0,'msg'=>'上传文件不能大于20M!']); } if(!in_array(strtoupper(substr(strrchr($files['person_pic']->getInfo('name'), '.'), 1)),['JPG','PNG'])){ return json(['code'=>0,'msg'=>'上传文件类型错误!']); } $validate = config('upload_validate'); $info = $files['enterprise_logo']->validate($validate)->rule('md5')->move(ROOT_PATH . $this->upload_path . DS . date('Y-m-d')); if ($info) { $data['enterprise_logo']=$this->upload_path . '/' . date('Y-m-d') . '/' . $info->getFilename(); } $info2 = $files['person_pic']->validate($validate)->rule('md5')->move(ROOT_PATH . $this->upload_path . DS . date('Y-m-d')); if ($info2) { $data['person_pic']=$this->upload_path . '/' . date('Y-m-d') . '/' . $info2->getFilename(); } $rst = Db::name('org_apply')->where('id',$apply['id'])->update($data); if($rst){ return json(['code'=>1,'msg'=>'提交成功!','url'=>url('home/Center/myorg')]); }else{ return json(['code'=>0,'msg'=>'提交失败!']); } }else{ return json(['code'=>0,'msg'=>'图片不能为空']); } }else{ creatToken(); $this->assign('apply',$apply); $this->assign('code',1); return $this->view->fetch(':org_info'); } } /** * 获取合作机构同意协议 */ public function get_agree(){ $org_type = input('org_type'); $temp = Db::name('org_temp')->where(['code'=>'orgagree_options','name'=>$org_type])->find(); return json(['code'=>'1','temp'=>$temp['content_tpl']]); } public function verify(){ $cid=input('cid',1,'intval'); if(request()->isAjax()){ $where=['status'=>1]; $idno=input('idno'); $mobile=input('mobile'); $ower=input('ower'); $rule = [ '__checkcode__' =>'require|token:__checkcode__' ]; $message = [ '__checkcode__.require'=>'令牌缺失' ]; if($cid==1){ $rule['idno']='require'; $message['idno']='请输入证书编号'; $where=['idno'=>$idno]; } if($cid==2){ $rule['mobile']='require'; $message['mobile']='请输入手机号'; $where=['mobile'=>$mobile]; } if($cid==3){ $rule['ower']='require'; $message['ower']='请输入权属人'; $where=['ower'=>$ower]; } $validate=new Validate($rule,$message); $result=$validate->check(input()); $error=''; if(!$result)$error=$validate->getError(); $token=request()->token('__checkcode__'); if(!empty($error)){ return $this->error($error,'',['token'=>$token]); } $find=db('artverify')->where($where)->find(); $poster=$name=$idno=''; if($find){ $poster=$find['poster']; $name=$find['name']; $idno=$find['idno']; } return $this->success('查询成功','',['token'=>$token,'poster'=>$poster,'idno'=>$idno,'name'=>$name]); } $childs=[]; $childs[1]=['id'=>1,'cid'=>1,'menu_name'=>'证书查询','menu_enname'=>'','menu_type'=>3,'menu_target'=>'','parentid'=>'','menu_address'=>'/home/listn/verify/cid/1.html','menu_content'=>'']; $childs[2]=['id'=>2,'cid'=>2,'menu_name'=>'手机查询','menu_enname'=>'','menu_type'=>3,'menu_target'=>'','parentid'=>'','menu_address'=>'/home/listn/verify/cid/2.html','menu_content'=>'']; $childs[3]=['id'=>3,'cid'=>3,'menu_name'=>'权属人查询','menu_enname'=>'','menu_type'=>3,'menu_target'=>'','parentid'=>'','menu_address'=>'/home/listn/verify/cid/3.html','menu_content'=>'']; $parent=['menu_name'=>'报告及证书查询','menu_enname'=>'']; $current=['menu_name'=>'','menu_enname'=>'']; if(isset($childs[$cid])){ $current=$childs[$cid]; $childs[$cid]['active']=1; } $this->assign('current',$current); $this->assign('parent',$parent); $this->assign('menu_id',$cid); $this->assign('childs',$childs); $this->assign('showchild',1); return $this->view->fetch(':verify'); } }