作者 郭盛
1 个管道 的构建 通过 耗费 9 秒

修改接口

... ... @@ -1089,6 +1089,182 @@ class Index extends Api
}
/**
* @ApiTitle (通过文件夹id获取图片列表)
* @ApiSummary (通过文件夹id获取图片列表)
* @ApiMethod (POST)
* @ApiRoute (/api/index/get_list)
*
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
* @ApiParams (name="folder_id", type="inter", required=true, description="文件夹id")
*
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1571492001",
"data": {
"folder": [
{
"times": "2020-08-13",
"info": [
{
"id": 26,
"folder_name": "20200813203909",
"is_up": 1,
"user_id": 3,
"leavel": 2,
"createtime": "2020-08-13",
"share_url": "http://cloud.w.brotop.cn/index/index/filedetail/user_id/3/file_id/26",
"is_open": 1,
"is_real": 1,
"is_white": 1
"is_subscribe"://是否订阅 1订阅2未订阅
}
]
}
],
"note": [
{
"times": "08-12",
"info": [
{
"id": 73,
"user_id": 3,
"type": 1,
"name": "20200812173653",
"share_url": null,
"images": "",
"video": "",
"content": "<p>哦哦婆婆送😊1名摸摸摸看了看家具都做摸摸摸摸摸摸可口可乐了酷兔兔突突突</p>",
"is_open": 1,
"is_up": 1,
"createtime": "08-12",
"is_white": 1,
"is_real": 1,
"is_zhuan": 2,
"nowtime": "2020-08-12",
"video_image": ""
}
]
}
],
"pic": [
{
"times": "08-12",
"info": [
{
"id": 66,
"user_id": 3,
"type": 2,
"name": "20200812173523",
"share_url": null,
"images": "http://cloud.caiyunpan.brotop.cn/uploads/20200812/b72563f3b0e1c610fea2b5fec5c04211.png",
"video": "",
"content": "",
"is_open": 1,
"is_up": 1,
"createtime": "08-12",
"is_white": 1,
"is_real": 1,
"is_zhuan": 2,
"nowtime": "2020-08-12",
"video_image": ""
},
]
}
],
"video": [
{
"times": //时间,
"info": [
{
"id": //id,
"user_id": 3,
"type": 3,
"name": "20200812173616",
"share_url": null,
"images": "",
"video": "http://cloud.caiyunpan.brotop.cn/uploads/20200812/edadf76bea6ce8c58b6ad9a8a2d88e4a.mp4",
"content": "",
"is_open": 1,
"is_up": 1,
"createtime": "08-12",
"is_white": 1,
"is_real": 1,
"is_zhuan": 2,
"nowtime": "2020-08-12",
"video_image": "http://cloud.caiyunpan.brotop.cn/uploads/20200812/edadf76bea6ce8c58b6ad9a8a2d88e4a.mp4?vframe/jpg/offset/1/w/720/h/1280"
},
]
}
]
}
})
*/
public function get_list()
{
$user_id = $this->auth->id;
$folder_id = $this->request->param('folder_id');
if(empty($folder_id)){
$this->error('缺少必要参数');
}
//自己的图片文件
$data = Db::name('savemes')
->where('user_id',$user_id)
->where('type',2)
->where('folder_id',$folder_id)
->select();
foreach ($data as &$v){
$v['is_zhuan'] = 2;
if($v['is_open'] == 2){
$user_info = Db::name('user')->where('id',$v['user_id'])->field('id,whiteip_ids')->find();
if(empty($user_info['whiteip_ids'])){
$v['is_white'] = 2;
}else{
$user_info['whiteip_ids'] = explode(',',$user_info['whiteip_ids']);
if(in_array($user_id,$user_info['whiteip_ids'])){
$v['is_white'] = 1;
}else{
$v['is_white'] = 2;
}
}
}
}
//自己转存的图片文件
$rotor = Db::name('rotor')
->alias('a')
->join('savemes b','a.savemes_id = b.id')
->where('a.user_id',$user_id)
->where('b.type',2)
->field('a.id as zhuan_id,a.savemes_id,a.user_id as zhuan_user_id,a.folder_id as zhuan_folder_id,b.id,b.user_id,b.type,b.folder_id,b.name,b.images,b.is_open,b.is_up,b.share_url,b.collect_num')
->select();
foreach ($rotor as &$v){
$v['is_zhuan'] = 1;
if($v['is_open'] == 2){
$user_info = Db::name('user')->where('id',$v['user_id'])->field('id,whiteip_ids')->find();
if(empty($user_info['whiteip_ids'])){
$v['is_white'] = 2;
}else{
$user_info['whiteip_ids'] = explode(',',$user_info['whiteip_ids']);
if(in_array($user_id,$user_info['whiteip_ids'])){
$v['is_white'] = 1;
}else{
$v['is_white'] = 2;
}
}
}
}
$res = array_merge($data,$rotor);
$this->success('success',$res);
}
/**
* @ApiTitle (广告图)
... ...
此 diff 太大无法显示。