config(); $configs=config('site'); $map=[]; // $map['ishot']=2; // $map['endtimesjc']=['>',time()]; // if(input('uid',0)>0){ // $map['uid']=input('uid'); // } $list = model('Platform') // ->with('user') // ->where($map) ->limit(10) ->select(); $data=['config'=>$config,'doctor'=>$list]; $this->success('请求成功',$data); } public function test(){ $this->success('请求成功'); } public function user_share_order(){ $map = []; // 初始化$map数组,避免未定义时的错误 if(input('uid', 0) > 0){ // 明确指定uid所属的表(假设主表为video_share) $map['video_share.uid'] = input('uid'); $count = $this->user_share_count($map['video_share.uid']); } list($where, $sort, $order, $offset, $limit) = $this->buildparams(); $config = $this->config(); $list = model('VideoShare') ->with('videolist,user') ->where($map) ->limit($offset, $limit) ->select(); $total = model('VideoShare') ->with('users') ->where($map) ->count(); // var_dump(model('VideoShare')->getLastSql());die(); $data = ['config' => $config, 'doctor' => $list,'total'=>$total,'count' => $count]; $this->success('请求成功', $data); } public function user_share_count($uid){ // 统计用户各个短剧的版权数量 $map = []; // 初始化$map数组,避免未定义时的错误 $map['uid'] = $uid; $count = model('VideoShare') ->where($map) ->group('vid') ->field('vid,sum(num) as count') ->select(); return $count; } // 查看各平台的收益情况 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(); 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('VideoPlatformRecord')->insertGetId($up); } } $this->success('分配完成'); } }