|
|
@@ -129,7 +129,11 @@ class Platform extends Api
|
|
|
// 要过期的版权数量也就是贡献值数量
|
|
|
$share = $video_user['share']-$v['num']; // 扣除版权
|
|
|
$contribution = $video_user['contribution']-$v['num']; //扣除贡献值
|
|
|
- $res1 = model('VideoUser')->where('uid',$v['uid'])->where('vid',$v['vid'])->update(['share'=>$share,'contribution'=>$contribution]);
|
|
|
+ if ($share <= 0&&$contribution<=0){
|
|
|
+ $res1 = model('VideoUser')->where('uid',$v['uid'])->where('vid',$v['vid'])->delete();
|
|
|
+ }else{
|
|
|
+ $res1 = model('VideoUser')->where('uid',$v['uid'])->where('vid',$v['vid'])->update(['share'=>$share,'contribution'=>$contribution]);
|
|
|
+ }
|
|
|
// 保存扣除记录
|
|
|
$up = [
|
|
|
'vid' => $v['vid'],
|
|
|
@@ -152,7 +156,7 @@ class Platform extends Api
|
|
|
Db::commit();
|
|
|
} catch (\Exception $e) {
|
|
|
// 回滚事务
|
|
|
- var_dump($e);
|
|
|
+// var_dump($e);
|
|
|
Db::rollback();
|
|
|
}
|
|
|
$this->success('检查完成');
|