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

新增是否购买接口

... ... @@ -913,24 +913,6 @@ class User extends Api
unset($data['content'][$k]);
}
}
//我已经购买过的视频
$video_buy = Db::name('iphone')
->where('user_id',$uid)
->where('status',2)
->field('video_id')
->select();
foreach ($video_buy as &$v){
if(!empty($v['video_id'])){
$v['video_id'] = unserialize($v['video_id']);
if ($pic_id == $v['video_id']['id']){
$data['is_buy'] = 1;
}else{
$data['is_buy'] = 2;
}
}
}
$this->success('SUCCESS',$data);
}elseif($res['is_vip'] == 1){
$pic_id = $this->request->post('video_id');
if(empty($pic_id)){
... ... @@ -986,24 +968,52 @@ class User extends Api
unset($data['content'][$k]);
}
}
//我已经购买过的视频
$video_buy = Db::name('iphone')
->where('user_id',$uid)
->where('status',2)
->field('video_id')
->select();
foreach ($video_buy as &$v){
if(!empty($v['video_id'])){
$v['video_id'] = unserialize($v['video_id']);
if ($pic_id == $v['video_id']['id']){
$data['is_buy'] = 1;
}else{
$data['is_buy'] = 2;
}
$this->success('SUCCESS',$data);
}
}
/**
* @ApiTitle (是否购买过)
* @ApiSummary (是否购买过)
* @ApiMethod (POST)
* @ApiRoute (/api/user/videodetail)
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
*
* @ApiParams (name="video_id", type="inter", required=true, description="视频ID")
* @ApiParams (name="attr", type="inter", required=true, description="视频属性")
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1571492001",
"data": {
"is_buy"://是否购买过1购买过2没有
}
})
*/
public function is_buy()
{
$user_id = $this->uid;
$video['video_id'] = $this->request->param('video_id');
$video['attr'] = $this->request->param('attr');
//我已经购买过的视频
$video_buy = Db::name('iphone')
->where('user_id',$user_id)
->where('status',2)
->field('video_id')
->select();
foreach ($video_buy as &$v){
if(!empty($v['video_id'])){
$v['video_id'] = unserialize($v['video_id']);
if ($video == $v['video_id']){
$data['is_buy'] = 1;
}else{
$data['is_buy'] = 2;
}
}
$this->success('SUCCESS',$data);
}
$this->success('SUCCESS',$data);
}
/**
... ...
此 diff 太大无法显示。