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

修改详情接口

@@ -729,6 +729,20 @@ class User extends Api @@ -729,6 +729,20 @@ class User extends Api
729 $data['vip_price'] = $data['price'] * 0.75; 729 $data['vip_price'] = $data['price'] * 0.75;
730 $data['thumbnail'] = $rule.$data['thumbnail']; 730 $data['thumbnail'] = $rule.$data['thumbnail'];
731 $data['is_vip'] = 0; 731 $data['is_vip'] = 0;
  732 +
  733 +
  734 + //我已经购买过的视频
  735 + $video_buy = Db::name('iphone')
  736 + ->where('user_id',$uid)
  737 + ->where('status',2)
  738 + ->column('pic_id');
  739 + if(in_array($pic_id,$video_buy)){
  740 + $data['is_buy'] = 1;
  741 + }else{
  742 + $data['is_buy'] = 2;
  743 + }
  744 +
  745 +
732 $this->success('SUCCESS',$data); 746 $this->success('SUCCESS',$data);
733 }elseif($res['is_vip'] == 1){ 747 }elseif($res['is_vip'] == 1){
734 $pic_id = $this->request->post('pic_id'); 748 $pic_id = $this->request->post('pic_id');
@@ -785,6 +799,16 @@ class User extends Api @@ -785,6 +799,16 @@ class User extends Api
785 $data['water_url'] = request()->domain().$data['thumbnail']; 799 $data['water_url'] = request()->domain().$data['thumbnail'];
786 $data['vip_price'] = $data['price'] * 0.75; 800 $data['vip_price'] = $data['price'] * 0.75;
787 $data['thumbnail'] = $rule.$data['thumbnail']; 801 $data['thumbnail'] = $rule.$data['thumbnail'];
  802 + //我已经购买过的视频
  803 + $video_buy = Db::name('iphone')
  804 + ->where('user_id',$uid)
  805 + ->where('status',2)
  806 + ->column('pic_id');
  807 + if(in_array($pic_id,$video_buy)){
  808 + $data['is_buy'] = 1;
  809 + }else{
  810 + $data['is_buy'] = 2;
  811 + }
788 $this->success('SUCCESS',$data); 812 $this->success('SUCCESS',$data);
789 } 813 }
790 } 814 }
@@ -889,6 +913,23 @@ class User extends Api @@ -889,6 +913,23 @@ class User extends Api
889 unset($data['content'][$k]); 913 unset($data['content'][$k]);
890 } 914 }
891 } 915 }
  916 +
  917 + //我已经购买过的视频
  918 + $video_buy = Db::name('iphone')
  919 + ->where('user_id',$uid)
  920 + ->where('status',2)
  921 + ->field('video_id')
  922 + ->select();
  923 + foreach ($video_buy as &$v){
  924 + if(!empty($v['video_id'])){
  925 + $v['video_id'] = unserialize($v['video_id']);
  926 + if ($pic_id == $v['video_id']['id']){
  927 + $data['is_buy'] = 1;
  928 + }else{
  929 + $data['is_buy'] = 2;
  930 + }
  931 + }
  932 + }
892 $this->success('SUCCESS',$data); 933 $this->success('SUCCESS',$data);
893 }elseif($res['is_vip'] == 1){ 934 }elseif($res['is_vip'] == 1){
894 $pic_id = $this->request->post('video_id'); 935 $pic_id = $this->request->post('video_id');
@@ -945,6 +986,22 @@ class User extends Api @@ -945,6 +986,22 @@ class User extends Api
945 unset($data['content'][$k]); 986 unset($data['content'][$k]);
946 } 987 }
947 } 988 }
  989 + //我已经购买过的视频
  990 + $video_buy = Db::name('iphone')
  991 + ->where('user_id',$uid)
  992 + ->where('status',2)
  993 + ->field('video_id')
  994 + ->select();
  995 + foreach ($video_buy as &$v){
  996 + if(!empty($v['video_id'])){
  997 + $v['video_id'] = unserialize($v['video_id']);
  998 + if ($pic_id == $v['video_id']['id']){
  999 + $data['is_buy'] = 1;
  1000 + }else{
  1001 + $data['is_buy'] = 2;
  1002 + }
  1003 + }
  1004 + }
948 $this->success('SUCCESS',$data); 1005 $this->success('SUCCESS',$data);
949 } 1006 }
950 } 1007 }