WIN-2308041133\Administrator 8 months ago
parent
commit
a676177547

+ 28 - 4
application/api/controller/Platform.php

@@ -60,7 +60,7 @@ class Platform extends Api
         $data = ['config' => $config, 'doctor' => $list,'total'=>$total,'count' => $count];
         $this->success('请求成功', $data);
     }
-    public function user_share_count($uid){
+    public function user_share_count($uid){  // 统计用户各个短剧的版权数量
         $map = []; // 初始化$map数组,避免未定义时的错误
         $map['uid'] = $uid;
         $count = model('VideoShare')
@@ -70,10 +70,34 @@ class Platform extends Api
             ->select();
         return $count;
     }
-//    每个短剧更具贡献值分红
-    public function dividend(){
+//    查看各平台的收益情况
+    public function platform_income(){
+        $map = []; // 初始化$map数组,避免未定义时的错误
+        if(input('uid', 0) > 0){
+            // 明确指定uid所属的表(假设主表为video_share)
+            $map['video_share.uid'] = input('uid');
+        }
+        if(input('vid', 0) > 0){
+            // 明确指定uid所属的表(假设主表为video_share)
+            $map['video_share.vid'] = input('vid');
+        }
 
     }
-
+//  每日分配各个短剧在不同平台的收益
+    public function platform_income_day(){
+//        先获取所有短剧在不同平台的收益上下限
+        $list = model('VideoPlatform')->select();
+        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('分配完成');
+    }
 
 }

+ 30 - 0
application/common/model/videoplatformrecord.php

@@ -0,0 +1,30 @@
+<?php
+
+namespace app\common\model;
+
+use think\Model;
+
+/**
+ * 会员模型
+ */
+class videoplatformrecord extends Model
+{
+    // 表名
+    protected $name = 'video_platform_record
+';
+    // 开启自动写入时间戳字段
+    protected $autoWriteTimestamp = 'int';
+    // 定义时间戳字段名
+    protected $createTime = 'createtime';
+    // 追加属性
+    protected $append = [];
+
+    public function videolist()
+    {
+        return $this->belongsTo('Videolist', 'pid', 'id', [], 'LEFT')->setEagerlyType(0);
+    }
+    public function platform()
+    {
+        return $this->belongsTo('Platform', 'platform_id', 'id', [], 'LEFT')->setEagerlyType(0);
+    }
+}