WIN-2308041133\Administrator 8 months ago
parent
commit
7c6e90c9d0
1 changed files with 9 additions and 0 deletions
  1. 9 0
      application/api/controller/Platform.php

+ 9 - 0
application/api/controller/Platform.php

@@ -118,6 +118,8 @@ class Platform extends Api
     }
 //    检查过期版权,并扣除贡献值
     public function past_copyright(){
+         Db::startTrans();
+         try {
         $list = model('VideoShare')->where('endtime','<',time())->where('type',2)->select();
         if($list) {
             foreach ($list as $k => $v) {
@@ -146,6 +148,13 @@ class Platform extends Api
                 }
             }
         }
+             // 提交事务
+             Db::commit();
+         } catch (\Exception $e) {
+             // 回滚事务
+             var_dump($e);
+             Db::rollback();
+         }
         $this->success('检查完成');
     }
 //    每日分红