WIN-2308041133\Administrator 8 months ago
parent
commit
3a5edc4aaf
1 changed files with 6 additions and 2 deletions
  1. 6 2
      application/api/controller/Platform.php

+ 6 - 2
application/api/controller/Platform.php

@@ -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('检查完成');