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

修改接口

... ... @@ -998,7 +998,7 @@ class User extends Api
$video['attr'] = $this->request->param('attr');
$a = serialize($video);
//我已经购买过的视频
$video_buy = Db::name('iphone')
->where('user_id',$user_id)
... ... @@ -1799,22 +1799,14 @@ class User extends Api
$where['status'] = ['eq',2];
if(!empty($video['id']) && !empty($video['attr'])){
$video_s = serialize($video);
//查看该图片或者该视频属性是否已经购买过
$res = Db::name('iphone')
->where($where)
->field('video_id')
->select();
foreach ($res as &$v){
$v['video_id'] = unserialize($v['video_id']);
if(!empty($v['video_id']) && !empty($video)){
foreach ($v['video_id'] as $v1){
foreach ($video as &$v2){
if($v1['id'] == $v2['id'] && $v1['attr'] == $v2['attr']){
$this->error(['code'=>2,'msg'=>'该属性的视频已经购买过了','video_id'=>$v2['id']]);
}
}
}
}
->where('video_id',$video_s)
->find();
if(!empty($res)){
$this->error(['code'=>2,'msg'=>'该属性的视频已经购买过了']);
}
$param['video_id'] = serialize($video);
}else{
... ...