WIN-2308041133\Administrator 8 months ago
parent
commit
304e1ee897
1 changed files with 27 additions and 12 deletions
  1. 27 12
      application/api/controller/Platform.php

+ 27 - 12
application/api/controller/Platform.php

@@ -118,9 +118,9 @@ class Platform extends Api
     }
 //    检查过期版权,并扣除贡献值
     public function past_copyright(){
-         Db::startTrans();
-         try {
-        $list = model('VideoShare')->where('endtime','<',time())->where('type',2)->select();
+//         Db::startTrans();
+//         try {
+        $list = model('VideoShare')->where('endtime','<',time())->where('type',2)->where('expire',0)->select();
         if($list) {
             foreach ($list as $k => $v) {
                 @file_put_contents("quanju.txt", json_encode($v) . "-要扣除的版权\r\n", 8);
@@ -152,22 +152,37 @@ class Platform extends Api
                     $user_contribution = $user['share']+$v['num'];
                     @file_put_contents("quanju.txt", $user_contribution . "-修改后版权\r\n", 8);
                     $res2 = model('Videolist')->where('id',$v['vid'])->update(['share'=>$user_contribution]);
+                    $res3 = model('VideoShare')->where('id',$v['id'])->update(['expire'=>1]);  //修改为已过期
                 }
             }
         }
-             // 提交事务
-             Db::commit();
-         } catch (\Exception $e) {
-             // 回滚事务
-             var_dump($e);
-             Db::rollback();
-         }
+//             // 提交事务
+//             Db::commit();
+//         } catch (\Exception $e) {
+//             // 回滚事务
+//             var_dump($e);
+//             Db::rollback();
+//         }
         $this->success('检查完成');
     }
 //    每日分红
     public function dividend_day(){
-//        获取所有短剧列表
-        $list = model('video_user')->where('')->select();
+//        获取所有用户贡献值列表
+//        $list = model('video_user')->select();
+        $list = model('video_user')->where('contribution','>',0)->column('vid');
+        var_dump($list);die();
+// 获取当前时间
+        $now = time();
+// 获取昨天的日期
+        $yesterday = strtotime("-1 day", $now);
+// 昨天的0点时间戳
+        $yesterdayStart = strtotime("00:00:00", $yesterday);
+        $yesterdayEnd = strtotime("12:59:59", $yesterday);
+        if($list) {
+            foreach ($list as $k => $v) {
+
+            }
+        }
 //        统计该短剧的总版版权数量以及持有版权的用户列表
 
 //        获取昨天该短剧的收益数据