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

添加白名单

@@ -418,18 +418,122 @@ class Index extends Api @@ -418,18 +418,122 @@ class Index extends Api
418 418
419 //自己的笔记文件 419 //自己的笔记文件
420 $note = $this->myfile(1,$where); 420 $note = $this->myfile(1,$where);
  421 +
  422 + foreach ($note as &$v){
  423 + $user_info = Db::name('user')->where('id',$v['user_id'])->find();
  424 + if($v['user_id'] == $user_id){
  425 + $v['is_white'] = 1;
  426 + }else{
  427 + if(empty($user_info['whiteip_ids'])){
  428 + $v['is_white'] = 2;
  429 + }else{
  430 + $whiteip_ids = explode(',',$user_info['whiteip_ids']);
  431 + if(in_array($user_id,$whiteip_ids)){
  432 + $v['is_white'] = 1;
  433 + }else{
  434 + $v['is_white'] = 2;
  435 + }
  436 + }
  437 + }
  438 + }
  439 +
421 //自己的图片文件 440 //自己的图片文件
422 $pic = $this->myfile(2,$where); 441 $pic = $this->myfile(2,$where);
  442 + foreach ($pic as &$v){
  443 + $user_info = Db::name('user')->where('id',$v['user_id'])->find();
  444 + if($v['user_id'] == $user_id){
  445 + $v['is_white'] = 1;
  446 + }else{
  447 + if(empty($user_info['whiteip_ids'])){
  448 + $v['is_white'] = 2;
  449 + }else{
  450 + $whiteip_ids = explode(',',$user_info['whiteip_ids']);
  451 + if(in_array($user_id,$whiteip_ids)){
  452 + $v['is_white'] = 1;
  453 + }else{
  454 + $v['is_white'] = 2;
  455 + }
  456 + }
  457 + }
  458 + }
423 //自己的视频文件 459 //自己的视频文件
424 $video = $this->myfile(3,$where); 460 $video = $this->myfile(3,$where);
  461 + foreach ($video as &$v){
  462 + $user_info = Db::name('user')->where('id',$v['user_id'])->find();
  463 + if($v['user_id'] == $user_id){
  464 + $v['is_white'] = 1;
  465 + }else{
  466 + if(empty($user_info['whiteip_ids'])){
  467 + $v['is_white'] = 2;
  468 + }else{
  469 + $whiteip_ids = explode(',',$user_info['whiteip_ids']);
  470 + if(in_array($user_id,$whiteip_ids)){
  471 + $v['is_white'] = 1;
  472 + }else{
  473 + $v['is_white'] = 2;
  474 + }
  475 + }
  476 + }
  477 + }
  478 +
425 479
426 //转存的笔记文件 480 //转存的笔记文件
427 $rotor = $this->zhuan(1,$tiao); 481 $rotor = $this->zhuan(1,$tiao);
  482 + foreach ($rotor as &$v){
  483 + $user_info = Db::name('user')->where('id',$v['user_id'])->find();
  484 + if($v['user_id'] == $user_id){
  485 + $v['is_white'] = 1;
  486 + }else{
  487 + if(empty($user_info['whiteip_ids'])){
  488 + $v['is_white'] = 2;
  489 + }else{
  490 + $whiteip_ids = explode(',',$user_info['whiteip_ids']);
  491 + if(in_array($user_id,$whiteip_ids)){
  492 + $v['is_white'] = 1;
  493 + }else{
  494 + $v['is_white'] = 2;
  495 + }
  496 + }
  497 + }
  498 + }
428 //转存的图片文件 499 //转存的图片文件
429 $rotor_pic = $this->zhuan(2,$tiao); 500 $rotor_pic = $this->zhuan(2,$tiao);
  501 + foreach ($rotor_pic as &$v){
  502 + $user_info = Db::name('user')->where('id',$v['user_id'])->find();
  503 + if($v['user_id'] == $user_id){
  504 + $v['is_white'] = 1;
  505 + }else{
  506 + if(empty($user_info['whiteip_ids'])){
  507 + $v['is_white'] = 2;
  508 + }else{
  509 + $whiteip_ids = explode(',',$user_info['whiteip_ids']);
  510 + if(in_array($user_id,$whiteip_ids)){
  511 + $v['is_white'] = 1;
  512 + }else{
  513 + $v['is_white'] = 2;
  514 + }
  515 + }
  516 + }
  517 + }
430 //转存的视频文件 518 //转存的视频文件
431 $rotor_video = $this->zhuan(3,$tiao); 519 $rotor_video = $this->zhuan(3,$tiao);
432 - 520 + foreach ($rotor_video as &$v){
  521 + $user_info = Db::name('user')->where('id',$v['user_id'])->find();
  522 + if($v['user_id'] == $user_id){
  523 + $v['is_white'] = 1;
  524 + }else{
  525 + if(empty($user_info['whiteip_ids'])){
  526 + $v['is_white'] = 2;
  527 + }else{
  528 + $whiteip_ids = explode(',',$user_info['whiteip_ids']);
  529 + if(in_array($user_id,$whiteip_ids)){
  530 + $v['is_white'] = 1;
  531 + }else{
  532 + $v['is_white'] = 2;
  533 + }
  534 + }
  535 + }
  536 + }
433 //笔记 537 //笔记
434 $arr = $this->gong(1,$note,$rotor); 538 $arr = $this->gong(1,$note,$rotor);
435 //图片 539 //图片