| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <?php
- namespace app\api\controller;
- use think\Db;
- use fast\Tree;
- use app\common\controller\Api;
- /**
- * 股份 收益 分红
- */
- class Platform extends Api
- {
- protected $noNeedLogin = ['*'];
- protected $noNeedRight = ['*'];
- public function index()
- {
- $config=$this->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 dividend(){
- }
- }
|