why.xingtongworld.com项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

252 lines
9.5 KiB

<?php
namespace app\mobile\controller;
use think\Db;
use app\mobile\model\Bigdata as Bdata;
use app\mobile\controller\Base;
class Bigdata extends Base{
public function detail(){
$id=input('c_id','','intval');
$token=request()->token();
$list=db('bigdata')->where(['c_id'=>$id])->find();
if(!$list){
$this->error('该纪录不存在',url('bigdata/category'));
}
db('bigdata')->where(['c_id'=>$id])->setInc('c_click');
$this->assign('title','数据超市');
$states=[1=>'复制权','发行权','出租权','展览权','改编权','表演权','放映权','广播','摄制权','翻译权','汇编权','信息网络传播权'];
$right=$list['c_right'];
$rights=explode(',',$right);
$rigtxt='';
if(count($rights)){
foreach ($rights as $r){
$rigtxt.=isset($states[$r])?$states[$r].'、':'';
}
}
$list['c_right']=rtrim($rigtxt,'、');
$sother=$list['c_sother'];
$states2=[1=>'软件开发','文化数字内容服务','互联网生活服务平台','可穿戴智能设备制造','广播影视节目制作','文化娱乐休闲服务','玩具制造','动漫游戏','教育','服装','其他'];
$scene=$list['c_scene'];
$scenes=explode(',',$scene);
$scenetxt='';
if(count($scenes)){
foreach ($scenes as $r){
if($r==11){
$stxt=isset($states2[$r])?$states2[$r]:'';
if($sother)$stxt.='('.$sother.')';
$scenetxt.=$stxt.'、';
}else{
$scenetxt.=isset($states2[$r])?$states2[$r].'、':'';
}
}
}
$list['c_scene']=rtrim($scenetxt,'、');
try {
$childs=json_decode($list['c_childs'],true);
if(count($childs)){
foreach ($childs as $k=>$c){
$item=array();
$child=json_decode($c,true);
foreach ($child as $j){
$js=explode("=", $j);
$item[$js[0]]=$js[1];
}
$childs[$k]=$item;
}
}
$list['c_childs']=$childs;
} catch (\Exception $e) {
$list['c_childs']=array();
}
$relates=Db::name('bigdata')->where(['c_status'=>1,'c_seller'=>$list['c_seller'],'c_id'=>['neq',$list['c_id']]])->order('c_order desc,c_id desc')->limit(4)->select();
$this->assign('relates',$relates);
$this->assign('id',$id);
$this->assign('list',$list);
$curren_title=$list['c_name'];
$appId='wxa0cb14dc087a5d99';
$appSecret='fe3853cbea525e10a9e704d1428fe357';
$link=rtrim(SITE_PATH,'/').url('bigdata/detail',['c_id'=>$id]);
$jssdk=new \weixin\Jssdk($appId, $appSecret);
$signPackage = $jssdk->GetSignPackage($link);
$this->assign('signPackage',$signPackage);
if($list['c_logo']&&file_exists('.'.ltrim($list['c_logo'],'.'))){
$img=rtrim(SITE_PATH,'/').ltrim($list['c_logo'],'.');
}else{
$img=SITE_PATH.'app/mobile/view/szwjs/public/img/logo.png';
}
$link=RemoveXSS($link);
$path=request()->domain();
$share=array();
$share['title']=$curren_title;
$share['desc']=$curren_title;
$share['link']=$link;
$share['imgUrl']=isset($list['n_img'])&&$list['n_img']?$path.$list['n_img']:$img;
$this->assign('share',$share);
$appId='wxa0cb14dc087a5d99';
$appSecret='fe3853cbea525e10a9e704d1428fe357';
$this->assign('site_seo_title',$curren_title);
$this->assign('site_seo_keywords',$curren_title);
$this->assign('site_seo_description',$curren_title);
return $this->view->fetch();
}
public function category(){
$verpage=8;
$keyword=input("keyword");
$cseller=input("c_seller");
$cpay=input("c_pay",'');
$ctype=input("c_type",'');
$order='c_hot desc,c_order desc,c_id desc';
$db=Db::name('bigdata')->where(array('c_status'=>1));
if(!empty($cpay)&&$cpay!=0){
$db->where(array('c_pay'=>$cpay));
}
if(!empty($ctype)&&$ctype!=0){
$db->where(array('c_type'=>$ctype));
}
if(!empty($keyword)){
$db->where('c_name|c_code|c_seller','like','%'.$keyword.'%');
}
if($cseller){
$db->where('c_seller','like','%'.$cseller.'%');
}
$products=$db->order($order)->paginate($verpage,false,['query'=>get_query()]);
$ciklist=array();
if($products){
$prolist=$products->toArray();
if(count($prolist['data'])){
foreach ($prolist['data'] as $h){
$click=intval($h['c_click'])+1;
array_push($ciklist,array('c_id'=>$h['c_id'],'c_click'=>$click));
}
if(count($ciklist)){
$model=new Bdata();
$model->saveAll($ciklist);
}
}
}
$page=input('page',1);
$tpage=1;
if(count($products)){
$tpage=$products->lastPage();
}
$this->assign('totalpage',$tpage);
$this->assign('curpage',$page);
$show = $products->render();
$this->assign('keyword',$keyword);
$this->assign('cseller',$cseller);
$this->assign('ctype',$ctype);
$this->assign('cpay',$cpay);
$this->assign('products',$products);
$this->assign('show',$show);
$hots=Db::name('bigdata')->where(['c_status'=>1,'c_hot'=>1])->order('c_order desc,c_id desc')->limit(3)->select();
$this->assign('hots',$hots);
$ciklist=array();
if(count($hots)){
foreach ($hots as $h){
$click=intval($h['c_click'])+1;
array_push($ciklist,array('c_id'=>$h['c_id'],'c_click'=>$click));
}
if(count($ciklist)){
$model=new Bdata();
$model->saveAll($ciklist);
}
}
$hot1=Db::name('bigdata')->where(['c_status'=>1,'c_type'=>1,'c_hot'=>1])->order('c_click desc,c_id desc')->limit(8)->select();
$this->assign('hot1',$hot1);
$ciklist=array();
if(count($hot1)){
foreach ($hot1 as $h){
$click=intval($h['c_click'])+1;
array_push($ciklist,array('c_id'=>$h['c_id'],'c_click'=>$click));
}
if(count($ciklist)){
$model=new Bdata();
$model->saveAll($ciklist);
}
}
$cllist1=Db::name('bigdata')->where(['c_status'=>1,'c_type'=>1])->order('c_click desc,c_id desc')->limit(8)->select();
$this->assign('cllist1',$cllist1);
$ciklist=array();
if(count($cllist1)){
foreach ($cllist1 as $h){
$click=intval($h['c_click'])+1;
array_push($ciklist,array('c_id'=>$h['c_id'],'c_click'=>$click));
}
if(count($ciklist)){
$model=new Bdata();
$model->saveAll($ciklist);
}
}
$hot2=Db::name('bigdata')->where(['c_status'=>1,'c_type'=>2,'c_hot'=>1])->order('c_click desc,c_id desc')->limit(8)->select();
$this->assign('hot2',$hot2);
$ciklist=array();
if(count($hot2)){
foreach ($hot2 as $h){
$click=intval($h['c_click'])+1;
array_push($ciklist,array('c_id'=>$h['c_id'],'c_click'=>$click));
}
if(count($ciklist)){
$model=new Bdata();
$model->saveAll($ciklist);
}
}
$cllist2=Db::name('bigdata')->where(['c_status'=>1,'c_type'=>2])->order('c_click desc,c_id desc')->limit(8)->select();
$this->assign('cllist2',$cllist2);
$ciklist=array();
if(count($cllist2)){
foreach ($cllist2 as $h){
$click=intval($h['c_click'])+1;
array_push($ciklist,array('c_id'=>$h['c_id'],'c_click'=>$click));
}
if(count($ciklist)){
$model=new Bdata();
$model->saveAll($ciklist);
}
}
$curren_title="数据超市-深圳文化产权交易所";
$appId='wxa0cb14dc087a5d99';
$appSecret='fe3853cbea525e10a9e704d1428fe357';
$link=rtrim(SITE_PATH,'/').url('bigdata/category');
$jssdk=new \weixin\Jssdk($appId, $appSecret);
$signPackage = $jssdk->GetSignPackage($link);
$this->assign('signPackage',$signPackage);
$img=SITE_PATH.'app/mobile/view/szwjs/public/img/logo.png';
$link=RemoveXSS($link);
$path=request()->domain();
$share=array();
$share['title']=$curren_title;
$share['desc']=$curren_title;
$share['link']=$link;
$share['imgUrl']=$img;
$this->assign('share',$share);
return $this->view->fetch();
}
public function index(){
$banners=Db::name('link')->where(['lk_status'=>1,'lk_cid'=>21])->order('lk_order asc,lk_id asc')->select();
$this->assign('banners',$banners);
$list= Db::name('bigdata')->where(['c_status'=>1])->order('c_order desc,c_id desc')->paginate(10);
$show = $list->render();
$this->assign("list",$list);
$this->assign("show",$show);
return $this->view->fetch();
}
}