作者 Cool
1 个管道 的构建 通过 耗费 10 秒

接口优化调试

... ... @@ -49,6 +49,8 @@ class Common extends Api
*/
public function upload()
{
set_time_limit(0);
ini_set('memory_limit','512M');
Config::set('default_return_type', 'json');
$config = get_addon_config('qiniu');
... ...
... ... @@ -323,7 +323,7 @@ class Index extends Api
->order('is_up asc')
->select();
$tree = Tree::instance();
$tree->init(Db::name('folder')->select(), 'pid');
$tree->init(Db::name('folder')->where('user_id',$user_id)->select(), 'pid');
foreach ($data as &$v){
$list = $tree->getChildrenIds($v['id'],true);
$is_have = Db::name('rotor')
... ... @@ -448,19 +448,19 @@ class Index extends Api
$fenlei = $this->request->param('fenlei');
if($fenlei == 1){
$note = $this->myfile(1,$where);
$rotor = $this->zhuan(1,$tiao);
$rotor = $this->zhuan(1,$tiao,1);
$arr = $this->gong(1,$note,$rotor);
$Info['note'] = $this->sundry($arr);
$this->success('success',$Info);
}elseif ($fenlei == 2){
$pic = $this->myfile(2,$where);
$rotor_pic = $this->zhuan(2,$tiao);
$rotor_pic = $this->zhuan(2,$tiao,1);
$arr_pic = $this->gong(2,$pic,$rotor_pic);
$Info['pic'] = $this->sundry($arr_pic);
$this->success('success',$Info);
}elseif ($fenlei == 3){
$video = $this->myfile(3,$where);
$rotor_video = $this->zhuan(3,$tiao);
$rotor_video = $this->zhuan(3,$tiao,1);
$arr_video = $this->gong(3,$video,$rotor_video);
$Info['video'] = $this->sundry($arr_video);
$this->success('success',$Info);
... ... @@ -838,7 +838,7 @@ class Index extends Api
$tiao['a.user_id'] = ['eq',$user_id];
$tiao['b.is_up'] = 1;
$myfile = $this->myfile($type_id,$where);
$zhuan = $this->zhuan($type_id,$tiao);
$zhuan = $this->zhuan($type_id,$tiao,1);
$gong = $this->gong($type_id,$myfile,$zhuan);
$sundry = $this->sundry($gong);
$this->success('success',$sundry);
... ... @@ -1748,6 +1748,7 @@ class Index extends Api
->where('a.user_id',$user_id)
->where('b.type',2)
->where('a.folder_id',$folder_id)
->where('b.is_up',1)
->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){
... ...