...
|
...
|
@@ -261,11 +261,11 @@ class Index extends Api |
|
|
}
|
|
|
|
|
|
//自己的笔记文件
|
|
|
$note = $this->myfile(1,$where,$user_id);
|
|
|
$note = $this->myfile(1,$where);
|
|
|
//自己的图片文件
|
|
|
$pic = $this->myfile(2,$where,$user_id);
|
|
|
$pic = $this->myfile(2,$where);
|
|
|
//自己的视频文件
|
|
|
$video = $this->myfile(3,$where,$user_id);
|
|
|
$video = $this->myfile(3,$where);
|
|
|
|
|
|
//转存的笔记文件
|
|
|
$rotor = $this->zhuan(1,$tiao);
|
...
|
...
|
@@ -288,6 +288,154 @@ class Index extends Api |
|
|
$this->success('success',$Info);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @ApiTitle (他人主页)
|
|
|
* @ApiSummary (他人主页)
|
|
|
* @ApiMethod (POST)
|
|
|
* @ApiRoute (/api/index/other)
|
|
|
*
|
|
|
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
|
|
|
* @ApiParams (name="user_id", type="inter", required=true, description="他人用户id")
|
|
|
*
|
|
|
* @ApiReturn({
|
|
|
"code": 1,
|
|
|
"msg": "成功",
|
|
|
"time": "1571492001",
|
|
|
"data": {
|
|
|
"is_real": //是否本人打开1是2否,
|
|
|
"url"://分享地址
|
|
|
"folder": [
|
|
|
{
|
|
|
"id": //文件夹id,
|
|
|
"user_id": //用户id,
|
|
|
"folder_name": //文件夹名称,
|
|
|
"is_open": //是否公开1公开2私密
|
|
|
"is_up": //1上架2下架
|
|
|
"createtime": //日期,
|
|
|
"is_have": //是否有转存文件1有2没有
|
|
|
"nowtime": //文件创建时间
|
|
|
}
|
|
|
],
|
|
|
"other": {
|
|
|
"oneself": [
|
|
|
{
|
|
|
"id": //文件id,
|
|
|
"user_id": //用户id,
|
|
|
"type": //文件类型1笔记2图片3视频,
|
|
|
"name": //文件名称,
|
|
|
"images": //图片地址,
|
|
|
"video": //视频地址,
|
|
|
"content": //笔记内容,
|
|
|
"is_open": //是否公开1公开2私密,
|
|
|
"is_up": //是否上架1上架2下架,
|
|
|
"createtime": //创建时间
|
|
|
}
|
|
|
],
|
|
|
"dump": [
|
|
|
{
|
|
|
"id": //转存记录id,
|
|
|
"dump_user_id": //转存人id,
|
|
|
"savemes_id": //文件名称,
|
|
|
"createtime": //创建时间,
|
|
|
"type": //类型1笔记2图片3视频,
|
|
|
"name": //文件名,
|
|
|
"images": //图片地址,
|
|
|
"video": //视频地址,
|
|
|
"content": //笔记内容,
|
|
|
"is_open": //是否公开1公开2私密,
|
|
|
"is_up": //是否上架1上架2下架
|
|
|
}
|
|
|
]
|
|
|
}
|
|
|
})
|
|
|
*/
|
|
|
public function other()
|
|
|
{
|
|
|
$user_id = $this->request->param('user_id');
|
|
|
if(empty($user_id)){
|
|
|
$this->error('缺少必要参数');
|
|
|
}
|
|
|
|
|
|
//文件夹
|
|
|
$data['folder'] = Db::name('folder')
|
|
|
->field('updatetime,pid',true)
|
|
|
->where('user_id',$user_id)
|
|
|
->where('pid',0)
|
|
|
->where('is_up',1)
|
|
|
->order('is_up asc')
|
|
|
->select();
|
|
|
$tree = Tree::instance();
|
|
|
$tree->init(Db::name('folder')->select(), 'pid');
|
|
|
foreach ($data['folder'] as &$v){
|
|
|
$v['url'] = request()->domain().'/index/index/filedetail/user_id/'.$v['user_id'].'/file_id/'.$v['id'];
|
|
|
$list = $tree->getChildrenIds($v['id'],true);
|
|
|
$is_have = Db::name('rotor')
|
|
|
->where('user_id',$user_id)
|
|
|
->whereIn('folder_id',$list)
|
|
|
->find();
|
|
|
if(empty($is_have)){
|
|
|
$v['is_have'] = 2;
|
|
|
}else{
|
|
|
$v['is_have'] = 1;
|
|
|
}
|
|
|
$v['nowtime'] = date('Y-m-d',$v['createtime']);
|
|
|
$v['createtime'] = date('m-d',$v['createtime']);
|
|
|
}
|
|
|
$times = array_values(array_unique(array_column($data,'createtime')));
|
|
|
rsort($times);
|
|
|
//将数据放到对应的时间分段
|
|
|
$arrs = [];
|
|
|
foreach ($times as $t_k=> $t_v){
|
|
|
$arrs[$t_k]['times'] = $t_v;
|
|
|
$k = 0;
|
|
|
foreach ($data['folder'] as $value){
|
|
|
$k+=0;
|
|
|
if($t_v == $value['createtime']){
|
|
|
$arrs[$t_k]['info'][$k] = $value;
|
|
|
$k++;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
$where['is_up'] = 1;
|
|
|
$where['user_id'] = $user_id;
|
|
|
$where['folder_id'] = 0;
|
|
|
|
|
|
$tiao['b.is_up'] = 1;
|
|
|
$tiao['a.folder_id'] = 0;
|
|
|
$tiao['a.user_id'] = $user_id;
|
|
|
|
|
|
//自己的笔记文件
|
|
|
$note = $this->myfile(1,$where);
|
|
|
//自己的图片文件
|
|
|
$pic = $this->myfile(2,$where);
|
|
|
//自己的视频文件
|
|
|
$video = $this->myfile(3,$where);
|
|
|
|
|
|
//转存的笔记文件
|
|
|
$rotor = $this->zhuan(1,$tiao);
|
|
|
//转存的图片文件
|
|
|
$rotor_pic = $this->zhuan(2,$tiao);
|
|
|
//转存的视频文件
|
|
|
$rotor_video = $this->zhuan(3,$tiao);
|
|
|
|
|
|
//笔记
|
|
|
$arr = $this->gong(1,$note,$rotor);
|
|
|
//图片
|
|
|
$arr_pic = $this->gong(2,$pic,$rotor_pic);
|
|
|
//视频
|
|
|
$arr_video = $this->gong(3,$video,$rotor_video);
|
|
|
|
|
|
|
|
|
$Info['note'] = $this->sundry($arr);
|
|
|
$Info['pic'] = $this->sundry($arr_pic);
|
|
|
$Info['video'] = $this->sundry($arr_video);
|
|
|
$this->success('success',$Info);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//通过传入类型获取我自己的不同文件
|
|
|
public function myfile($type,$where){
|
|
|
$data = Db::name('savemes')
|
...
|
...
|
|