WIN-2308041133\Administrator 7 tháng trước cách đây
mục cha
commit
e7fc245992
1 tập tin đã thay đổi với 13 bổ sung1 xóa
  1. 13 1
      application/api/controller/Pay.php

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

@@ -818,7 +818,19 @@ class Pay extends Api
                     //写入日志
                     MoneyLog::create(['user_id' => $user_id, 'money' => $money, 'before' => $before, 'after' => $after, 'memo' => '用户消费']);
                     Db::name('video_share')->where('id', $id)->update(['type' => 2, 'paytype' => '余额', 'pay_time' => time()]);
-
+                    $video_user = Db::name('video_user')->where('uid', $user_id)->where('vid', $data['vid'])->find();
+                    if (empty($video_user)){ //判断用户是否购买过该视频版权
+                        $up = [
+                            'vid' => $data['vid'],
+                            'vname' => $data['vname'],
+                            'uid' => $data['uid'],
+                            'share' => $data['num'],
+                            'contribution' => $data['num'],
+                            'income' => 0,
+                            'createtime' => time(),
+                        ];
+                        $id = Db::name('VideoUser')->insertGetId($up);
+                    }
 
                     $this->share_record($id);//添加贡献值记录
                     $this->yongjin($id, $user_id, $money, '级消费佣金结算');//佣金结算