...
|
...
|
@@ -91,7 +91,62 @@ class Index extends Frontend |
|
|
$user_id = $this->request->param('user_id');
|
|
|
$file_id = $this->request->param('file_id');
|
|
|
|
|
|
//文件夹
|
|
|
$folder = Db::name('folder')
|
|
|
->where('pid',$file_id)
|
|
|
->where('is_up',1)
|
|
|
->select();
|
|
|
|
|
|
foreach ($folder as &$v){
|
|
|
$v['createtime'] = date('Y-m-d',$v['createtime']);
|
|
|
}
|
|
|
$times = array_values(array_unique(array_column($folder,'createtime')));
|
|
|
//将数据放到对应的时间分段
|
|
|
$arrs = [];
|
|
|
foreach ($times as $t_k=> $t_v){
|
|
|
$arrs[$t_k]['times'] = $t_v;
|
|
|
$k = 0;
|
|
|
foreach ($folder as $value){
|
|
|
$k+=0;
|
|
|
if($t_v == $value['createtime']){
|
|
|
$arrs[$t_k]['info'][$k] = $value;
|
|
|
$k++;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
$data['folder'] = $arrs;
|
|
|
|
|
|
|
|
|
//笔记
|
|
|
$note['folder_id'] = ['eq',$file_id];
|
|
|
$note['is_up'] = ['eq',1];
|
|
|
$z_tiao['a.folder_id'] = ['eq',$file_id];
|
|
|
$z_tiao['b.is_up'] = ['eq',1];
|
|
|
$note = $this->myfile(1,$note);
|
|
|
$zhuan_note = $this->zhuan(1,$z_tiao);
|
|
|
$gong = $this->gong(1,$note,$zhuan_note);
|
|
|
$data['note'] = $this->sundry($gong);
|
|
|
|
|
|
//图片
|
|
|
$pic['folder_id'] = ['eq',$file_id];
|
|
|
$pic_tiao['a.folder_id'] = ['eq',$file_id];
|
|
|
$pic = $this->myfile(2,$pic);
|
|
|
$zhuan_pic = $this->zhuan(2,$pic_tiao);
|
|
|
$gong1 = $this->gong(2,$pic,$zhuan_pic);
|
|
|
$data['pic'] = $this->sundry($gong1);
|
|
|
|
|
|
//视频
|
|
|
$video['folder_id'] = ['eq',$file_id];
|
|
|
$video_tiao['a.folder_id'] = ['eq',$file_id];
|
|
|
$video = $this->myfile(3,$video);
|
|
|
$zhuan_video = $this->zhuan(3,$video_tiao);
|
|
|
$gong2 = $this->gong(3,$video,$zhuan_video);
|
|
|
$data['video'] = $this->sundry($gong2);
|
|
|
|
|
|
|
|
|
$text = Db::name('official')->where('id',1)->find();
|
|
|
$data['introduce'] = $text['introduce'];
|
|
|
$this->assign('data',$data);
|
|
|
return $this->fetch();
|
|
|
}
|
|
|
|
...
|
...
|
@@ -105,4 +160,99 @@ class Index extends Frontend |
|
|
}
|
|
|
return $video_url.'?vframe/jpg/offset/1/w/'.$width.'/h/'.$height;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//通过传入类型获取我自己的不同文件
|
|
|
public function myfile($type,$where){
|
|
|
$data = Db::name('savemes')
|
|
|
->where($where)
|
|
|
->where('type',$type)
|
|
|
->field('id,user_id,type,name,share_url,images,video,content,is_open,is_up,createtime')
|
|
|
->order('createtime desc')
|
|
|
->select();
|
|
|
return $data;
|
|
|
}
|
|
|
//通过传入类型获取转存的不同文件
|
|
|
public function zhuan($type,$tiao){
|
|
|
$rotor = Db::name('rotor')
|
|
|
->alias('a')
|
|
|
->join('savemes b','a.savemes_id = b.id')
|
|
|
->field('a.id,a.user_id as unloading_user_id,a.savemes_id,a.folder_id,b.user_id,b.share_url,b.name,b.type,b.images,b.video,b.content,b.is_open,b.is_up,a.createtime')
|
|
|
->where('b.type',$type)
|
|
|
->where($tiao)
|
|
|
->order('a.createtime desc')
|
|
|
->select();
|
|
|
return $rotor;
|
|
|
}
|
|
|
|
|
|
//各种类型的文件 转存以及自己的文件
|
|
|
public function gong($type,$arr1,$arr2){
|
|
|
$qiniu = get_addon_config('qiniu')['cdnurl'];
|
|
|
if(!empty($arr2)){
|
|
|
foreach ($arr2 as &$v_1){
|
|
|
$v_1['is_zhuan'] = 1;
|
|
|
$v_1['is_real'] = 2;
|
|
|
}
|
|
|
$arr = array_merge($arr1,$arr2);
|
|
|
}else{
|
|
|
$arr = $arr1;
|
|
|
}
|
|
|
|
|
|
//笔记类型
|
|
|
if($type == 1){
|
|
|
foreach ($arr as &$v){
|
|
|
$v['nowtime'] = date('Y-m-d',$v['createtime']);
|
|
|
$v['createtime'] = date('m-d',$v['createtime']);
|
|
|
$v['images'] = '';
|
|
|
$v['video'] = '';
|
|
|
$v['video_image'] = '';
|
|
|
}
|
|
|
} elseif ($type == 2){
|
|
|
//图片类型
|
|
|
foreach ($arr as &$v){
|
|
|
$v['nowtime'] = date('Y-m-d',$v['createtime']);
|
|
|
$v['createtime'] = date('m-d',$v['createtime']);
|
|
|
$v['images'] = $qiniu.$v['images'];
|
|
|
$v['video'] = '';
|
|
|
$v['video_image'] = '';
|
|
|
$v['content'] = '';
|
|
|
}
|
|
|
}elseif ($type == 3){
|
|
|
//视频类型
|
|
|
foreach ($arr as &$v){
|
|
|
$v['nowtime'] = date('Y-m-d',$v['createtime']);
|
|
|
$v['createtime'] = date('m-d',$v['createtime']);
|
|
|
$v['video'] = $qiniu.$v['video'];
|
|
|
// 获取视频第一帧图片
|
|
|
$video_info = json_decode(file_get_contents($v['video'] . '?avinfo'), true);
|
|
|
$v['video_image'] = $this->get_video_first_image($v['video'], $video_info);
|
|
|
$v['images'] = '';
|
|
|
$v['content'] = '';
|
|
|
}
|
|
|
}
|
|
|
return $arr;
|
|
|
}
|
|
|
|
|
|
|
|
|
//合并完数据按时间分段
|
|
|
public function sundry($arr){
|
|
|
$times = array_values(array_unique(array_column($arr,'createtime')));
|
|
|
//将数据放到对应的时间分段
|
|
|
$arrs = [];
|
|
|
foreach ($times as $t_k=> $t_v){
|
|
|
$arrs[$t_k]['times'] = $t_v;
|
|
|
$k = 0;
|
|
|
foreach ($arr as $value){
|
|
|
$k+=0;
|
|
|
if($t_v == $value['createtime']){
|
|
|
$arrs[$t_k]['info'][$k] = $value;
|
|
|
$k++;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return $arrs;
|
|
|
|
|
|
}
|
|
|
} |
...
|
...
|
|