// +---------------------------------------------------------------------- namespace app\mobile\controller; use think\Db; class Index extends Base { public function video(){ $cid=input('cid',1); $this->assign('cid',$cid); return $this->view->fetch(); } /** * 艺术资产托管申请 */ public function subscription(){ $params=request()->param(); $query=$this->_checksub($params); if($query)$this->success('提交成功'); else $this->error('提交失败'); } /** * 检查是否允许托管 * @return string */ public function tg_check() { if(!session('hid')) return json(['code'=>0,'msg'=>'未登录','url'=>url('Login/index',['jump'=>urlencode(url('activity/index'))])]); return json(['code'=>1,'url'=>url('activity/index')]); } /** * 检查是否允许留言 * @return string */ public function fb_check() { if(!session('hid')) return json(['code'=>0,'msg'=>'未登录','url'=>url('Login/index',['jump'=>urlencode(url('Center/feedback'))])]); return json(['code'=>1,'url'=>url('Center/feedback')]); } public function index() { $kind=4; $childs=config("tuoguan.childs"); $parents=config('tuoguan.parents'); $state=input('state','','intval'); $states=[1=>['name'=>'预披露'],2=>['name'=>'正式披露'],['name'=>'成交公示'],['name'=>'艺术资产转让']]; $page=input('page',1); $mprice=input('mprice'); $sprice=input('sprice'); if($mprice)$mprice=intval($mprice); if($sprice)$sprice=intval($sprice); $keyword=input('keyword',''); $cid=input('cid','','intval'); $kid=input('kid','','intval'); $showtype=input('showtype',0,'intval'); $yearsort=input('yearsort','asc'); $pricesort=input('pricesort','asc'); $timesort=input('timesort','asc'); if(!in_array($yearsort,['asc','desc']))$yearsort='asc'; if(!in_array($pricesort,['asc','desc']))$pricesort='asc'; if(!in_array($timesort,['asc','desc']))$timesort='asc'; $this->assign('yearsort',$yearsort); $this->assign('pricesort',$pricesort); $this->assign('timesort',$timesort); $this->assign('showtype',$showtype); $this->assign('page',$page); $this->assign('keyword',$keyword); $this->assign('mprice',$mprice); $this->assign('sprice',$sprice); $this->assign('state',$state); if($cid||$state){ if($state){ $categorys=[]; $where=['c_status'=>1,'c_kind'=>$kind]; $where['c_state']=$state; $stateslist=[1=>'预披露','正式披露','成交公示','艺术资产转让']; $parent=isset($stateslist[$state])?$stateslist[$state]:''; foreach ($states as $k=>$v){ if($k!=$state)unset($states[$k]); } }else{ $categorys=isset($childs[$cid])?$childs[$cid]:[]; $where=['c_status'=>1,'c_kind'=>$kind]; $where['c_parent']=array('like',[$cid.',%','%,'.$cid.'%',$cid],'OR'); foreach ($categorys as $k=>$v){ $where['c_child']=array('like',[$k.',%','%,'.$k.'%',$k],'OR'); $check=Db::name('finance')->where($where)->count(); if($check==0)unset($categorys[$k]); } if(isset($where['c_cid']))unset($where['c_cid']); if(isset($where['c_child']))unset($where['c_child']); $parent=isset($parents[$cid])?$parents[$cid]:''; } $this->assign('categorys',$categorys); if($kid){ $where['c_child']=array('like',[$kid.',%','%,'.$kid.'%',$kid],'OR'); } $db=Db::name('finance')->where($where); if($keyword){ $db->where('c_name|c_code|c_content','like','%'.$keyword.'%'); } if($mprice){ $db->where('c_price','<=',$mprice); } if($sprice){ $db->where('c_price','>=',$sprice); } $order=[]; $order['c_year']=$yearsort; $order['c_price']=$pricesort; $order['c_time']=$timesort; $order['c_order']='desc'; $products=$db->order($order)->paginate(15,false,['query'=>get_query()]); $show = $products->render(); if($products){ $products=$products->toArray(); $products=$products['data']; foreach ($products as $k=>$item){ if($item['c_jump']){ if(strpos(strtolower($item['c_jump']),'http')===false){ $products[$k]['c_jump']='http://'.$item['c_jump']; } } $products[$k]['c_name']=$this->replaceTitle($item['c_name']); $products[$k]['c_content']=$this->replaceTitle($item['c_content']); } } $this->assign('parent',$parent); $this->assign('products',$products); $this->assign('show',$show); }else{ $list=[]; if(count($states)){ $where=['c_status'=>1,'c_kind'=>$kind]; foreach ($states as $id=>$item){ if($id==1){ unset($states[$id]); continue; } $where['c_state']=$id; $db=Db::name('finance')->where($where); $products=$db->order('c_order desc,c_time desc')->limit(5)->select(); foreach ($products as $k=>$item){ if($item['c_jump']){ if(strpos(strtolower($item['c_jump']),'http')===false){ $products[$k]['c_jump']='http://'.$item['c_jump']; } } $products[$k]['c_name']=$this->replaceTitle($item['c_name']); $products[$k]['c_content']=$this->replaceTitle($item['c_content']); } $states[$id]['products']=$products; } } if($kind==4&&$cid==''){ $row=[]; $id=11; $row['id']=$id; $row['name']=$parents[$id]; $childrow=isset($childs[$id])?$childs[$id]:[]; $row['has']=count($childrow)?1:0; if(count($childrow)){ foreach ($childrow as $k=>$v){ $where['c_child']=array('like',[$k.',%','%,'.$k.'%',$k],'OR'); $check=Db::name('finance')->where($where)->count(); if($check==0)unset($childrow[$k]); } } $row['childs']=$childrow; $where=['c_status'=>1,'c_kind'=>$kind]; $where['c_parent']=array('like',[$id.',%','%,'.$id.'%',$id],'OR'); $db=Db::name('finance')->where($where)->order('c_order desc,c_time desc'); if($keyword){ $db->where('c_name|c_code','like','%'.$keyword.'%'); } $products=$db->limit(10)->select(); foreach ($products as $k=>$item){ if($item['c_jump']){ if(strpos(strtolower($item['c_jump']),'http')===false){ $products[$k]['c_jump']='http://'.$item['c_jump']; } } $products[$k]['c_name']=$this->replaceTitle($item['c_name']); $products[$k]['c_content']=$this->replaceTitle($item['c_content']); } $row['products']=$products; array_push($list, $row); $row=[]; $row['id']='all'; $row['name']="专区"; $childrow=[]; $parentrow=[]; foreach ($parents as $k=>$jow){ if($k>4&&$k<11){ $childrow[$k]=$jow; }else if($k>11){ $parentrow[$k]=$jow; } } if(count($childrow)){ foreach ($childrow as $k=>$v){ $where['c_parent']=array('like',[$k.',%','%,'.$k.'%',$k],'OR'); $check=Db::name('finance')->where($where)->count(); if($check==0)unset($childrow[$k]); } } $row['has']=count($childrow)?1:0; $row['childs']=$childrow; $where=['c_status'=>1,'c_kind'=>$kind]; $where['c_parent']=array('<>',10); $db=Db::name('finance')->where($where)->order('c_order desc,c_time desc'); if($keyword){ $db->where('c_name|c_code','like','%'.$keyword.'%'); } $products=$db->limit(10)->select(); foreach ($products as $k=>$item){ if($item['c_jump']){ if(strpos(strtolower($item['c_jump']),'http')===false){ $products[$k]['c_jump']='http://'.$item['c_jump']; } } $products[$k]['c_name']=$this->replaceTitle($item['c_name']); $products[$k]['c_content']=$this->replaceTitle($item['c_content']); $cparent=$item['c_parent']; $cparent=explode(",",$cparent); $products[$k]['c_parent']=count($cparent)?$cparent[0]:''; } $row['products']=$products; array_push($list, $row); foreach ($parentrow as $k=>$item){ $id=$k; $row=[]; $row['id']=$id; $row['name']=$item; $childrow=isset($childs[$id])?$childs[$id]:[]; $row['has']=count($childrow)?1:0; if(count($childrow)){ foreach ($childrow as $k=>$v){ $where['c_child']=array('like',[$k.',%','%,'.$k.'%',$k],'OR'); $check=Db::name('finance')->where($where)->count(); if($check==0)unset($childrow[$k]); } } $row['childs']=$childrow; $where=['c_status'=>1,'c_kind'=>$kind]; $where['c_parent']=array('like',[$id.',%','%,'.$id.'%',$id],'OR'); $db=Db::name('finance')->where($where)->order('c_order desc,c_time desc'); if($keyword){ $db->where('c_name|c_code','like','%'.$keyword.'%'); } $products=$db->limit(10)->select(); foreach ($products as $k=>$item){ if($item['c_jump']){ if(strpos(strtolower($item['c_jump']),'http')===false){ $products[$k]['c_jump']='http://'.$item['c_jump']; } } $products[$k]['c_name']=$this->replaceTitle($item['c_name']); $products[$k]['c_content']=$this->replaceTitle($item['c_content']); } $row['products']=$products; array_push($list, $row); } $this->assign('menulist',$list); }else{ if($kind==4&&$cid==0){ foreach ($parents as $k=>$item){ if($k<5||$k>10){unset($parents[$k]);} } } foreach ($parents as $id=>$item){ $row=[]; $row['id']=$id; $row['name']=$item; $childrow=isset($childs[$id])?$childs[$id]:[]; $row['has']=count($childrow)?1:0; $where=['c_status'=>1,'c_kind'=>$kind]; $where['c_parent']=array('like',[$id.',%','%,'.$id.'%',$id],'OR'); if(count($childrow)){ foreach ($childrow as $k=>$v){ $where['c_child']=array('like',[$k.',%','%,'.$k.'%',$k],'OR'); $check=Db::name('finance')->where($where)->count(); if($check==0)unset($childrow[$k]); } if(isset($where['c_cid']))unset($where['c_cid']); if(isset($where['c_child']))unset($where['c_child']); } $row['childs']=$childrow; $db=Db::name('finance')->where($where)->order('c_order desc,c_time desc'); if($keyword){ $db->where('c_name|c_code','like','%'.$keyword.'%'); } $products=$db->limit(10)->select(); foreach ($products as $k=>$item){ if($item['c_jump']){ if(strpos(strtolower($item['c_jump']),'http')===false){ $products[$k]['c_jump']='http://'.$item['c_jump']; } } $products[$k]['c_name']=$this->replaceTitle($item['c_name']); $products[$k]['c_content']=$this->replaceTitle($item['c_content']); } $row['products']=$products; array_push($list, $row); } } if($kind==4&&$cid==0){ $this->assign('menulist',$list); } $this->assign('list',$list); } $this->assign('states',$states); $this->assign('childs',$childs); $this->assign('parents',$parents); $this->assign('keyword',$keyword); $this->assign('kind',$kind); $this->assign('cid',$cid); $this->assign('kid',$kid); $banners=Db::name('link')->where(['lk_status'=>1,'lk_cid'=>15])->order('lk_order desc')->select(); $this->assign('banners',$banners); return $this->view->fetch(); } protected function replaceTitle($title=""){ $keys=["唐","唐代","宋","北宋","南宋","宋-元","元","元代","金","金代","清","元-明","明","明代","大明万历年制款","清中期","清同治","清康熙","清嘉庆","清光绪","宋金","元末明初","清中期","大清雍正年制款","大清乾隆年制款","清末","清初", "元-明初","南北朝","明永乐","明宣德","明成化","明崇祯","明晚清初","民国","宋代","金(或元)","雍正年制款","大清","乾隆年制款","中和堂(款)","金元","乾隆御制","明代弘治年制","清代","大清雍正","大清同治年制款", "明早期","宣德","崇祯","新石器时代","春秋-战国","战国-汉","汉","汉代","古汉代","西汉","东汉","清代乾隆款","乾隆","北魏","明末","清末","唐-五代","明以前","康熙款", "商代","洪武","南","商周","年制","大年制","南","万历","康熙","嘉靖","雍正","光绪","(大年制楷书款)","万历",",光绪(康熙款)","北,","内府",",万历",",雍正",",康熙",",嘉靖", "春秋战国","五代","战国","永乐","大弘治","正德","大正德","枢府","老玉","中期","早期","明,","(清)","元·","(元)","东","古玉","宋·","金(或元)·","清乾隆·","明永乐·","明万历·", "南宋·","北宋·","“大清光绪”","(早期)","(清光绪款)","柜台面议"]; arsort($keys); $title=str_replace($keys,"",$title); return $title; } public function search(){ $cid=input('cid','','intval'); $this->assign('cid',$cid); $kid=input('kid','','intval'); $this->assign('kid',$kid); $banners=Db::name('link')->where(['lk_status'=>1,'lk_cid'=>15])->order('lk_order desc')->select(); $this->assign('banners',$banners); $kind=input('kind','','intval'); $page=input('page',1); $mprice=input('mprice'); $sprice=input('sprice'); if($sprice){ $sprice=str_replace(',', '', $sprice); $sprice=intval($sprice); } if($mprice){ $mprice=str_replace(',', '', $mprice); $mprice=intval($mprice); } $keyword=input('keyword',''); $showtype=input('showtype',0,'intval'); $yearsort=input('yearsort','asc'); $pricesort=input('pricesort','asc'); $timesort=input('timesort','desc'); if(!in_array($yearsort,['asc','desc']))$yearsort='asc'; if(!in_array($pricesort,['asc','desc']))$pricesort='asc'; if(!in_array($timesort,['asc','desc']))$timesort='desc'; $this->assign('yearsort',$yearsort); $this->assign('pricesort',$pricesort); $this->assign('timesort',$timesort); $this->assign('showtype',$showtype); $this->assign('page',$page); $this->assign('keyword',$keyword); $this->assign('mprice',$mprice); $this->assign('sprice',$sprice); $this->assign('kind',$kind); if($keyword)$keyword=$this->replaceTitle($keyword); $where=['c_status'=>1,'c_kind'=>$kind]; $db=Db::name('finance')->where($where); if($keyword){ $db->where('c_name|c_code|c_content','like','%'.$keyword.'%'); } if($mprice){ $db->where('convert(`c_price`,SIGNED)<='.$mprice); } if($sprice){ $db->where('convert(`c_price`,SIGNED)>='.$sprice); } $order=['c_order'=>'desc','c_time'=>$timesort]; if($kind==4){ $db->order("c_year ".$yearsort); } $query=$db->order("c_price+0 ".$pricesort); if($kind==4){ $order=[]; $order['c_time']=$timesort; $order['c_order']='desc'; } $query=$query->order($order); $products=$query->paginate(20,false,['query'=>get_query(),'type'=>'bootstrap','var_page' =>'page']); $show = $products->render(); if($products){ $products=$products->toArray(); $products=$products['data']; foreach ($products as $k=>$item){ if($item['c_jump']){ if(strpos(strtolower($item['c_jump']),'http')===false){ $products[$k]['c_jump']='http://'.$item['c_jump']; } } $products[$k]['c_name']=$this->replaceTitle($item['c_name']); $products[$k]['c_content']=$this->replaceTitle($item['c_content']); } } $this->assign('products',$products); $this->assign('show',$show); return $this->view->fetch(); } public function finance(){ $c_id=input('c_id',0,'intval'); $cid=input('cid',0,'intval'); $c_kind=input('kind',0,'intval'); $c_type=input('parent','','intval'); $c_state=input('state','','intval'); $title='文化金融'; if($c_kind>3)$title='艺术金融'; $this->assign('title',$title); $list=Db::name('finance')->where(['c_status'=>1,'c_id'=>$c_id])->find(); $childs=config("tuoguan.childs"); $showtypes=config("tuoguan.parents"); if(empty($c_type)){ $parents=explode(',',$list['c_parent']); if(count($parents)){ $c_type=array_pop($parents); } } $pic_list = array_filter(explode(",", $list['c_photos'])); $list['photos']=$pic_list; if(empty($c_type)){ $parents=explode(',',$list['c_parent']); if(count($parents)){ $c_type=array_pop($parents); } } $parent=isset($showtypes[$c_type])?$showtypes[$c_type]:''; if($c_state){ $states=[1=>'预披露','正式披露','成交公示','艺术资产转让']; $parent=isset($states[$c_state])?$states[$c_state]:''; } $this->assign('c_parent',$c_type); $this->assign('kind',$c_kind); $this->assign('parent',$parent); $this->assign('list',$list); $this->assign('state',$c_state); $this->assign('cid',$cid); return $this->view->fetch(); } }