// +---------------------------------------------------------------------- namespace app\admin\controller; use think\Db; use think\Request; use app\admin\model\Finance; use think\Image; class Gpgl extends Base{ protected $artbook=[]; public function __construct(){ parent::__construct(); $configs=config('artbook'); $keys=array_keys($configs); $titles=array_column($configs,'title'); $this->artbook=array_combine($keys,$titles); } public function importxls(){ $kind=input('post.kind',4,'intval'); $file = request()->file('xlsfile'); if(empty($kind)){ $this->error("请选择分类"); } if(!count($file)){ $this->error("请上传xls"); } $uploadpath=config('upload_path'); $path=ROOT_PATH . config('upload_path').'/'.'excel'; $info = $file->move($path); $inputFileName=''; if($info){ $inputFileName=$path.'/'.$info->getSaveName(); }else{ $this->error($file->getError()); } include ROOT_PATH.'extend'.DS.'PHPExcel'.DS.'PHPExcel.php'; // 读取excel文件 try { $inputFileType = \PHPExcel_IOFactory::identify($inputFileName); $objReader = \PHPExcel_IOFactory::createReader($inputFileType); $objPHPExcel = $objReader->load($inputFileName); } catch(\Exception $e) { die("加载文件发生错误:".pathinfo($inputFileName,PATHINFO_BASENAME).":".$e->getMessage()); } // 确定要读取的sheet,什么是sheet,看excel的右下角,真的不懂去百度吧 $sheet = $objPHPExcel->getSheet(0); $highestRow = $sheet->getHighestRow(); $highestColumn = $sheet->getHighestColumn(); $cindex=3; if($kind==9)$cindex=4; // 获取一行的数据 for ($index =$cindex; $index <= $highestRow; $index++){ // Read a row of data into an array $rowData = $sheet->rangeToArray('A'. $index .':'. $highestColumn . $index, NULL, TRUE, FALSE); //这里得到的rowData都是一行的数据,得到数据后自行处理,我们这里只打出来看看效果 if(isset($rowData[0])){ switch ($kind){ case 9: $cates=[1=>"书法","国画","油画","水彩","版画","篆刻","陶瓷","紫砂","珠宝","玉器","翡翠","织秀","雕刻","雕塑","金属工艺","漆艺","家具","文房","钱币","杂项","非遗"]; $keys=array_keys($cates); $vals=array_values($cates); $cates=array_combine($vals,$keys); $row=$rowData[0]; if(count($row)){ if($row[1]&&$row[3]){ $data=[]; $data['c_name']=trim($row[1]); $data['c_code']=$row[3]; $cate=trim($row[2]); $data['c_type']=isset($cates[$cate])?$cates[$cate]:''; $size=trim($row[6]); $size=nl2br($size); $size=strip_tags($size); $data['c_size']=$size; $data['c_year']=trim($row[4]); $data['c_material']=trim($row[7]); $data['c_content']=trim($row[8]); $data['c_gptime']=time(); $data['c_time']=time(); $data['c_kind']=$kind; $data['c_infostime']=time(); $data['c_infoetime']=time(); $gptime=trim($row[9],'/'); if($gptime){ $gptime=\PHPExcel_Shared_Date::ExcelToPHP($gptime); $gptime=date("Y-m-d",$gptime); } $evaluation=[[],[],[],[],[],[],[]]; $item=['appraiser'=>'','handman'=>'','witness'=>'','location'=>'','date'=>'','comment'=>'']; $item['date']=$gptime; $item['comment']=urldecode(trim($row[10],'/')); $item=json_encode($item,JSON_UNESCAPED_UNICODE); $item=str_replace('":"','=',$item); $item=str_replace(array('{','}'),array('[',']'),$item); $evaluation[0]=[$item]; $gptime=trim($row[12],'/'); if($gptime){ $gptime=\PHPExcel_Shared_Date::ExcelToPHP($gptime); $gptime=date("Y-m-d",$gptime); } $item=['expert'=>'','date'=>'','comment'=>'']; $item['expert']=urldecode(trim($row[11],'/')); $item['date']=$gptime; $item['comment']=urldecode(trim($row[13],'/')); $item=json_encode($item,JSON_UNESCAPED_UNICODE); $item=str_replace('":"','=',$item); $item=str_replace(array('{','}'),array('[',']'),$item); $evaluation[1]=[$item]; $gptime=trim($row[15],'/'); if($gptime){ $gptime=\PHPExcel_Shared_Date::ExcelToPHP($gptime); $gptime=date("Y-m-d",$gptime); } $item=['appraiser'=>'','date'=>'','comment'=>'']; $item['appraiser']=urldecode(trim($row[14],'/')); $item['date']=$gptime; $item['comment']=urldecode(trim($row[16],'/')); $item=json_encode($item,JSON_UNESCAPED_UNICODE); $item=str_replace('":"','=',$item); $item=str_replace(array('{','}'),array('[',']'),$item); $evaluation[2]=[$item]; $gptime=trim($row[24],'/'); if($gptime){ $gptime=\PHPExcel_Shared_Date::ExcelToPHP($gptime); $gptime=date("Y-m-d",$gptime); } $item=['kind'=>'1','title'=>'','sprice'=>'','gprice'=>'','bprice'=>'','handman'=>'','witness'=>'','date'=>'']; $ikind='1'; if(trim($row[17])=='艺品拍'){ $ikind='2'; } $item['kind']=$ikind; $item['title']=trim($row[18],'/'); $item['sprice']=trim($row[19],'/'); $item['gprice']=trim($row[20],'/'); $item['bprice']=trim($row[21],'/'); $item['handman']=urldecode(trim($row[22],'/')); $item['witness']=urldecode(trim($row[23],'/')); $item['date']=$gptime; $item=json_encode($item,JSON_UNESCAPED_UNICODE); $item=str_replace('":"','=',$item); $item=str_replace(array('{','}'),array('[',']'),$item); $evaluation[3]=[$item]; $gptime=trim($row[28],'/'); if($gptime){ $gptime=\PHPExcel_Shared_Date::ExcelToPHP($gptime); $gptime=date("Y-m-d",$gptime); } $item=['handman'=>'','witness'=>'','source'=>'','date'=>'','comment'=>'']; $item['handman']=urldecode(trim($row[25],'/')); $item['witness']=urldecode(trim($row[26],'/')); $item['source']=urldecode(trim($row[27],'/')); $item['date']=$gptime; $item['comment']=urldecode(trim($row[29],'/')); $item=json_encode($item,JSON_UNESCAPED_UNICODE); $item=str_replace('":"','=',$item); $item=str_replace(array('{','}'),array('[',']'),$item); $evaluation[4]=[$item]; $gptime=trim($row[34],'/'); if($gptime){ $gptime=\PHPExcel_Shared_Date::ExcelToPHP($gptime); $gptime=date("Y-m-d",$gptime); } $item=['code'=>'','title'=>'','size'=>'','witness'=>'','date'=>'','comment'=>'']; $item['code']=trim($row[30],'/'); $item['title']=trim($row[31],'/'); $item['size']=trim($row[32],'/'); $item['witness']=trim($row[33],'/'); $item['date']=$gptime; $item['comment']=urldecode(trim($row[35],'/')); $item=json_encode($item,JSON_UNESCAPED_UNICODE); $item=str_replace('":"','=',$item); $item=str_replace(array('{','}'),array('[',']'),$item); $evaluation[5]=[$item]; $gptime=trim($row[36],'/'); if($gptime){ $gptime=\PHPExcel_Shared_Date::ExcelToPHP($gptime); $gptime=date("Y-m-d",$gptime); } $item=['date'=>'','comment'=>'']; $item['date']=$gptime; $item['comment']=urldecode(trim($row[37],'/')); $item=json_encode($item,JSON_UNESCAPED_UNICODE); $item=str_replace('":"','=',$item); $item=str_replace(array('{','}'),array('[',']'),$item); $evaluation[6]=[$item]; $evaluation=json_encode($evaluation,JSON_UNESCAPED_UNICODE); $data['c_evaluation']=$evaluation; $query=Db::name('finance')->insert($data); } } break; case 4: $cates=['A类'=>1,'B类'=>2,'C类'=>3]; $types=config('finance.parents'); $keys=array_keys($types); $vals=array_values($types); $types=array_combine($vals, $keys); $childs=config('finance.childs'); foreach ($childs as $key=>$child){ $keys=array_keys($child); $vals=array_values($child); $child=array_combine($vals, $keys); $childs[$key]=$child; } $tuoguan=config('tuoguan.parents'); $keys=array_keys($tuoguan); $vals=array_values($tuoguan); $tuoguan=array_combine($vals, $keys); $tchilds=config('tuoguan.childs'); foreach ($tchilds as $key=>$child){ $keys=array_keys($tchilds); $vals=array_values($tchilds); $child=array_combine($vals, $keys); $tchilds[$key]=$child; } $row=$rowData[0]; if(count($row)){ if($row[0]&&$row[1]){ $data=[]; $data['c_name']=$row[1]; $data['c_code']=$row[2]; $cate=trim($row[3]); $data['c_cate']=isset($cates[$cate])?$cates[$cate]:''; $typeid=trim($row[4]); $data['c_type']=isset($types[$typeid])?$types[$typeid]:''; $c_type=$data['c_type']; $cid=trim($row[5]); $data['c_cid']=isset($childs[$c_type][$cid])?$childs[$c_type][$cid]:''; $data['c_price']=$row[6]; $data['c_gprice']=$row[7]; $data['c_num']=$row[8]; $data['c_size']=$row[9]; $data['c_material']=$row[10]; $data['c_class']=$row[11]; $data['c_year']=$row[12]; $gptime=strtotime(str_replace('.','-', $row[15])); $data['c_gptime']=$gptime; $data['c_time']=time(); $data['c_content']=$row[16]; $data['c_evaluation']=$row[17]; $data['c_transaction']=$row[18]; $data['c_logo']=''; $data['c_kind']=$kind; $data['c_infostime']=time(); $data['c_infoetime']=time(); $typeid=trim($row[19]); $data['c_parent']=isset($tuoguan[$typeid])?$tuoguan[$typeid]:''; $c_type=$data['c_parent']; $cid=trim($row[20]); $data['c_child']=isset($tchilds[$c_type][$cid])?$tchilds[$c_type][$cid]:''; $query=Db::name('finance')->insert($data); } } break; } } } $this->success('提交成功',url('gpgl/showlist',['kind'=>$kind])); } /** * 文化四版挂牌列表 */ public function gp_list() { $c_ssbk=input('c_ssbk',0,'intval'); $op='='; $type_id=$c_ssbk; if($c_ssbk & $c_ssbk<=11){ $op='<'; $type_id=12; } //所属板块 $ssbk=Db::name('type')->where('type_type','=',15)->where('type_id',$op,$type_id)->select(); $this->assign('ssbk', $ssbk); //业务类型 $dqlxa=Db::name('type')->where('type_type',52)->select(); $this->assign('dqlxa', $dqlxa); //企业发展阶段 $dqlxb=Db::name('type')->where('type_type',53)->select(); $this->assign('dqlxb', $dqlxb); $where['type_type']=15; if($c_ssbk) $where['c_ssbk']=$c_ssbk; $this->assign('c_ssbk',$c_ssbk); $this->assign('ssbk',$ssbk); $gp_list=Db::name('cult4info')->alias('a')->join(config('database.prefix').'type b','a.c_ssbk=b.type_id')->where($where)->order('c_order,c_time desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]); $show = $gp_list->render(); $this->assign('page',$show); $this->assign('gp_list',$gp_list); if(request()->isAjax()){ return $this->fetch('ajax_gp_list'); }else{ return $this->fetch(); } } /** * 文化四版挂牌状态修改 */ public function gp_state() { $id=input('x'); $status=Db::name('cult4info')->where(array('c_id'=>$id))->value('c_status'); if($status==1){ $statedata = array('c_status'=>0); Db::name('cult4info')->where(array('c_id'=>$id))->setField($statedata); $this->success('状态禁止'); }else{ $statedata = array('c_status'=>1); Db::name('cult4info')->where(array('c_id'=>$id))->setField($statedata); $this->success('状态启用'); } } /** * 文化四版挂牌修改 */ public function gp_edit() { if(!request()->isAjax()) { $c_id = input('c_id', 0, 'intval'); if (!$c_id) $this->error('参数错误', url('admin/Gpgl/gp_list')); $gp_list = Db::name('cult4info')->where('c_id', $c_id)->find(); $this->assign('gp_list', $gp_list); //多图字符串转换成数组 $pic_list = array_filter(explode(",", $gp_list['c_pics'])); $this->assign('pic_list', $pic_list); //行业类别 $hylb=Db::name('type')->where('type_type',1)->select(); $this->assign('hylb', $hylb); //所属板块 $ssbk=Db::name('type')->where('type_type',15)->select(); $this->assign('ssbk', $ssbk); //地区类型 $dqlx=Db::name('type')->where('type_type',2)->select(); $this->assign('dqlx', $dqlx); //业务类型 $dqlxa=Db::name('type')->where('type_type',52)->select(); $this->assign('dqlxa', $dqlxa); //企业发展阶段 $dqlxb=Db::name('type')->where('type_type',53)->select(); $this->assign('dqlxb', $dqlxb); //资本额度 $zbed=Db::name('type')->where('type_type',3)->order('type_order')->select(); $this->assign('zbed', $zbed); return $this->fetch(); }else{ $img_one=''; $picall_url=''; $file = request()->file('pic_one'); $files = request()->file('pic_all'); $validate = config('upload_validate'); //单图 if ($file) { $info = $file[0]->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d')); if ($info) { $img_url = config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename(); //写入数据库 $data['uptime'] = time(); $data['filesize'] = $info->getSize(); $data['path'] = $img_url; Db::name('plug_files')->insert($data); $img_one = $img_url; } else { $this->error($file->getError(), url('admin/Gpgl/gp_list')); } } //多图 if ($files) { foreach ($files as $file) { $info = $file->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d')); if ($info) { $img_url = config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename(); //写入数据库 $data['uptime'] = time(); $data['filesize'] = $info->getSize(); $data['path'] = $img_url; Db::name('plug_files')->insert($data); $picall_url = $img_url . ',' . $picall_url; } else { $this->error($file->getError(), url('admin/Gpgl/gp_list'));//否则就是上传错误,显示错误原因 } } } $ssbk = input('c_ssbk',1,'intval'); $business_type= input('c_business_type',1,'intval'); $qyfzjd = input('c_qyfzjd',1,'intval'); if($ssbk!=1){ $business_type=0; $qyfzjd=0; } $sl_data=array( 'c_id'=>input('c_id'), 'c_project_code'=>input('c_project_code'), 'c_ggxs'=>input('c_ggxs'), 'c_transaction_type'=>input('c_transaction_type'), 'c_bdname'=>input('c_bdname'), 'c_valuation'=>input('c_valuation'), 'c_type'=>input('c_type'), 'c_name'=>input('c_name'), 'c_jcname'=>input('c_jcname',''), 'c_gpprice'=>input('c_gpprice'), 'c_survival_period'=>input('c_survival_period'), 'c_city_consumption'=>input('c_city_consumption'), 'c_industry_prospects'=>input('c_industry_prospects'), 'c_enterprise_valuation'=>input('c_enterprise_valuation'), 'c_market_prospects'=>input('c_market_prospects'), 'c_stock_ratio'=>input('c_stock_ratio'), 'c_investment_degreeofheat'=>input('c_investment_degreeofheat'), 'c_market_occupy_ratio'=>input('c_market_occupy_ratio'), 'c_code'=>input('c_code'), 'c_homepage'=>input('c_homepage',''), 'c_gptime'=>input('c_gptime','')?strtotime(input('c_gptime','')):time(), 'c_cltime'=>input('c_cltime','')?strtotime(input('c_cltime','')):time(), 'c_status'=>input('c_status',0), 'c_content'=>htmlspecialchars_decode(input('c_content')), 'c_order'=>input('c_order',50,'intval'), 'c_ssbk'=>input('c_ssbk',1,'intval'), 'c_dqlx'=>input('c_dqlx',1,'intval'), 'c_hylb'=>input('c_hylb',1,'intval'), 'c_qyfzjd'=>$qyfzjd, 'c_business_type'=>$business_type, 'c_zbed'=>input('c_zbed',1,'intval') ); //图片字段处理 if(!empty($img_one)){ $sl_data['c_logo']=$img_one; } $sl_data['c_pics']=input('pic_oldlist').$picall_url; $rst=Db::name('cult4info')->update($sl_data); if($rst!==false){ $this->success('修改成功',url('admin/Gpgl/gp_list')); }else{ $this->error('修改失败',url('admin/Gpgl/gp_list')); } } } /** * 文化四版挂牌增加 */ public function gp_add() { if(!request()->isAjax()) { //行业类别 $hylb=Db::name('type')->where('type_type',1)->select(); $this->assign('hylb', $hylb); //所属板块 $ssbk=Db::name('type')->where('type_type',15)->select(); $this->assign('ssbk', $ssbk); //地区类型 $dqlx=Db::name('type')->where('type_type',2)->select(); $this->assign('dqlx', $dqlx); //业务类型 $dqlxa=Db::name('type')->where('type_type',52)->select(); $this->assign('dqlxa', $dqlxa); //企业发展阶段 $dqlxb=Db::name('type')->where('type_type',53)->select(); $this->assign('dqlxb', $dqlxb); //资本额度 $zbed=Db::name('type')->where('type_type',3)->order('type_order')->select(); $this->assign('zbed', $zbed); $base_id=input('base_id'); $baseinfo=Db::name('cult4baseinfo')->find($base_id); $this->assign('baseinfo', $baseinfo); $c_gptime =time(); $this->assign('c_gptime', $c_gptime); return $this->fetch(); }else{ $img_one=''; $picall_url=''; $file = request()->file('pic_one'); $files = request()->file('pic_all'); $validate = config('upload_validate'); //单图 if ($file) { $info = $file[0]->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d')); if ($info) { $img_url = config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename(); //写入数据库 $data['uptime'] = time(); $data['filesize'] = $info->getSize(); $data['path'] = $img_url; Db::name('plug_files')->insert($data); $img_one = $img_url; } else { $this->error($file->getError(), url('admin/Gpgl/gp_list')); } } //多图 if ($files) { foreach ($files as $file) { $info = $file->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d')); if ($info) { $img_url = config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename(); //写入数据库 $data['uptime'] = time(); $data['filesize'] = $info->getSize(); $data['path'] = $img_url; Db::name('plug_files')->insert($data); $picall_url = $img_url . ',' . $picall_url; } else { $this->error($file->getError(), url('admin/Gpgl/gp_list'));//否则就是上传错误,显示错误原因 } } } $ssbk = input('c_ssbk',1,'intval'); $business_type= input('c_business_type',1,'intval'); $qyfzjd = input('c_qyfzjd',1,'intval'); if($ssbk!=1){ $business_type=0; $qyfzjd=0; } $sl_data=array( 'c_name'=>input('c_name'), 'c_project_code'=>input('c_project_code'), 'c_ggxs'=>input('c_ggxs'), 'c_transaction_type'=>input('c_transaction_type'), 'c_bdname'=>input('c_bdname'), 'c_valuation'=>input('c_valuation'), 'c_type'=>input('c_type'), 'c_gpprice'=>input('c_gpprice'), 'c_survival_period'=>input('c_survival_period'), 'c_city_consumption'=>input('c_city_consumption'), 'c_industry_prospects'=>input('c_industry_prospects'), 'c_enterprise_valuation'=>input('c_enterprise_valuation'), 'c_market_prospects'=>input('c_market_prospects'), 'c_stock_ratio'=>input('c_stock_ratio'), 'c_investment_degreeofheat'=>input('c_investment_degreeofheat'), 'c_market_occupy_ratio'=>input('c_market_occupy_ratio'), 'c_jcname'=>input('c_jcname',''), 'c_code'=>input('c_code'), 'c_homepage'=>input('c_homepage',''), 'c_gptime'=>input('c_gptime','')?strtotime(input('c_gptime','')):time(), 'c_cltime'=>input('c_cltime','')?strtotime(input('c_cltime','')):time(), 'c_status'=>input('c_status',0), 'c_content'=>htmlspecialchars_decode(input('c_content')), 'c_order'=>input('c_order',50,'intval'), 'c_logo'=>$img_one, 'c_pics'=>$picall_url, 'c_time'=>time(), 'c_uid'=>session('admin_auth.aid'), 'c_ssbk'=>input('c_ssbk',1,'intval'), 'c_dqlx'=>input('c_dqlx',1,'intval'), 'c_hylb'=>input('c_hylb',1,'intval'), 'c_qyfzjd'=>$qyfzjd, 'c_business_type'=>$business_type, 'c_zbed'=>input('c_zbed',1,'intval') ); $rst=Db::name('cult4info')->insert($sl_data); if($rst){ $this->success('增加成功',url('admin/Gpgl/gp_list')); }else{ $this->error('增加失败',url('admin/Gpgl/gp_list')); } } } /** * 文化四版挂牌排序 */ public function gp_order() { if (!request()->isAjax()){ $this->error('提交方式不正确',url('admin/Gpgl/gp_list')); }else{ foreach (input('post.') as $c_id => $c_order){ Db::name('cult4info')->update(['c_id'=>$c_id,'c_order'=>$c_order]); } $this->success('排序更新成功',url('admin/Gpgl/gp_list')); } } /** * 文化四版挂牌删除(单个) */ public function gp_del() { $p=input('p'); $rst=Db::name('cult4info')->delete(input('c_id')); if($rst!==false){ $this->success('删除成功',url('admin/Gpgl/gp_list',array('p' => $p))); }else{ $this -> error("删除失败!",url('admin/Gpgl/gp_list',array('p'=>$p))); } } /** * 文化四版删除挂牌(全选) */ public function gp_alldel() { $p = input('p'); $ids = input('c_id/a'); if(empty($ids)){ $this -> error("请选择待删除的数据",url('admin/Gpgl/gp_list',array('p'=>$p))); } if(is_array($ids)){ $where = 'c_id in('.implode(',',$ids).')'; }else{ $where = 'c_id='.$ids; } $rst=Db::name('cult4info')->where($where)->delete(); if($rst!==false){ $this->success("删除成功",url('admin/Gpgl/gp_list',array('p'=>$p))); }else{ $this -> error("删除失败!",url('admin/Gpgl/gp_list',array('p'=>$p))); } } /** * 文化资产列表 */ public function whzc_list() { $gp_list=Db::name('otinfo')->where('c_type',1)->order('c_order,c_time desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]); $show = $gp_list->render(); $this->assign('page',$show); $this->assign('whzc_list',$gp_list); if(request()->isAjax()){ return $this->fetch('ajax_whzc_list'); }else{ return $this->fetch(); } } /** * 文化四版挂牌状态修改 */ public function whzc_state() { $id=input('x'); $status=Db::name('otinfo')->where(array('c_id'=>$id))->value('c_status'); if($status==1){ $statedata = array('c_status'=>0); Db::name('otinfo')->where(array('c_id'=>$id))->setField($statedata); $this->success('状态禁止'); }else{ $statedata = array('c_status'=>1); Db::name('otinfo')->where(array('c_id'=>$id))->setField($statedata); $this->success('状态启用'); } } public function whzc_edit() { if(!request()->isAjax()) { $c_id = input('c_id', 0, 'intval'); if (!$c_id) $this->error('参数错误', url('admin/Gpgl/whzc_list')); $gp_list = Db::name('otinfo')->where('c_id', $c_id)->find(); $this->assign('whzc_list', $gp_list); $gyxm=Db::name('type')->where('type_type',4)->select(); $this->assign('gyxm', $gyxm); $dfqy=Db::name('type')->where('type_type',5)->select(); $this->assign('dfqy', $dfqy); return $this->fetch(); }else{ $img_one=''; $file = request()->file('pic_one'); $validate = config('upload_validate'); //单图 if ($file) { $info = $file[0]->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d')); if ($info) { $img_url = config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename(); //写入数据库 $data['uptime'] = time(); $data['filesize'] = $info->getSize(); $data['path'] = $img_url; Db::name('plug_files')->insert($data); $img_one = $img_url; } else { $this->error($file->getError(), url('admin/Gpgl/whzc_list')); } } $sl_data=array( 'c_id'=>input('c_id'), 'c_name'=>input('c_name'), 'c_jcname'=>input('c_jcname',''), 'c_code'=>input('c_code'), 'c_location'=>input('c_location',''), 'c_gyxm'=>input('c_gyxm',1,'intval'), 'c_dfqy'=>input('c_dfqy',1,'intval'), 'c_status'=>input('c_status',0), 'c_order'=>input('c_order',50,'intval'), 'c_gptime'=>input('c_gptime','')?strtotime(input('c_gptime','')):time(), 'c_infostime'=>input('c_infostime','')?strtotime(input('c_infostime','')):time(), 'c_infoetime'=>input('c_infoetime','')?strtotime(input('c_infoetime','')):time(), 'c_firstnews'=>input('c_firstnews',''), 'c_desc'=>input('c_desc',''), 'c_content'=>htmlspecialchars_decode(input('c_content')), ); //图片字段处理 if(!empty($img_one)){ $sl_data['c_logo']=$img_one; } $rst=Db::name('otinfo')->update($sl_data); if($rst!==false){ $this->success('修改成功',url('admin/Gpgl/whzc_list')); }else{ $this->error('修改失败',url('admin/Gpgl/whzc_list')); } } } /** * 文化资产挂牌增加 */ public function whzc_add() { if(!request()->isAjax()) { $gyxm=Db::name('type')->where('type_type',4)->select(); $this->assign('gyxm', $gyxm); $dfqy=Db::name('type')->where('type_type',5)->select(); $this->assign('dfqy', $dfqy); return $this->fetch(); }else{ $img_one=''; $file = request()->file('pic_one'); $validate = config('upload_validate'); //单图 if ($file) { $info = $file[0]->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d')); if ($info) { $img_url = config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename(); //写入数据库 $data['uptime'] = time(); $data['filesize'] = $info->getSize(); $data['path'] = $img_url; Db::name('plug_files')->insert($data); $img_one = $img_url; } else { $this->error($file->getError(), url('admin/Gpgl/whzc_list')); } } $sl_data=array( 'c_name'=>input('c_name'), 'c_jcname'=>input('c_jcname',''), 'c_code'=>input('c_code'), 'c_location'=>input('c_location',''), 'c_gyxm'=>input('c_gyxm',1,'intval'), 'c_dfqy'=>input('c_dfqy',1,'intval'), 'c_status'=>input('c_status',0), 'c_order'=>input('c_order',50,'intval'), 'c_gptime'=>input('c_gptime','')?strtotime(input('c_gptime','')):time(), 'c_infostime'=>input('c_infostime','')?strtotime(input('c_infostime','')):time(), 'c_infoetime'=>input('c_infoetime','')?strtotime(input('c_infoetime','')):time(), 'c_firstnews'=>input('c_firstnews',''), 'c_desc'=>input('c_desc',''), 'c_content'=>htmlspecialchars_decode(input('c_content')), 'c_logo'=>$img_one, 'c_time'=>time(), 'c_uid'=>session('admin_auth.aid'), 'c_type'=>1 ); $rst=Db::name('otinfo')->insert($sl_data); if($rst){ $this->success('增加成功',url('admin/Gpgl/whzc_list')); }else{ $this->error('增加失败',url('admin/Gpgl/whzc_list')); } } } /** * 文化资产挂牌排序 */ public function whzc_order() { if (!request()->isAjax()){ $this->error('提交方式不正确',url('admin/Gpgl/whzc_list')); }else{ foreach (input('post.') as $c_id => $c_order){ Db::name('otinfo')->update(['c_id'=>$c_id,'c_order'=>$c_order]); } $this->success('排序更新成功',url('admin/Gpgl/whzc_list')); } } /** * 文化资产挂牌删除(单个) */ public function whzc_del() { $p=input('p'); $rst=Db::name('otinfo')->delete(input('c_id')); if($rst!==false){ $this->success('删除成功',url('admin/Gpgl/whzc_list',array('p' => $p))); }else{ $this -> error("删除失败!",url('admin/Gpgl/whzc_list',array('p'=>$p))); } } /** * 文化资产删除挂牌(全选) */ public function whzc_alldel() { $p = input('p'); $ids = input('c_id/a'); if(empty($ids)){ $this -> error("请选择待删除的数据",url('admin/Gpgl/whzc_list',array('p'=>$p))); } if(is_array($ids)){ $where = 'c_id in('.implode(',',$ids).')'; }else{ $where = 'c_id='.$ids; } $rst=Db::name('otinfo')->where($where)->delete(); if($rst!==false){ $this->success("删除成功",url('admin/Gpgl/whzc_list',array('p'=>$p))); }else{ $this -> error("删除失败!",url('admin/Gpgl/whzc_list',array('p'=>$p))); } } /** * 首页数据展示 * @return mixed|string */ public function showlist(Request $request) { $search_name=input('search_name',''); $this->assign('search_name',$search_name); $kind=$request->param('kind'); $page=$request->param('page'); $this->assign('c_kind',$kind); $db=Db::name('finance')->where('c_kind',$kind); if($search_name){ $db->where('c_name|c_code|c_jcname','like','%'.$search_name.'%'); } $gp_list=$db->order('c_order desc,c_time desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]); $show = $gp_list->render(); $this->assign('page',$page); $this->assign('pageshow',$show); $this->assign('fwhzc_list',$gp_list); $types=config('finance.parents'); $this->assign('types',$types); $parents=config('tuoguan.parents'); $maps=[]; $total=0; foreach ($parents as $key=>$item){ $count=Db::name('finance')->where(['c_parent'=>['like',[$key.',%','%,'.$key.'%',$key],'OR']])->sum('c_num'); $total+=$count; array_push($maps, ['count'=>$count,'title'=>$item]); } $this->assign('showcounts',$maps); $this->assign('total',$total); $cates=[1=>'预披露','正式披露','成交结果公示','艺术资产转让']; if($kind==9){ $cates=$this->artbook; }else if($kind==11){ $cates=[1=>'A类','B类','C类','D类','E类']; } $this->assign('showcates',$cates); if(request()->isAjax()){ return $this->fetch('ajax_show_list'); }else{ return $this->fetch(); } } /** * 非文化资产挂牌删除(单个) */ public function sub_del(){ $p=input('p'); $cid=input('cid'); $rst=Db::name('subscription')->delete(input('id')); if($rst!==false){ $this->success('删除成功',url('admin/Gpgl/subscription',array('cid'=>$cid,'page'=>$p))); }else{ $this -> error("删除失败!",url('admin/Gpgl/subscription',array('cid'=>$cid,'page'=>$p))); } } /** * 导出excel */ public function sub_export(){ error_reporting(E_ALL); ini_set('display_errors', TRUE); ini_set('display_startup_errors', TRUE); date_default_timezone_set('PRC'); $cid=input('cid'); $where=['type'=>$cid]; $kind=input('kind'); if($kind)$where['kind']=$kind; $list=Db::name('subscription')->where($where)->order('id desc')->select(); if(count($list)){ $title="详情咨询管理"; switch ($cid){ case 1: $title="买家预约流程(艺术品)"; break; case 4: $title="竞买人登记"; break; case 5: $title="俱乐部会员申请"; break; } $expTitle=$title."_".date("Y-m-d"); $expCellNames=[]; $expCellNames[1]=[['title','产品名称'],['category','托管类型'],['platform','托管平台'],['parent','托管类别'],['child','托管子类别'],['username','姓名'],['mobile','联系电话'],['email','邮箱'],['created_time','发布时间']]; $expCellNames[3]=[['product','拍品名称'],['username','姓名'],['mobile','联系电话'],['remark','备注'],['created_time','发布时间']]; $expCellNames[4]=[['username','姓名'],['mobile','联系电话'],['num','出席人数'],['created_time','发布时间']]; $expCellNames[5]=[['username','姓名'],['mobile','联系电话'],['creditcard','身份证号码'],['remark','备注'],['created_time','发布时间']]; $expCellName=$expCellNames[$cid]; $expTableData=[]; $parents=config('finance.parents'); $childs=config('finance.childs'); $cates=[1=>'A担保回购式','B撮合回购式','C登记备案式']; foreach ($list as $row){ $row['created_time']=date("Y-m-d H:i:s",$row['created_time']); switch ($cid){ case 3: $find=Db::name('product')->where(array('id'=>$row['productid']))->find(); $product=''; if($find)$product=$find['title']; $row['product']=$product; break; case 1: $title=$category=$child=$parent=''; $row['agree']=$row['agree']==1?'是':'否'; $row['prepay']=$row['prepay']==1?'是':'否'; if(in_array($row['type'],[3])){ $find=Db::name('product')->where(array('id'=>$row['productid']))->find(); if($find)$title=$find['title']; }else{ $find=Db::name('finance')->where(array('c_id'=>$row['productid']))->find(); if($find){ $title=$find['c_name']; $c_type=$find['c_type']; $c_cid=$find['c_cid']; $c_cate=$find['c_cate']; $parent=isset($parents[$c_type])?$parents[$c_type]:''; $child=isset($childs[$c_type][$c_cid])?$childs[$c_type][$c_cid]:''; $category=isset($cates[$c_cate])?$cates[$c_cate]:''; } $row['platform']=$row['kind']==11?'古建资产管理计划':'艺术品资产托管平台'; $row['parent']=$parent; $row['child']=$child; $row['category']=$category; } $row['title']=$title; break; } array_push($expTableData,$row); } exportExcel($expTitle, $expCellName, $expTableData); } } public function showexport(){ error_reporting(E_ALL); ini_set('display_errors', TRUE); ini_set('display_startup_errors', TRUE); date_default_timezone_set('PRC'); $kind=input('kind'); if(in_array($kind,[17])){ $where=['n_status'=>1]; if($kind)$where['n_kind']=$kind; $list=Db::name('news')->where($where)->order('n_id desc')->select(); }else{ $where=['c_status'=>1]; if($kind)$where['c_kind']=$kind; $list=Db::name('finance')->where($where)->order('c_id desc')->select(); } if(count($list)){ $title=""; switch ($kind){ case 2: $title="招拍挂平台"; break; case 1: $title="文化产业策略联盟挂牌平台 "; break; case 4: $title="艺术资产托管平台 "; break; case 17: $title="艺术公馆 "; break; case 9: $title="艺品拍 "; break; case 11: $title="中国古建资产托管交易平台 "; break; } $expTitle=$title."_".date("Y-m-d"); $expCellNames=[]; $expCellNames[1]=[['c_code','挂牌代码'],['c_name','企业名称'],['c_gptime','挂牌有效期']]; $expCellNames[2]=[['c_code','挂牌代码'],['c_name','项目简称'],['c_gptime','挂牌日期'],['c_price','挂牌价格(元)']]; $expCellNames[4]=[['c_code','资产托管代码'],['c_name','托管资产名称'],['c_gptime','托管日期'],['c_price','卖家报价']]; $expCellNames[17]=[['n_id','ID'],['n_title','标题'],['n_time','创建时间']]; $expCellNames[9]=[['c_code','挂牌代码'],['c_name','艺术品名称'],['c_gptime','信息发布日期']]; $expCellNames[11]=[['c_code','资产挂牌代码'],['c_name','挂牌资产名称'],['c_parent','资产类型'],['c_gptime','挂牌起始日期'],['c_price','挂牌方报价']]; $expCellName=isset($expCellNames[$kind])?$expCellNames[$kind]:''; if($expCellName){ $expTableData=[]; $parents=[1=>"构件类","在建类","仿古类","产权类"]; foreach ($list as $row){ if($kind==1||$kind==9){ if(!$row['c_infostime']){ if($row['c_gptime'])$row['c_gptime']=date("Y-m-d",$row['c_gptime']).'/'.date("Y-m-d",strtotime("+1 years",$row['c_gptime'])); }else{ $row['c_gptime']=date("Y-m-d",$row['c_infostime']).'/'.date("Y-m-d",$row['c_infoetime']); } }else{ if(isset($row['c_gptime']))$row['c_gptime']=date("Y-m-d",$row['c_gptime']); } if($kind==11){ $row['c_parent']=isset($parents[$row['c_parent']])?$parents[$row['c_parent']]:''; } if($kind==17){ $row['n_time']=date("Y-m-d",$row['n_time']); } array_push($expTableData,$row); } exportExcel($expTitle, $expCellName, $expTableData); } } } /** * 非文化资产删除挂牌(全选) */ public function sub_alldel() { $p=input('p'); $cid=input('cid'); $ids = input('id/a'); if(empty($ids)){ $this -> error("请选择待删除的数据",url('admin/Gpgl/showlist',array('cid'=>$cid,'page'=>$p))); } if(is_array($ids)){ $where = 'id in('.implode(',',$ids).')'; }else{ $where = 'id='.$ids; } $rst=Db::name('subscription')->where($where)->delete(); if($rst!==false){ $this->success("删除成功",url('admin/Gpgl/subscription',array('cid'=>$cid,'page'=>$p))); }else{ $this -> error("删除失败!",url('admin/Gpgl/subscription',array('cid'=>$cid,'page'=>$p))); } } public function subscription(Request $request) { $type=$request->param('cid',1); $kind=$request->param('kind'); $this->assign('cid',$type); $db=Db::name('subscription'); $where=['type'=>$type]; if($kind)$where['kind']=$kind; else{ $db->whereOr(['kind'=>['EXP','IS NULL']]); $db->whereOr(['kind'=>0]); } $gp_list=$db->where($where)->order('created_time desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]); $show = $gp_list->render(); $this->assign('page',$show); $parents=config('finance.parents'); $childs=config('finance.childs'); $cates=[1=>'A担保回购式','B撮合回购式','C登记备案式']; if($kind==11){ $cates=[1=>'A类','B类','C类','D类','E类']; } if($gp_list){ $list=$gp_list->toArray(); if(count($list)){ foreach ($list['data'] as &$item){ $title=$category=$child=$parent=''; $item['agree']=$item['agree']==1?'是':'否'; $item['prepay']=$item['prepay']==1?'是':'否'; if(in_array($item['type'],[3])){ $find=Db::name('product')->where(array('id'=>$item['productid']))->find(); if($find)$title=$find['title']; }else{ $find=Db::name('finance')->where(array('c_id'=>$item['productid']))->find(); if($find){ $title=$find['c_name']; $c_type=$find['c_type']; $c_cid=$find['c_cid']; $c_cate=$find['c_cate']; $parent=isset($parents[$c_type])?$parents[$c_type]:''; $child=isset($childs[$c_type][$c_cid])?$childs[$c_type][$c_cid]:''; $category=isset($cates[$c_cate])?$cates[$c_cate]:''; } $item['parent']=$parent; $item['child']=$child; $item['category']=$category; } $item['title']=$title; } } } $this->assign('fwhzc_list',$list); if(request()->isAjax()){ return $this->fetch('ajax_sub_list'); }else{ return $this->fetch(); } } /** * 非文化四版挂牌状态修改 */ public function show_state() { $id=input('x'); $kind=input('kind'); $this->assign('c_kind',$kind); $status=Db::name('finance')->where(array('c_id'=>$id))->value('c_status'); if($status==1){ $statedata = array('c_status'=>0); Db::name('finance')->where(array('c_id'=>$id))->setField($statedata); $this->success('状态禁止'); }else{ $statedata = array('c_status'=>1); Db::name('finance')->where(array('c_id'=>$id))->setField($statedata); $this->success('状态启用'); } } public function show_edit(Request $request) { $kind=input('kind'); $page=input('page'); $this->assign('page',$page); $this->assign('c_kind',$kind); $types=[]; if(!request()->isAjax()) { $c_id = input('c_id', 0, 'intval'); if (!$c_id) $this->error('参数错误', url('admin/Gpgl/showlist',array('kind'=>$kind))); $gp_list = Db::name('finance')->where('c_id', $c_id)->find(); //多图字符串转换成数组 $pic_list = array_filter(explode(",", $gp_list['c_photos'])); $this->assign('pic_list', $pic_list); $tpl='show_edit'; switch ($kind){ case 4: $tpl='show_edit4'; $types=config('finance.parents'); $childs=config('finance.childs'); $this->assign('childs',$childs); $typeid=$gp_list['c_type']; $tchilds=isset($childs[$typeid])?$childs[$typeid]:[]; $this->assign('tchilds',$tchilds); $parents=config('tuoguan.parents'); $this->assign('parents',$parents); $childs=config('tuoguan.childs'); $this->assign('pchilds',$childs); $typeids=$gp_list['c_parent']; $typeids=explode(',',$typeids); $tchilds=[]; if(count($typeids)){ $gp_list['c_parent']=$typeids; $nchilds=[]; $ochilds=explode(";",$gp_list['c_child']); foreach ($typeids as $k=>$row){ if(isset($ochilds[$k]))$nchilds[$row]=explode(",",$ochilds[$k]); } $gp_list['c_child']=$nchilds; foreach ($typeids as $typeid){ $tchild=isset($childs[$typeid])?$childs[$typeid]:[]; $tchild['parent']=isset($parents[$typeid])?$parents[$typeid]:''; $tchilds[$typeid]=$tchild; } } $this->assign('pcchilds',$tchilds); $typeid=$gp_list['c_type']; $tchilds=isset($childs[$typeid])?$childs[$typeid]:[]; $this->assign('tchilds',$tchilds); break; case 3: $tpl='show_edit3'; //$types=[64=>'音乐资产托管']; $types=config('finance.types'); $childs=[]; foreach ($types as $pid=>$parent){ $rows=Db::name('type')->field('id,type_name')->where(['type_type'=>$pid,'type_status'=>1])->select(); if(count($rows)){ $ids=array_column($rows,'id'); $names=array_column($rows, 'type_name'); $childs[$pid]=array_combine($ids,$names); } } $typeid=$gp_list['c_type']; $tchilds=isset($childs[$typeid])?$childs[$typeid]:[]; $this->assign('tchilds',$tchilds); $this->assign('childs',$childs); break; case 5: $tpl='show_edit5'; $types=config('finance.art_types'); break; case 9: $tpl='show_edit9'; try { $evaluation=json_decode($gp_list['c_evaluation'],true); if(is_string($evaluation)||empty($evaluation)){ $evaluation=json_decode(urldecode($gp_list['c_evaluation']),true); } $gp_list['c_evaluation']=$evaluation; } catch (\Exception $e) { $gp_list['c_evaluation']=''; } $cates=$this->artbook; $this->assign('cates',$cates); break; case 6: $types=config('finance.art_enjoy'); $tpl='show_edit6'; break; case 1: $tpl='show_edit1'; break; case 2: $tpl='show_edit2'; break; case 10: $tpl='show_edit10'; break; case 8: $tpl='show_edit8'; break; case 12: $tpl='show_edit12'; break; case 13: $tpl='show_edit13'; break; case 14: $tpl='show_edit14'; break; case 15: $parents=config('building.parents3'); $this->assign('parents',$parents); $childs=config('building.childs2'); $this->assign('childs',$childs); $elems=['1'=>'资产所有权','资产使用权','资产收益权','资产租赁权']; $this->assign('elems',$elems); $classs=config('building.class'); $sizes=config('building.size'); $prices=config('building.price'); $years=config('building.year'); $this->assign('classs',$classs); $this->assign('sizes',$sizes); $this->assign('prices',$prices); $this->assign('years',$years); $typeids=$gp_list['c_parent']; $typeids=explode(',',$typeids); if(count($typeids)){ $gp_list['c_parent']=$typeids; } $typeids=$gp_list['capital_elem']; $typeids=explode(',',$typeids); if(count($typeids)){ $gp_list['capital_elem']=$typeids; } $typeids=$gp_list['capital_info']; $typeids=explode(',',$typeids); if(count($typeids)){ $gp_list['capital_info']=$typeids; } $tpl='show_edit15'; break; case 7: $tpl='show_edit7'; break; case 11: $tpl='show_edit11'; $parents=config('building.parents'); $this->assign('parents',$parents); $elems=['1'=>'资产所有权','资产使用权','资产收益权','资产租赁权']; $this->assign('elems',$elems); $classs=config('building.class'); $sizes=config('building.size'); $prices=config('building.price'); $years=config('building.year'); $this->assign('classs',$classs); $this->assign('sizes',$sizes); $this->assign('prices',$prices); $this->assign('years',$years); $typeids=$gp_list['c_parent']; $typeids=explode(',',$typeids); if(count($typeids)){ $gp_list['c_parent']=$typeids; } $typeids=$gp_list['capital_elem']; $typeids=explode(',',$typeids); if(count($typeids)){ $gp_list['capital_elem']=$typeids; } $typeids=$gp_list['capital_info']; $typeids=explode(',',$typeids); if(count($typeids)){ $gp_list['capital_info']=$typeids; } break; } $this->assign('list', $gp_list); $this->assign('kind',$kind); $this->assign('types',$types); return $this->fetch($tpl); }else{ $pic_oldlist=input('pic_oldlist');//老多图字符串 $jump=url('admin/Gpgl/showlist',array('kind'=>$kind,'page'=>$page)); $img_one=''; $img_one2=''; $picall_url=''; $file = request()->file('pic_one'); $file2 = request()->file('pic_one2'); $file3 = request()->file('mortgage_img'); $files = request()->file('pic_all'); $ret=$this->dealFile($file,$files); if(isset($ret['error'])){ $this->error($ret['error'],$jump); }else{ if(isset($ret['img_one'])&&$ret['img_one'])$img_one=$ret['img_one']; if(isset($ret['picall_url'])&&$ret['picall_url'])$picall_url=$ret['picall_url']; } $sl_data=$request->post(); $c_id = input('c_id', 0, 'intval'); $code=isset($sl_data['c_code'])?$sl_data['c_code']:''; if($code){ $check=$this->_checkCode($code,$c_id,$kind); if($check){ $this->error('托管代码不能重复'); } } if($kind==9){ $evaluation=htmlspecialchars_decode(input('c_evaluation')); $evaluation=json_decode($evaluation,true); if(count($evaluation)){ foreach ($evaluation as $k=>$row){ $row=array_filter($row); $row=array_values($row); array_walk($row,"walkparse"); $evaluation[$k]=$row; } } $sl_data['c_evaluation']=json_encode($evaluation); } //图片字段处理 if(!empty($img_one)){ $sl_data['c_logo']=$img_one; } if(!empty($picall_url)){ $sl_data['c_photos']=$pic_oldlist.$picall_url; }else{ $sl_data['c_photos']=$pic_oldlist; } $sl_data['c_infostime']=isset($sl_data['c_infostime'])?strtotime($sl_data['c_infostime']):time(); $sl_data['c_infoetime']=isset($sl_data['c_infoetime'])?strtotime($sl_data['c_infoetime']):time(); if(isset($sl_data['c_gptime']))$sl_data['c_gptime']=strtotime($sl_data['c_gptime']); $sl_data['c_status']=input('c_status',0); if(isset($sl_data['c_pass']))$sl_data['c_pass']=input('c_pass',0); if(isset($sl_data['c_cate']))$sl_data['c_cate']=input('c_cate',''); if(isset($sl_data['c_cname']))$sl_data['c_cname']=input('c_cname'); $sl_data['c_content']=htmlspecialchars_decode(input('c_content')); $sl_data['capital_desc']=htmlspecialchars_decode(input('capital_desc')); if(isset($sl_data['pic_one2']))unset($sl_data['pic_one2']); if(isset($sl_data['pic_one']))unset($sl_data['pic_one']); if(isset($sl_data['checkpic']))unset($sl_data['checkpic']); if(isset($sl_data['oldcheckpic']))unset($sl_data['oldcheckpic']); if(isset($sl_data['pic_oldlist']))unset($sl_data['pic_oldlist']); if(isset($sl_data['pic_all']))unset($sl_data['pic_all']); if($kind==4){ $childs=""; $parents=""; if(isset($sl_data['c_parent'])&&count($sl_data['c_parent'])){ foreach ($sl_data['c_parent'] as $k=>$row){ if(!isset($sl_data['c_child'][$row])){ $sl_data['c_child'][$row]=[]; } $childs.=implode(",",$sl_data['c_child'][$row]).";"; } $childs=rtrim($childs,";"); $parents=isset($sl_data['c_parent'])&&count($sl_data['c_parent'])?implode(',', $sl_data['c_parent']):''; } $sl_data['c_parent']=$parents; $sl_data['c_child']=$childs; $ret=$this->dealFile($file2); if(isset($ret['error'])){ $this->error($ret['error'],$jump); }else{ if(isset($ret['img_one'])&&$ret['img_one'])$img_one2=$ret['img_one']; } $sl_data['c_material']=input('c_material',''); $sl_data['c_year']=input('c_year',''); $sl_data['c_evaluation']=htmlspecialchars_decode(input('c_evaluation')); $sl_data['c_transaction']=htmlspecialchars_decode(input('c_transaction')); $sl_data['c_state']=input('c_state',1); if(!empty($img_one2)){ $sl_data['c_notice']=$img_one2; } } if($kind==11){ $sl_data['capital_elem']=isset($sl_data['capital_elem'])&&count($sl_data['capital_elem'])?implode(',', $sl_data['capital_elem']):''; $sl_data['capital_level']=input('capital_level',''); $sl_data['c_year']=input('c_year',''); if(isset($sl_data['capital_land'])&&$sl_data['capital_land']==5&&isset($sl_data['land_other']))$sl_data['land_other']=input('land_other',''); if(isset($sl_data['c_year'])&&$sl_data['c_year']==4&&isset($sl_data['year_other']))$sl_data['year_other']=input('year_other',''); if(isset($sl_data['c_class'])&&$sl_data['c_class']==9&&isset($sl_data['class_other']))$sl_data['class_other']=input('class_other',''); if(isset($sl_data['capital_info'])){ if(in_array(4, $sl_data['capital_info'])&&isset($sl_data['info_other']))$sl_data['info_other']=input('info_other',''); $sl_data['capital_info']=implode(',', $sl_data['capital_info']); } $ret=$this->dealFile($file3); if(isset($ret['error'])){ $this->error($ret['error'],$jump); }else{ if(isset($ret['img_one'])&&$ret['img_one']){ $img=$ret['img_one']; $sl_data['mortgage_img']=$img; } } } $sl_data['c_tag']=input('c_tag',0); $sl_data['c_mold']=input('c_mold',0); $sl_data['c_uid']=session('admin_auth.aid'); $item=new Finance(); $rst=$item->allowField(true)->update($sl_data); if($rst!==false){ $this->success('修改成功',$jump); }else{ $this->error('修改失败',$jump); } } } protected function _checkCode($code='',$id='',$kind=''){ $find=Db::name('finance')->where(['c_code'=>$code]); if($id){ $find->where('c_id','neq',$id); } if($kind){ $find->where(['c_kind'=>$kind]); } $res=$find->count(); return $res; } /** * 非文化资产挂牌增加 */ public function show_add(Request $request) { $kind=input('kind'); $this->assign('c_kind',$kind); $types=[]; if(!request()->isAjax()) { $tpl='show_add'; switch ($kind){ case 4: $tpl='show_add4'; $types=config('finance.parents'); $childs=config('finance.childs'); $this->assign('childs',$childs); $parents=config('tuoguan.parents'); $this->assign('parents',$parents); $childs=config('tuoguan.childs'); $this->assign('pchilds',$childs); break; case 3: $tpl='show_add3'; //$types=[64=>'音乐资产托管']; $types=config('finance.types'); $childs=[]; foreach ($types as $pid=>$parent){ $rows=Db::name('type')->field('id,type_name')->where(['type_type'=>$pid,'type_status'=>1])->select(); if(count($rows)){ $ids=array_column($rows,'id'); $names=array_column($rows, 'type_name'); $childs[$pid]=array_combine($ids,$names); } } $this->assign('childs',$childs); break; case 5: $tpl='show_add5'; $types=config('finance.art_types'); break; case 9: $tpl='show_add9'; $cates=$this->artbook; $this->assign('cates',$cates); break; case 7: $tpl='show_add7'; break; case 6: $types=config('finance.art_enjoy'); $tpl='show_add6'; break; case 1: $tpl='show_add1'; break; case 2: $tpl='show_add2'; break; case 10: $tpl='show_add10'; break; case 8: $tpl='show_add8'; break; case 12: $tpl='show_add12'; break; case 13: $tpl='show_add13'; break; case 14: $tpl='show_add14'; break; case 15: $tpl='show_add15'; $parents=config('building.parents3'); $this->assign('parents',$parents); $childs=config('building.childs2'); $this->assign('childs',$childs); $elems=['1'=>'资产所有权','资产使用权','资产收益权','资产租赁权']; $this->assign('elems',$elems); $classs=config('building.class'); $sizes=config('building.size'); $prices=config('building.price'); $years=config('building.year'); $this->assign('classs',$classs); $this->assign('sizes',$sizes); $this->assign('prices',$prices); $this->assign('years',$years); break; case 11: $tpl='show_add11'; $parents=config('building.parents'); $this->assign('parents',$parents); $elems=['1'=>'资产所有权','资产使用权','资产收益权','资产租赁权']; $this->assign('elems',$elems); $classs=config('building.class'); $sizes=config('building.size'); $prices=config('building.price'); $years=config('building.year'); $this->assign('classs',$classs); $this->assign('sizes',$sizes); $this->assign('prices',$prices); $this->assign('years',$years); break; } $this->assign('kind',$kind); $this->assign('types',$types); return $this->fetch($tpl); }else{ $jump=url('admin/Gpgl/showlist',array('kind'=>$kind)); $img_one=''; $img_one2=''; $picall_url=''; $file = request()->file('pic_one'); $file2 = request()->file('pic_one2'); $file3 = request()->file('mortgage_img'); $files = request()->file('pic_all'); $ret=$this->dealFile($file,$files); if(isset($ret['error'])){ $this->error($ret['error'],$jump); }else{ if(isset($ret['img_one'])&&$ret['img_one'])$img_one=$ret['img_one']; if(isset($ret['picall_url'])&&$ret['picall_url'])$picall_url=$ret['picall_url']; } $item=new Finance(); $sl_data=$request->post(); $code=isset($sl_data['c_code'])?$sl_data['c_code']:''; if($code){ $check=$this->_checkCode($code,'',$kind); if($check){ $this->error('托管代码不能重复'); } } $sl_data['c_kind']=$kind; $sl_data['c_infostime']=isset($sl_data['c_infostime'])?strtotime($sl_data['c_infostime']):time(); $sl_data['c_infoetime']=isset($sl_data['c_infoetime'])?strtotime($sl_data['c_infoetime']):time(); if(isset($sl_data['c_gptime']))$sl_data['c_gptime']=strtotime($sl_data['c_gptime']); $sl_data['c_status']=input('c_status',0); if(isset($sl_data['c_pass']))$sl_data['c_pass']=input('c_pass',0); if(isset($sl_data['c_cate']))$sl_data['c_cate']=input('c_cate',''); if(isset($sl_data['c_state']))$sl_data['c_state']=input('c_state',1); if(isset($sl_data['c_cname']))$sl_data['c_cname']=input('c_cname'); if(isset($sl_data['capital_land'])&&$sl_data['capital_land']==5&&isset($sl_data['land_other']))$sl_data['land_other']=input('land_other',''); if(isset($sl_data['c_year'])&&$sl_data['c_year']==4&&isset($sl_data['year_other']))$sl_data['year_other']=input('year_other',''); if(isset($sl_data['c_class'])&&$sl_data['c_class']==9&&isset($sl_data['class_other']))$sl_data['class_other']=input('class_other',''); if(isset($sl_data['capital_info'])){ if(in_array(4, $sl_data['capital_info'])&&isset($sl_data['info_other']))$sl_data['info_other']=input('info_other',''); $sl_data['capital_info']=implode(',', $sl_data['capital_info']); } $sl_data['c_content']=htmlspecialchars_decode(input('c_content')); $sl_data['capital_desc']=htmlspecialchars_decode(input('capital_desc')); if($kind==9){ $evaluation=htmlspecialchars_decode(input('c_evaluation')); $evaluation=json_decode($evaluation,true); if(count($evaluation)){ foreach ($evaluation as $k=>$row){ $row=array_filter($row); $row=array_values($row); array_walk($row,"walkparse"); $evaluation[$k]=$row; } } $sl_data['c_evaluation']=json_encode($evaluation); } if($kind==4){ $childs=""; $parents=""; if(isset($sl_data['c_parent'])&&count($sl_data['c_parent'])){ foreach ($sl_data['c_parent'] as $k=>$row){ if(!isset($sl_data['c_child'][$row])){ $sl_data['c_child'][$row]=[]; } $childs.=implode(",",$sl_data['c_child'][$row]).";"; } $childs=rtrim($childs,";"); $parents=isset($sl_data['c_parent'])&&count($sl_data['c_parent'])?implode(',', $sl_data['c_parent']):''; } $sl_data['c_parent']=$parents; $sl_data['c_child']=$childs; $ret=$this->dealFile($file2); if(isset($ret['error'])){ $this->error($ret['error'],$jump); }else{ if(isset($ret['img_one'])&&$ret['img_one'])$img_one2=$ret['img_one']; } $sl_data['c_material']=input('c_material',''); $sl_data['c_year']=input('c_year',''); $sl_data['c_evaluation']=htmlspecialchars_decode(input('c_evaluation')); $sl_data['c_transaction']=htmlspecialchars_decode(input('c_transaction')); if(!empty($img_one2)){ $sl_data['c_notice']=$img_one2; } } if($kind==11){ $sl_data['capital_elem']=isset($sl_data['capital_elem'])&&count($sl_data['capital_elem'])?implode(',', $sl_data['capital_elem']):''; $sl_data['capital_level']=input('capital_level',''); $sl_data['c_year']=input('c_year',''); $ret=$this->dealFile($file3); if(isset($ret['error'])){ $this->error($ret['error'],$jump); }else{ if(isset($ret['img_one'])&&$ret['img_one']){ $img=$ret['img_one']; $sl_data['mortgage_img']=$img; } } } if($kind==15){ $sl_data['c_child']=input('c_child',''); } //图片字段处理 if(!empty($img_one)){ $sl_data['c_logo']=$img_one; } if(!empty($picall_url)){ $sl_data['c_photos']=$picall_url; } if(isset($sl_data['pic_one']))unset($sl_data['pic_one']); if(isset($sl_data['pic_one2']))unset($sl_data['pic_one2']); if(isset($sl_data['checkpic']))unset($sl_data['checkpic']); if(isset($sl_data['oldcheckpic']))unset($sl_data['oldcheckpic']); if(isset($sl_data['pic_oldlist']))unset($sl_data['pic_oldlist']); if(isset($sl_data['pic_all']))unset($sl_data['pic_all']); $sl_data['c_time']=time(); $sl_data['c_tag']=input('c_tag',0); $sl_data['c_mold']=input('c_mold',0); $sl_data['c_jcname']=input('c_jcname',' '); $sl_data['c_uid']=session('admin_auth.aid'); $rst=$item->allowField(true)->insert($sl_data); if($rst){ $this->success('增加成功',$jump); }else{ $this->error('增加失败',$jump); } } } /** * 非文化资产挂牌排序 */ public function show_order() { $kind=input('kind'); $this->assign('c_kind',$kind); if (!request()->isAjax()){ $this->error('提交方式不正确',url('admin/Gpgl/showlist',array('kind'=>$kind))); }else{ foreach (input('post.') as $c_id => $c_order){ Db::name('finance')->update(['c_id'=>$c_id,'c_order'=>$c_order]); } $this->success('排序更新成功',url('admin/Gpgl/showlist',array('kind'=>$kind))); } } /** * 非文化资产挂牌删除(单个) */ public function show_del() { $p=input('p'); $kind=input('kind'); $this->assign('c_kind',$kind); $rst=Db::name('finance')->delete(input('c_id')); if($rst!==false){ $this->success('删除成功',url('admin/Gpgl/showlist',array('p' => $p,'kind'=>$kind))); }else{ $this -> error("删除失败!",url('admin/Gpgl/showlist',array('p'=>$p,'kind'=>$kind))); } } /** * 非文化资产删除挂牌(全选) */ public function show_alldel() { $p = input('p'); $kind=input('kind'); $this->assign('c_kind',$kind); $ids = input('c_id/a'); if(empty($ids)){ $this -> error("请选择待删除的数据",url('admin/Gpgl/showlist',array('p'=>$p,'kind'=>$kind))); } if(is_array($ids)){ $where = 'c_id in('.implode(',',$ids).')'; }else{ $where = 'c_id='.$ids; } $rst=Db::name('finance')->where($where)->delete(); if($rst!==false){ $this->success("删除成功",url('admin/Gpgl/showlist',array('p'=>$p,'kind'=>$kind))); }else{ $this -> error("删除失败!",url('admin/Gpgl/showlist',array('p'=>$p,'kind'=>$kind))); } } /** * 非文化资产列表 */ public function fwhzc_list() { $gp_list=Db::name('otinfo')->where('c_type',2)->order('c_order,c_time desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]); $show = $gp_list->render(); $this->assign('page',$show); $this->assign('fwhzc_list',$gp_list); if(request()->isAjax()){ return $this->fetch('ajax_fwhzc_list'); }else{ return $this->fetch(); } } /** * 非文化四版挂牌状态修改 */ public function fwhzc_state() { $id=input('x'); $status=Db::name('otinfo')->where(array('c_id'=>$id))->value('c_status'); if($status==1){ $statedata = array('c_status'=>0); Db::name('otinfo')->where(array('c_id'=>$id))->setField($statedata); $this->success('状态禁止'); }else{ $statedata = array('c_status'=>1); Db::name('otinfo')->where(array('c_id'=>$id))->setField($statedata); $this->success('状态启用'); } } public function fwhzc_edit() { if(!request()->isAjax()) { $c_id = input('c_id', 0, 'intval'); if (!$c_id) $this->error('参数错误', url('admin/Gpgl/fwhzc_list')); $gp_list = Db::name('otinfo')->where('c_id', $c_id)->find(); $this->assign('fwhzc_list', $gp_list); $gyxm=Db::name('type')->where('type_type',4)->select(); $this->assign('gyxm', $gyxm); $dfqy=Db::name('type')->where('type_type',5)->select(); $this->assign('dfqy', $dfqy); return $this->fetch(); }else{ $img_one=''; $file = request()->file('pic_one'); $validate = config('upload_validate'); //单图 if ($file) { $info = $file[0]->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d')); if ($info) { $img_url = config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename(); //写入数据库 $data['uptime'] = time(); $data['filesize'] = $info->getSize(); $data['path'] = $img_url; Db::name('plug_files')->insert($data); $img_one = $img_url; } else { $this->error($file->getError(), url('admin/Gpgl/whzc_list')); } } $sl_data=array( 'c_id'=>input('c_id'), 'c_name'=>input('c_name'), 'c_jcname'=>input('c_jcname',''), 'c_code'=>input('c_code'), 'c_location'=>input('c_location',''), 'c_gyxm'=>input('c_gyxm',1,'intval'), 'c_dfqy'=>input('c_dfqy',1,'intval'), 'c_status'=>input('c_status',0), 'c_order'=>input('c_order',50,'intval'), 'c_gptime'=>input('c_gptime','')?strtotime(input('c_gptime','')):time(), 'c_infostime'=>input('c_infostime','')?strtotime(input('c_infostime','')):time(), 'c_infoetime'=>input('c_infoetime','')?strtotime(input('c_infoetime','')):time(), 'c_firstnews'=>input('c_firstnews',''), 'c_desc'=>input('c_desc',''), 'c_content'=>htmlspecialchars_decode(input('c_content')), ); //图片字段处理 if(!empty($img_one)){ $sl_data['c_logo']=$img_one; } $rst=Db::name('otinfo')->update($sl_data); if($rst!==false){ $this->success('修改成功',url('admin/Gpgl/fwhzc_list')); }else{ $this->error('修改失败',url('admin/Gpgl/fwhzc_list')); } } } /** * 非文化资产挂牌增加 */ public function fwhzc_add() { if(!request()->isAjax()) { $gyxm=Db::name('type')->where('type_type',4)->select(); $this->assign('gyxm', $gyxm); $dfqy=Db::name('type')->where('type_type',5)->select(); $this->assign('dfqy', $dfqy); return $this->fetch(); }else{ $img_one=''; $file = request()->file('pic_one'); $validate = config('upload_validate'); //单图 if ($file) { $info = $file[0]->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d')); if ($info) { $img_url = config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename(); //写入数据库 $data['uptime'] = time(); $data['filesize'] = $info->getSize(); $data['path'] = $img_url; Db::name('plug_files')->insert($data); $img_one = $img_url; } else { $this->error($file->getError(), url('admin/Gpgl/whzc_list')); } } $sl_data=array( 'c_name'=>input('c_name'), 'c_jcname'=>input('c_jcname',''), 'c_code'=>input('c_code'), 'c_location'=>input('c_location',''), 'c_gyxm'=>input('c_gyxm',1,'intval'), 'c_dfqy'=>input('c_dfqy',1,'intval'), 'c_status'=>input('c_status',0), 'c_order'=>input('c_order',50,'intval'), 'c_gptime'=>input('c_gptime','')?strtotime(input('c_gptime','')):time(), 'c_infostime'=>input('c_infostime','')?strtotime(input('c_infostime','')):time(), 'c_infoetime'=>input('c_infoetime','')?strtotime(input('c_infoetime','')):time(), 'c_firstnews'=>input('c_firstnews',''), 'c_desc'=>input('c_desc',''), 'c_content'=>htmlspecialchars_decode(input('c_content')), 'c_logo'=>$img_one, 'c_time'=>time(), 'c_uid'=>session('admin_auth.aid'), 'c_type'=>2 ); $rst=Db::name('otinfo')->insert($sl_data); if($rst){ $this->success('增加成功',url('admin/Gpgl/fwhzc_list')); }else{ $this->error('增加失败',url('admin/Gpgl/fwhzc_list')); } } } /** * 非文化资产挂牌排序 */ public function fwhzc_order() { if (!request()->isAjax()){ $this->error('提交方式不正确',url('admin/Gpgl/fwhzc_list')); }else{ foreach (input('post.') as $c_id => $c_order){ Db::name('otinfo')->update(['c_id'=>$c_id,'c_order'=>$c_order]); } $this->success('排序更新成功',url('admin/Gpgl/fwhzc_list')); } } /** * 非文化资产挂牌删除(单个) */ public function fwhzc_del() { $p=input('p'); $rst=Db::name('otinfo')->delete(input('c_id')); if($rst!==false){ $this->success('删除成功',url('admin/Gpgl/fwhzc_list',array('p' => $p))); }else{ $this -> error("删除失败!",url('admin/Gpgl/fwhzc_list',array('p'=>$p))); } } /** * 非文化资产删除挂牌(全选) */ public function fwhzc_alldel() { $p = input('p'); $ids = input('c_id/a'); if(empty($ids)){ $this -> error("请选择待删除的数据",url('admin/Gpgl/fwhzc_list',array('p'=>$p))); } if(is_array($ids)){ $where = 'c_id in('.implode(',',$ids).')'; }else{ $where = 'c_id='.$ids; } $rst=Db::name('otinfo')->where($where)->delete(); if($rst!==false){ $this->success("删除成功",url('admin/Gpgl/fwhzc_list',array('p'=>$p))); }else{ $this -> error("删除失败!",url('admin/Gpgl/fwhzc_list',array('p'=>$p))); } } //查询公馆 public function manager_list(){ $zgwhjf_gg=Db::name('zgwhjf_gg')->order('gg_order,gg_time desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]); if(empty($zgwhjf_gg)){ $this->success("查询失败",url('admin/Gpgl/gp_list')); } $show = $zgwhjf_gg->render(); $this->assign('page',$show); $this->assign("zgwhjf_gg",$zgwhjf_gg); //公馆分类 $hylb=Db::name('type')->where('type_type',50)->select(); $this->assign('hylb', $hylb); //门类分类 $hylbt=Db::name('type')->where('type_type',51)->select(); $this->assign('hylbt', $hylbt); if(request()->isAjax()){ return $this->fetch('ajax_whzc_manager_list');//whzc_manager }else{ return $this->fetch('whzc_manager'); } } //公馆新增 public function manager_add(){ $gg_code = input('gg_code'); if($gg_code==null){ //公馆分类 $hylb=Db::name('type')->where('type_type',50)->select(); $this->assign('hylb', $hylb); //门类分类 $hylbt=Db::name('type')->where('type_type',51)->select(); $this->assign('hylbt', $hylbt); return $this->fetch('manager_add'); } $term =input('gg_opentime')?strtotime(input('gg_opentime','')):time(); if($term==null){ $term=time(); }else{ $term =input('gg_opentime')?strtotime(input('gg_opentime','')):time(); } $sl_data=array( 'gg_code'=>input('gg_code'), 'gg_museumunt'=>input('gg_museumunt'), 'gg_grade'=>input('gg_grade'), 'gg_opentime'=>$term, 'gg_type'=>input('gg_type',1,'intval'), 'gg_category'=>input('gg_category',1,'intval'), 'gg_time'=>time(), 'gg_uid'=>session('admin_auth.aid'), 'gg_status'=>input('gg_status',0), 'gg_content'=>htmlspecialchars_decode(input('gg_content')), 'gg_order'=>input('gg_order'), ); $rst=Db::name('zgwhjf_gg')->insert($sl_data); if($rst){ $this->success('增加成功',url('admin/Gpgl/manager_list')); }else{ $this->error('增加失败',url('admin/Gpgl/manager_add')); } } //公馆删除 public function manager_detele(){ $p = input('p'); $ids = input('gg_id/a'); if(empty($ids)){ $this -> error("请选择待删除的数据",url('admin/Gpgl/manager_list',array('p'=>$p))); } if(is_array($ids)){ $where = 'gg_id in('.implode(',',$ids).')'; }else{ $where = 'gg_id='.$ids; } $rst=Db::name('zgwhjf_gg')->where($where)->delete(); if($rst!==false){ $this->success("删除成功",url('admin/Gpgl/manager_list',array('p'=>$p))); }else{ $this -> error("删除失败!",url('admin/Gpgl/manager_list',array('p'=>$p))); } } /** * 公馆排序 */ public function manager_order() { if (!request()->isAjax()){ $this->error('提交方式不正确',url('admin/Gpgl/manager_list')); }else{ foreach (input('post.') as $gg_id => $gg_order){ Db::name('zgwhjf_gg')->update(['gg_id'=>$gg_id,'gg_order'=>$gg_order]); } $this->success('排序更新成功',url('admin/Gpgl/manager_list')); } } /** * 公馆状态修改 */ public function manager_state() { $id=input('x'); $status=Db::name('zgwhjf_gg')->where(array('gg_id'=>$id))->value('gg_status'); if($status==1){ $statedata = array('gg_status'=>0); Db::name('zgwhjf_gg')->where(array('gg_id'=>$id))->setField($statedata); $this->success('状态禁止'); }else{ $statedata = array('gg_status'=>1); Db::name('zgwhjf_gg')->where(array('gg_id'=>$id))->setField($statedata); $this->success('状态启用'); } } /** * 公馆挂牌修改 */ public function manager_edit() { $aa=input('aa'); if($aa==null) { $gg_id = input('gg_id', 0, 'intval'); $zbed=Db::name('zgwhjf_gg')->where('gg_id',$gg_id)->find(); $this->assign('zbed', $zbed); //公馆分类 $hylb=Db::name('type')->where('type_type',50)->select(); $this->assign('hylb', $hylb); //门类分类 $hylbt=Db::name('type')->where('type_type',51)->select(); $this->assign('hylbt', $hylbt); return $this->fetch('manager_update'); }else{ $term =input('gg_opentime')?strtotime(input('gg_opentime','')):time(); if($term==null){ $term=time(); }else{ $term =input('gg_opentime')?strtotime(input('gg_opentime','')):time(); } $sl_data=array( 'gg_code'=>input('gg_code'), 'gg_museumunt'=>input('gg_museumunt'), 'gg_grade'=>input('gg_grade'), 'gg_opentime'=>$term, 'gg_type'=>input('gg_type',1,'intval'), 'gg_category'=>input('gg_category',1,'intval'), 'gg_time'=>time(), 'gg_uid'=>session('admin_auth.aid'), 'gg_status'=>input('gg_status',0), 'gg_content'=>htmlspecialchars_decode(input('gg_content')), 'gg_order'=>input('gg_order') ); $rst=Db::name('zgwhjf_gg')->where('gg_id',input('gg_id'))->update($sl_data); if($rst!==false){ $this->success('修改成功',url('admin/Gpgl/manager_list')); }else{ $this->error('修改失败',url('admin/Gpgl/manager_list')); } } } //查询商城 public function shopping_list(){ $zgwhjf_gg=Db::name('zgwhjf_sc')->order('sc_sort,sc_time desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]); if(empty($zgwhjf_gg)){ $this->success("查询失败",url('admin/Gpgl/shopping_list')); } $show = $zgwhjf_gg->render(); $this->assign('page',$show); $this->assign("zgwhjf_gg",$zgwhjf_gg); if(request()->isAjax()){ return $this->fetch('ajax_whzc_shopping_list');//whzc_manager }else{ return $this->fetch('shopping_list'); } } //商城新增 public function shopping_add(){ $sc_product_code = input('sc_product_code'); if($sc_product_code==null){ return $this->fetch('shopping_add'); } $term =input('sc_uptime')?strtotime(input('sc_uptime','')):time(); if($term==null){ $term=time(); }else{ $term =input('sc_uptime')?strtotime(input('sc_uptime','')):time(); } $sl_data=array( 'sc_sort'=>input('sc_sort'), 'sc_product_code'=>input('sc_product_code'), 'sc_product_name'=>input('sc_product_name'), 'sc_uptime'=>$term, 'sc_price'=>input('sc_price'), 'sc_jbd'=>input('sc_jbd'), 'sc_totalcount'=>input('sc_totalcount'), 'sc_time'=>time(), 'sc_uid'=>session('admin_auth.aid'), 'sc_status'=>input('sc_status',0), 'sc_content'=>input('sc_content'), 'sc_mincount'=>input('sc_mincount'), ); $rst=Db::name('zgwhjf_sc')->insert($sl_data); if($rst){ $this->success('增加成功',url('admin/Gpgl/shopping_list')); }else{ $this->error('增加失败',url('admin/Gpgl/shopping_add')); } } //商城删除 public function shopping_detele(){ $p = input('p'); $ids = input('sc_id/a'); if(empty($ids)){ $this -> error("请选择待删除的数据",url('admin/Gpgl/shopping_list',array('p'=>$p))); } if(is_array($ids)){ $where = 'sc_id in('.implode(',',$ids).')'; }else{ $where = 'sc_id='.$ids; } $rst=Db::name('zgwhjf_sc')->where($where)->delete(); if($rst!==false){ $this->success("删除成功",url('admin/Gpgl/shopping_list',array('p'=>$p))); }else{ $this -> error("删除失败!",url('admin/Gpgl/shopping_list',array('p'=>$p))); } } /** * 商城状态修改 */ public function shopping_state() { $id=input('x'); $status=Db::name('zgwhjf_sc')->where(array('sc_id'=>$id))->value('sc_status'); if($status==1){ $statedata = array('sc_status'=>0); Db::name('zgwhjf_sc')->where(array('sc_id'=>$id))->setField($statedata); $this->success('状态禁止'); }else{ $statedata = array('sc_status'=>1); Db::name('zgwhjf_sc')->where(array('sc_id'=>$id))->setField($statedata); $this->success('状态启用'); } } /** * 商城排序 */ public function shopping_order() { if (!request()->isAjax()){ $this->error('提交方式不正确',url('admin/Gpgl/shopping_list')); }else{ foreach (input('post.') as $gg_id => $gg_order){ Db::name('zgwhjf_sc')->update(['sc_id'=>$gg_id,'sc_sort'=>$gg_order]); } $this->success('排序更新成功',url('admin/Gpgl/shopping_list')); } } /** * 商城挂牌修改 */ public function shopping_edit() { $aa=input('aa'); if($aa==null) { $sc_id = input('sc_id', 0, 'intval'); $zbed=Db::name('zgwhjf_sc')->where('sc_id',$sc_id)->find(); $this->assign('zbed', $zbed); return $this->fetch('shopping_update'); }else{ $term =input('sc_uptime')?strtotime(input('sc_uptime','')):time(); if($term==null){ $term=time(); }else{ $term =input('sc_uptime')?strtotime(input('sc_uptime','')):time(); } $sl_data=array( 'sc_sort'=>input('sc_sort'), 'sc_product_code'=>input('sc_product_code'), 'sc_product_name'=>input('sc_product_name'), 'sc_uptime'=>$term, 'sc_price'=>input('sc_price'), 'sc_jbd'=>input('sc_jbd'), 'sc_totalcount'=>input('sc_totalcount'), 'sc_time'=>time(), 'sc_status'=>input('sc_status',0), 'sc_content'=>input('sc_content'), 'sc_uid'=>session('admin_auth.aid'), 'sc_mincount'=>input('sc_mincount'), ); $rst=Db::name('zgwhjf_sc')->where('sc_id',input('sc_id'))->update($sl_data); if($rst!==false){ $this->success('修改成功',url('admin/Gpgl/shopping_list')); }else{ $this->error('修改失败',url('admin/Gpgl/shopping_list')); } } } //查询艺拍 public function making_list(){ $zgwhjf_gg=Db::name('zgwhjf_yp')->order('yp_sort,yp_time desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]); if(empty($zgwhjf_gg)){ $this->success("查询失败",url('admin/Gpgl/making_list')); } $show = $zgwhjf_gg->render(); $this->assign('page',$show); $this->assign("zgwhjf_gg",$zgwhjf_gg); if(request()->isAjax()){ return $this->fetch('ajax_whzc_making_list');//whzc_manager }else{ return $this->fetch('making_list'); } } //艺拍新增 public function making_add(){ $yp_auction_code = input('yp_auction_code'); if($yp_auction_code==null){ return $this->fetch('making_add'); } $term =input('yp_create_year')?strtotime(input('yp_create_year','')):time(); if($term==null){ $term=time(); }else{ $term =input('yp_create_year')?strtotime(input('yp_create_year','')):time(); } $sl_data=array( 'yp_auction_code'=>input('yp_auction_code'), 'yp_artist_name'=>input('yp_artist_name'), 'yp_works_name'=>input('yp_works_name'), 'yp_create_year'=>$term, 'yp_start_price'=>input('yp_start_price'), 'yp_transaction_price'=>input('yp_transaction_price'), 'yp_schq'=>input('yp_schq'), 'yp_time'=>time(), 'yp_uid'=>session('admin_auth.aid'), 'yp_status'=>input('yp_status',0), 'yp_content'=>input('yp_content'), 'yp_sort'=>input('yp_sort'), ); $rst=Db::name('zgwhjf_yp')->insert($sl_data); if($rst){ $this->success('增加成功',url('admin/Gpgl/making_list')); }else{ $this->error('增加失败',url('admin/Gpgl/making_add')); } } //艺拍删除 public function making_detele(){ $p = input('p'); $ids = input('yp_id/a'); if(empty($ids)){ $this -> error("请选择待删除的数据",url('admin/Gpgl/making_list',array('p'=>$p))); } if(is_array($ids)){ $where = 'yp_id in('.implode(',',$ids).')'; }else{ $where = 'yp_id='.$ids; } $rst=Db::name('zgwhjf_yp')->where($where)->delete(); if($rst!==false){ $this->success("删除成功",url('admin/Gpgl/making_list',array('p'=>$p))); }else{ $this -> error("删除失败!",url('admin/Gpgl/making_list',array('p'=>$p))); } } /** * 艺拍状态修改 */ public function making_state() { $id=input('x'); $status=Db::name('zgwhjf_yp')->where(array('yp_id'=>$id))->value('yp_status'); if($status==1){ $statedata = array('yp_status'=>0); Db::name('zgwhjf_yp')->where(array('yp_id'=>$id))->setField($statedata); $this->success('状态禁止'); }else{ $statedata = array('yp_status'=>1); Db::name('zgwhjf_yp')->where(array('yp_id'=>$id))->setField($statedata); $this->success('状态启用'); } } /** * 艺拍修改 */ public function making_edit() { $aa=input('aa'); if($aa==null) { $sc_id = input('yp_id', 0, 'intval'); $zbed=Db::name('zgwhjf_yp')->where('yp_id',$sc_id)->find(); $this->assign('zbed', $zbed); return $this->fetch('making_update'); }else{ $term =input('yp_create_year')?strtotime(input('yp_create_year','')):time(); if($term==null){ $term=time(); }else{ $term =input('yp_create_year')?strtotime(input('yp_create_year','')):time(); } $sl_data=array( 'yp_auction_code'=>input('yp_auction_code'), 'yp_artist_name'=>input('yp_artist_name'), 'yp_works_name'=>input('yp_works_name'), 'yp_create_year'=>$term, 'yp_start_price'=>input('yp_start_price'), 'yp_transaction_price'=>input('yp_transaction_price'), 'yp_schq'=>input('yp_schq'), 'yp_status'=>input('yp_status',0), 'yp_content'=>input('yp_content'), 'yp_time'=>time(), 'yp_sort'=>input('yp_sort'), 'yp_uid'=>session('admin_auth.aid'), ); $rst=Db::name('zgwhjf_yp')->where('yp_id',input('yp_id'))->update($sl_data); if($rst!==false){ $this->success('修改成功',url('admin/Gpgl/making_list')); }else{ $this->error('修改失败',url('admin/Gpgl/making_list')); } } } //查询艺术投行 public function shooting_list(){ $zgwhjf_gg=Db::name('zgwhjf_ysth')->order('ysth_sort,ysth_time desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]); if(empty($zgwhjf_gg)){ $this->success("查询失败",url('admin/Gpgl/shooting_list')); } $show = $zgwhjf_gg->render(); $this->assign('page',$show); $this->assign("zgwhjf_gg",$zgwhjf_gg); if(request()->isAjax()){ return $this->fetch('ajax_whzc_shooting_list');//whzc_manager }else{ return $this->fetch('shooting_list'); } } //艺术投行新增 public function shooting_add(){ $ysth_code = input('ysth_code'); if($ysth_code==null){ return $this->fetch('shooting_add'); } $term =input('ysth_term')?strtotime(input('ysth_term','')):time(); if($term==null){ $term=time(); }else{ $term =input('ysth_term')?strtotime(input('ysth_term','')):time(); } $sl_data=array( 'ysth_code'=>input('ysth_code'), 'ysth_product_name'=>input('ysth_product_name'), 'ysth_term'=>$term, 'ysth_estimate_yearrate'=>input('ysth_estimate_yearrate'), 'ysth_time'=>time(), 'ysth_uid'=>session('admin_auth.aid'), 'ysth_status'=>input('ysth_status',0), 'ysth_content'=>input('ysth_content'), 'ysth_sort'=>input('ysth_sort'), ); $rst=Db::name('zgwhjf_ysth')->insert($sl_data); if($rst){ $this->success('增加成功',url('admin/Gpgl/shooting_list')); }else{ $this->error('增加失败',url('admin/Gpgl/shooting_add')); } } //艺术投行删除 public function shooting_detele(){ $p = input('p'); $ids = input('ysth_id/a'); if(empty($ids)){ $this -> error("请选择待删除的数据",url('admin/Gpgl/shooting_list',array('p'=>$p))); } if(is_array($ids)){ $where = 'ysth_id in('.implode(',',$ids).')'; }else{ $where = 'ysth_id='.$ids; } $rst=Db::name('zgwhjf_ysth')->where($where)->delete(); if($rst!==false){ $this->success("删除成功",url('admin/Gpgl/shooting_list',array('p'=>$p))); }else{ $this -> error("删除失败!",url('admin/Gpgl/shooting_list',array('p'=>$p))); } } /** * 艺术投行状态修改 */ public function shooting_state() { $id=input('x'); $status=Db::name('zgwhjf_ysth')->where(array('ysth_id'=>$id))->value('ysth_status'); if($status==1){ $statedata = array('ysth_status'=>0); Db::name('zgwhjf_ysth')->where(array('ysth_id'=>$id))->setField($statedata); $this->success('状态禁止'); }else{ $statedata = array('ysth_status'=>1); Db::name('zgwhjf_ysth')->where(array('ysth_id'=>$id))->setField($statedata); $this->success('状态启用'); } } /** * 艺术投行修改 */ public function shooting_edit() { $aa=input('aa'); if($aa==null) { $ysth_id = input('ysth_id', 0, 'intval'); $zbed=Db::name('zgwhjf_ysth')->where('ysth_id',$ysth_id)->find(); $this->assign('zbed', $zbed); return $this->fetch('shooting_update'); }else{ $term =input('ysth_term')?strtotime(input('ysth_term','')):time(); if($term==null){ $term=time(); }else{ $term =input('ysth_term')?strtotime(input('ysth_term','')):time(); } $sl_data=array( 'ysth_code'=>input('ysth_code'), 'ysth_product_name'=>input('ysth_product_name'), 'ysth_term'=>$term, 'ysth_estimate_yearrate'=>input('ysth_estimate_yearrate'), 'ysth_time'=>time(), 'ysth_uid'=>session('admin_auth.aid'), 'ysth_sort'=>input('ysth_sort'), 'ysth_status'=>input('ysth_status',0), 'ysth_content'=>input('ysth_content'), ); $rst=Db::name('zgwhjf_ysth')->where('ysth_id',input('ysth_id'))->update($sl_data); if($rst!==false){ // return $this->redirect(url('admin/Gpgl/shooting_list')); $this->success('修改成功',url('admin/Gpgl/shooting_list')); }else{ $this->error('修改失败',url('admin/Gpgl/shooting_list')); } } } /** * 国有列表 */ public function gy_list() { $c_ssbk=input('c_ssbk',0,'intval'); $op='='; $type_id=$c_ssbk; //所属板块 $ssbk=Db::name('type')->where('type_type','=',54)->where('type_id',$op,$type_id)->find(); $this->assign('ssbk', $ssbk); $where['type_type']=54; if($c_ssbk) $where['c_ssbk']=$c_ssbk; $this->assign('c_ssbk',$c_ssbk); $gp_list=Db::name('gyxm')->alias('a')->join(config('database.prefix').'type b','a.c_ssbk=b.type_id')->where($where)->order('c_order,c_time desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]); $show = $gp_list->render(); $this->assign('page',$show); $this->assign('gp_list',$gp_list); if(request()->isAjax()){ return $this->fetch('gpgl/ajax_gy_list'); }else{ return $this->fetch('gpgl/gy_list'); } } /** * 国有项目增加 */ public function gy_add() { if(!request()->isAjax()) { //行业类别 $hylb=Db::name('type')->where('type_type',1)->select(); $this->assign('hylb', $hylb); //所属板块 $ssbk=Db::name('type')->where('type_type',54)->find(); $this->assign('ssbk', $ssbk); //地区类型 $dqlx=Db::name('type')->where('type_type',2)->select(); $this->assign('dqlx', $dqlx); //资本额度 $zbed=Db::name('type')->where('type_type',3)->order('type_order')->select(); $this->assign('zbed', $zbed); //公告分类 $gglb=Db::name('type')->where('type_type',55)->select(); $this->assign('gglb', $gglb); //类别 $lb=Db::name('type')->where('type_type',56)->select(); $this->assign('lb', $lb); $gy_time=time(); $this->assign('gy_time', $gy_time); return $this->fetch('gy_add'); }else{ $img_one=''; $picall_url=''; $file = request()->file('pic_one'); $files = request()->file('pic_all'); $validate = config('upload_validate'); //单图 if ($file) { $info = $file[0]->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d')); if ($info) { $img_url = config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename(); //写入数据库 $data['uptime'] = time(); $data['filesize'] = $info->getSize(); $data['path'] = $img_url; Db::name('plug_files')->insert($data); $img_one = $img_url; } else { $this->error($file->getError(), url('admin/Gpgl/gy_list')); } } //多图 if ($files) { foreach ($files as $file) { $info = $file->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d')); if ($info) { $img_url = config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename(); //写入数据库 $data['uptime'] = time(); $data['filesize'] = $info->getSize(); $data['path'] = $img_url; Db::name('plug_files')->insert($data); $picall_url = $img_url . ',' . $picall_url; } else { $this->error($file->getError(), url('admin/Gpgl/gy_list'));//否则就是上传错误,显示错误原因 } } } $ssbk = input('c_ssbk',1,'intval'); $business_type= input('c_business_type',1,'intval'); $qyfzjd = input('c_qyfzjd',1,'intval'); if($ssbk!=1){ $business_type=0; $qyfzjd=0; } $sl_data=array( 'c_name'=>input('c_name'), 'c_project_code'=>input('c_project_code'), 'c_ggxs'=>input('c_ggxs'), 'c_transaction_type'=>input('c_transaction_type'), 'c_bdname'=>input('c_bdname'), 'c_valuation'=>input('c_valuation'), 'c_type'=>input('c_type'), 'c_gpprice'=>input('c_gpprice'), 'c_jcname'=>input('c_jcname',''), 'c_code'=>input('c_code'), 'c_desc'=>input('c_desc'), 'c_homepage'=>input('c_homepage',''), 'c_gptime'=>input('c_gptime','')?strtotime(input('c_gptime','')):time(), 'c_cltime'=>input('c_cltime','')?strtotime(input('c_cltime','')):time(), 'c_status'=>input('c_status',0), 'c_content'=>htmlspecialchars_decode(input('c_content')), 'c_order'=>input('c_order',50,'intval'), 'c_logo'=>$img_one, 'c_pics'=>$picall_url, 'c_time'=>time(), 'c_uid'=>session('admin_auth.aid'), 'c_ssbk'=>input('c_ssbk',1,'intval'), 'c_dqlx'=>input('c_dqlx',1,'intval'), 'c_hylb'=>input('c_hylb',1,'intval'), 'c_zbed'=>input('c_zbed',1,'intval') ); $rst=Db::name('gyxm')->insert($sl_data); if($rst){ $this->success('增加成功',url('admin/Gpgl/gy_list')); }else{ $this->error('增加失败',url('admin/Gpgl/gy_list')); } } } /** * 国有项目修改 */ public function gy_edit() { if(!request()->isAjax()) { $c_id = input('c_id', 0, 'intval'); if (!$c_id) $this->error('参数错误', url('admin/Gpgl/gy_list')); $gp_list = Db::name('gyxm')->where('c_id', $c_id)->find(); $this->assign('gp_list', $gp_list); //多图字符串转换成数组 $pic_list = array_filter(explode(",", $gp_list['c_pics'])); $this->assign('pic_list', $pic_list); //行业类别 $hylb=Db::name('type')->where('type_type',1)->select(); $this->assign('hylb', $hylb); //所属板块 $ssbk=Db::name('type')->where('type_type',54)->select(); $this->assign('ssbk', $ssbk); //地区类型 $dqlx=Db::name('type')->where('type_type',2)->select(); $this->assign('dqlx', $dqlx); //资本额度 $zbed=Db::name('type')->where('type_type',3)->order('type_order')->select(); $this->assign('zbed', $zbed); //公告分类 $gglb=Db::name('type')->where('type_type',55)->select(); $this->assign('gglb', $gglb); //类别 $lb=Db::name('type')->where('type_type',56)->select(); $this->assign('lb', $lb); return $this->fetch('gy_edit'); }else{ $img_one=''; $picall_url=''; $file = request()->file('pic_one'); $files = request()->file('pic_all'); $validate = config('upload_validate'); //单图 if ($file) { $info = $file[0]->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d')); if ($info) { $img_url = config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename(); //写入数据库 $data['uptime'] = time(); $data['filesize'] = $info->getSize(); $data['path'] = $img_url; Db::name('plug_files')->insert($data); $img_one = $img_url; } else { $this->error($file->getError(), url('admin/Gpgl/gy_list')); } } //多图 if ($files) { foreach ($files as $file) { $info = $file->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d')); if ($info) { $img_url = config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename(); //写入数据库 $data['uptime'] = time(); $data['filesize'] = $info->getSize(); $data['path'] = $img_url; Db::name('plug_files')->insert($data); $picall_url = $img_url . ',' . $picall_url; } else { $this->error($file->getError(), url('admin/Gpgl/gy_list'));//否则就是上传错误,显示错误原因 } } } $ssbk = input('c_ssbk',1,'intval'); $business_type= input('c_business_type',1,'intval'); $qyfzjd = input('c_qyfzjd',1,'intval'); if($ssbk!=1){ $business_type=0; $qyfzjd=0; } $sl_data=array( 'c_id'=>input('c_id'), 'c_name'=>input('c_name'), 'c_project_code'=>input('c_project_code'), 'c_ggxs'=>input('c_ggxs'), 'c_transaction_type'=>input('c_transaction_type'), 'c_bdname'=>input('c_bdname'), 'c_valuation'=>input('c_valuation'), 'c_type'=>input('c_type'), 'c_gpprice'=>input('c_gpprice'), 'c_jcname'=>input('c_jcname'), 'c_code'=>input('c_code'), 'c_desc'=>input('c_desc'), 'c_homepage'=>input('c_homepage'), 'c_gptime'=>input('c_gptime','')?strtotime(input('c_gptime','')):time(), 'c_cltime'=>input('c_cltime','')?strtotime(input('c_cltime','')):time(), 'c_status'=>input('c_status',0), 'c_content'=>htmlspecialchars_decode(input('c_content')), 'c_order'=>input('c_order',50,'intval'), 'c_pics'=>$picall_url, 'c_time'=>time(), 'c_uid'=>session('admin_auth.aid'), 'c_ssbk'=>input('c_ssbk',1,'intval'), 'c_dqlx'=>input('c_dqlx',1,'intval'), 'c_hylb'=>input('c_hylb',1,'intval'), 'c_zbed'=>input('c_zbed',1,'intval') ); //图片字段处理 if(!empty($img_one)){ $sl_data['c_logo']=$img_one; } $sl_data['c_pics']=input('pic_oldlist').$picall_url; $rst=Db::name('gyxm')->update($sl_data); if($rst!==false){ $this->success('修改成功',url('admin/Gpgl/gy_list')); }else{ $this->error('修改失败',url('admin/Gpgl/gy_list')); } } } /** * 国有项目状态修改 */ public function gy_state() { $id=input('x'); $status=Db::name('gyxm')->where(array('c_id'=>$id))->value('c_status'); if($status==1){ $statedata = array('c_status'=>0); Db::name('gyxm')->where(array('c_id'=>$id))->setField($statedata); $this->success('状态禁止'); }else{ $statedata = array('c_status'=>1); Db::name('gyxm')->where(array('c_id'=>$id))->setField($statedata); $this->success('状态启用'); } } /** * 国有项排序 */ public function gy_order() { if (!request()->isAjax()){ $this->error('提交方式不正确',url('admin/Gpgl/gy_list')); }else{ foreach (input('post.') as $c_id => $c_order){ Db::name('gyxm')->update(['c_id'=>$c_id,'c_order'=>$c_order]); } $this->success('排序更新成功',url('admin/Gpgl/gy_list')); } } /** * 文化四版挂牌删除(单个) */ public function gy_del() { $p=input('p'); $rst=Db::name('gyxm')->delete(input('c_id')); if($rst!==false){ $this->success('删除成功',url('admin/Gpgl/gy_list',array('p' => $p))); }else{ $this -> error("删除失败!",url('admin/Gpgl/gy_list',array('p'=>$p))); } } /** * 文化四版删除挂牌(全选) */ public function gy_alldel() { $p = input('p'); $ids = input('c_id/a'); if(empty($ids)){ $this -> error("请选择待删除的数据",url('admin/Gpgl/gy_list',array('p'=>$p))); } if(is_array($ids)){ $where = 'c_id in('.implode(',',$ids).')'; }else{ $where = 'c_id='.$ids; } $rst=Db::name('gyxm')->where($where)->delete(); if($rst!==false){ $this->success("删除成功",url('admin/Gpgl/gy_list',array('p'=>$p))); }else{ $this -> error("删除失败!",url('admin/Gpgl/gy_list',array('p'=>$p))); } } /** * 鉴定评估中心检测报告 * @return mixed|string */ public function verify(Request $request){ $search_name=input('search_name',''); $this->assign('search_name',$search_name); $page=$request->param('page'); $db=Db::name('artverify'); if($search_name){ $db->where('name','like','%'.$search_name.'%'); } $gp_list=$db->order('id desc,create_time desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]); $show = $gp_list->render(); $this->assign('page',$page); $this->assign('pageshow',$show); $this->assign('list',$gp_list); return $this->fetch('gpgl/verify'); } public function verify_add(){ if(request()->isAjax()) { $idno=input('idno'); $gpdate=input('gp_date'); $check=Db::name('artverify')->where(['idno'=>$idno])->count(); if($check){ $this->error('此证书编号已存在'); } $sl_data=array( 'name'=>input('name'), 'mobile'=>input('mobile'), 'poster'=>input('poster'), 'ower'=>input('ower'), 'cardno'=>input('cardno'), 'idno'=>$idno, 'reporturl'=>input('reporturl'), 'create_time'=>time(), 'update_time'=>time(), 'status'=>input('status',0), 'gp_date'=>$gpdate?strtotime($gpdate):'' ); $id=Db::name('artverify')->insert($sl_data,false,true); if($id){ if($id){ $url =SITE_PATH.url('/listn/verify',['id'=>$id]); //二维码内容 $qrcode=$this->createqr($url,$idno); $barcode=$this->barcode($idno); Db::name('artverify')->where(['id'=>$id])->update(['qrcode'=>$qrcode,'barcode'=>$barcode]); } $this->success('增加成功',url('admin/Gpgl/verify')); }else{ $this->error('增加失败',url('admin/Gpgl/verify')); } } return $this->fetch('gpgl/verify_add'); } protected function createqr($url,$name){ $errorCorrectionLevel = 'L';//容错级别 $matrixPointSize = 6;//生成图片大小 //生成二维码图片 $file=ROOT_PATH.'extend'.DS.'phpqrcode'.DS.'phpqrcode.php'; include($file); $path=config('upload_path').'/verifyqr/'; $file=$path.$name.'.png'; if(!is_dir('.'.$path))@mkdir('.'.$path,0755,true); $filepath='.'.$file; if(!file_exists($filepath)){ touch($filepath); \QRcode::png($url, '.'.$file, $errorCorrectionLevel, $matrixPointSize, 2); $logo =false;//准备好的logo图片 需要加入到二维码中的logo $QR=$filepath;//已经生成的原始二维码图 $QR = imagecreatefromstring(file_get_contents($QR)); if ($logo !== FALSE) { $logo = imagecreatefromstring(file_get_contents($logo)); $QR_width =imagesx($QR);//二维码图片宽度 $QR_height =imagesy($QR);//二维码图片高度 $logo_width =imagesx($logo);//logo图片宽度 $logo_height =imagesy($logo);//logo图片高度 $logo_qr_width = $QR_width / 5; $scale = $logo_width/$logo_qr_width; $logo_qr_height = $logo_height/$scale; $from_width = ($QR_width - $logo_qr_width) / 2; //重新组合图片并调整大小 imagecopyresampled($QR, $logo, $from_width, $from_width, 0, 0, $logo_qr_width,$logo_qr_height, $logo_width, $logo_height); } //输出图片 imagepng($QR,$filepath); } return $file; } public function verify_edit(){ $id=input('id'); if(request()->isAjax()) { $gpdate=input('gp_date'); $idno=input('idno'); $id=input('id'); $check=Db::name('artverify')->where(['idno'=>$idno,'id'=>['neq',$id]])->count(); if($check){ $this->error('此证书编号已存在'); } $sl_data=array( 'id'=>$id, 'name'=>input('name'), 'mobile'=>input('mobile'), 'poster'=>input('poster'), 'ower'=>input('ower'), 'userid'=>input('userid'), 'cardno'=>input('cardno'), 'idno'=>$idno, 'reporturl'=>input('reporturl'), 'create_time'=>time(), 'update_time'=>time(), 'status'=>input('status',0), 'gp_date'=>$gpdate?strtotime($gpdate):'' ); if($id){ $url =SITE_PATH.url('/listn/verify',['id'=>$id]); //二维码内容 $qrcode=$this->createqr($url,$idno); $barcode=$this->barcode($idno); if($qrcode)$sl_data['qrcode']=$qrcode; if($barcode)$sl_data['barcode']=$barcode; } $rst=Db::name('artverify')->update($sl_data); if($rst){ $this->success('修改成功',url('admin/Gpgl/verify')); }else{ $this->error('修改失败',url('admin/Gpgl/verify')); } }else{ $user_list = Db::query("SELECT member_list_username,member_list_id,member_list_nickname,member_list_tel FROM `".config('database.prefix')."member_list` WHERE member_list_groupid=1 or member_list_groupid=5 order by member_list_id desc"); $this->assign('user_list',$user_list); $gp_list = Db::name('artverify')->where('id', $id)->find(); $this->assign('item', $gp_list); } return $this->fetch('gpgl/verify_edit'); } /** * 文化四版挂牌删除(单个) */ public function verify_del() { $rst=Db::name('artverify')->delete(input('id')); if($rst!==false){ $this->success('删除成功',url('admin/Gpgl/verify')); }else{ $this -> error("删除失败!",url('admin/Gpgl/verify')); } } private function barcode($sn){ include ROOT_PATH.'/extend/Barcode.php'; $path=config('upload_path').'/verifyqr/'; $file=$path.$sn.'_barcode.png'; if(!is_dir('.'.$path))@mkdir('.'.$path,0755,true); $filepath='.'.$file; if(!file_exists($filepath)){ \Barcode::code39($sn,$filepath); } return $file; } }