正在显示
2 个修改的文件
包含
43 行增加
和
33 行删除
@@ -913,24 +913,6 @@ class User extends Api | @@ -913,24 +913,6 @@ class User extends Api | ||
913 | unset($data['content'][$k]); | 913 | unset($data['content'][$k]); |
914 | } | 914 | } |
915 | } | 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 | - } | ||
933 | - $this->success('SUCCESS',$data); | ||
934 | }elseif($res['is_vip'] == 1){ | 916 | }elseif($res['is_vip'] == 1){ |
935 | $pic_id = $this->request->post('video_id'); | 917 | $pic_id = $this->request->post('video_id'); |
936 | if(empty($pic_id)){ | 918 | if(empty($pic_id)){ |
@@ -986,24 +968,52 @@ class User extends Api | @@ -986,24 +968,52 @@ class User extends Api | ||
986 | unset($data['content'][$k]); | 968 | unset($data['content'][$k]); |
987 | } | 969 | } |
988 | } | 970 | } |
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 | - } | 971 | + $this->success('SUCCESS',$data); |
972 | + } | ||
973 | + } | ||
974 | + | ||
975 | + /** | ||
976 | + * @ApiTitle (是否购买过) | ||
977 | + * @ApiSummary (是否购买过) | ||
978 | + * @ApiMethod (POST) | ||
979 | + * @ApiRoute (/api/user/videodetail) | ||
980 | + * @ApiHeaders (name=token, type=string, required=true, description="请求的Token") | ||
981 | + * | ||
982 | + * @ApiParams (name="video_id", type="inter", required=true, description="视频ID") | ||
983 | + * @ApiParams (name="attr", type="inter", required=true, description="视频属性") | ||
984 | + * @ApiReturn({ | ||
985 | + "code": 1, | ||
986 | + "msg": "成功", | ||
987 | + "time": "1571492001", | ||
988 | + "data": { | ||
989 | + "is_buy"://是否购买过1购买过2没有 | ||
990 | + } | ||
991 | + }) | ||
992 | + */ | ||
993 | + public function is_buy() | ||
994 | + { | ||
995 | + $user_id = $this->uid; | ||
996 | + | ||
997 | + $video['video_id'] = $this->request->param('video_id'); | ||
998 | + $video['attr'] = $this->request->param('attr'); | ||
999 | + | ||
1000 | + //我已经购买过的视频 | ||
1001 | + $video_buy = Db::name('iphone') | ||
1002 | + ->where('user_id',$user_id) | ||
1003 | + ->where('status',2) | ||
1004 | + ->field('video_id') | ||
1005 | + ->select(); | ||
1006 | + foreach ($video_buy as &$v){ | ||
1007 | + if(!empty($v['video_id'])){ | ||
1008 | + $v['video_id'] = unserialize($v['video_id']); | ||
1009 | + if ($video == $v['video_id']){ | ||
1010 | + $data['is_buy'] = 1; | ||
1011 | + }else{ | ||
1012 | + $data['is_buy'] = 2; | ||
1003 | } | 1013 | } |
1004 | } | 1014 | } |
1005 | - $this->success('SUCCESS',$data); | ||
1006 | } | 1015 | } |
1016 | + $this->success('SUCCESS',$data); | ||
1007 | } | 1017 | } |
1008 | 1018 | ||
1009 | /** | 1019 | /** |
此 diff 太大无法显示。
-
请 注册 或 登录 后发表评论