WIN-2308041133\Administrator 8 months ago
parent
commit
96bceca947

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

@@ -86,16 +86,18 @@ class Platform extends Api
 //  每日分配各个短剧在不同平台的收益
     public function platform_income_day(){
 //        先获取所有短剧在不同平台的收益上下限
-        $list = model('VideoPlatform')->select()->toArray();
-        foreach ($list as $k => $v){
-            $randomNumber = mt_rand($v['min'] * 100, $v['max'] * 100) / 100;
-            $up=[
-                'vid'=>$v['vid'],
-                'platform_id'=>$v['platform_id'],
-                'num'=>$randomNumber,
-                'createtime'=>time(),
-            ];
-            $id=Db::name('task')->insertGetId($up);
+        $list = model('VideoPlatform')->select();
+        if($list) {
+            foreach ($list as $k => $v) {
+                $randomNumber = mt_rand($v['min'] * 100, $v['max'] * 100) / 100;
+                $up = [
+                    'vid' => $v['vid'],
+                    'platform_id' => $v['platform_id'],
+                    'num' => $randomNumber,
+                    'createtime' => time(),
+                ];
+                $id = Db::name('task')->insertGetId($up);
+            }
         }
         $this->success('分配完成');
     }

+ 1 - 1
application/common/model/videoplatformrecord.php → application/common/model/VideoPlatformRecord.php

@@ -7,7 +7,7 @@ use think\Model;
 /**
  * 会员模型
  */
-class videoplatformrecord extends Model
+class videoPlatformRecord extends Model
 {
     // 表名
     protected $name = 'video_platform_record