WIN-2308041133\Administrator 7 meses atrás
pai
commit
baf9c1796a
1 arquivos alterados com 12 adições e 1 exclusões
  1. 12 1
      application/api/controller/Pay.php

+ 12 - 1
application/api/controller/Pay.php

@@ -722,10 +722,21 @@ class Pay extends Api
                 $user = Db::name('user')->where('id', $user['pid'])->find();  //上级用户信息
                 $grade = $user['grade'];
                 $video_user = Db::name('video_user')->where('uid', $user['id'])->where('vid', $order['vid'])->find();
+                if (empty($video_user)){ //如果上级没有购买过该视频版权
+                    $up = [
+                        'vid' => $order['vid'],
+                        'vname' => $order['vname'],
+                        'uid' => $user['id'],
+                        'share' => 0,
+                        'contribution' => 0,
+                        'income' => 0,
+                        'createtime' => time(),
+                    ];
+                    $id = Db::name('VideoUser')->insertGetId($up);  //添加用户版权
+                }
                 $contribution = 0;
                 $check = 0;
 //                $sell = $video_user['sell'] + $order['num'];
-                var_dump($user);die();
                 $sell = $user['sell'] + $order['num'];
 //                switch ($video_user['grade']) {
                 switch ($user['grade']) {