Platform.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. namespace app\api\controller;
  3. use think\Db;
  4. use fast\Tree;
  5. use app\common\controller\Api;
  6. /**
  7. * 股份 收益 分红
  8. */
  9. class Platform extends Api
  10. {
  11. protected $noNeedLogin = ['*'];
  12. protected $noNeedRight = ['*'];
  13. public function index()
  14. {
  15. $config=$this->config();
  16. $configs=config('site');
  17. $map=[];
  18. // $map['ishot']=2;
  19. // $map['endtimesjc']=['>',time()];
  20. // if(input('uid',0)>0){
  21. // $map['uid']=input('uid');
  22. // }
  23. $list = model('Platform')
  24. // ->with('user')
  25. // ->where($map)
  26. ->limit(10)
  27. ->select();
  28. $data=['config'=>$config,'doctor'=>$list];
  29. $this->success('请求成功',$data);
  30. }
  31. public function test(){
  32. $this->success('请求成功');
  33. }
  34. public function user_share_order(){
  35. $map = []; // 初始化$map数组,避免未定义时的错误
  36. if(input('uid', 0) > 0){
  37. // 明确指定uid所属的表(假设主表为video_share)
  38. $map['video_share.uid'] = input('uid');
  39. $count = $this->user_share_count($map['video_share.uid']);
  40. }
  41. $config = $this->config();
  42. $list = model('VideoShare')
  43. ->with('videolist,user')
  44. ->where($map)
  45. ->limit(10)
  46. ->select();
  47. // var_dump(model('VideoShare')->getLastSql());die();
  48. $data = ['config' => $config, 'doctor' => $list,'count' => $count];
  49. $this->success('请求成功', $data);
  50. }
  51. public function user_share_count($uid){
  52. $map = []; // 初始化$map数组,避免未定义时的错误
  53. $map['uid'] = $uid;
  54. $count = model('VideoShare')
  55. ->where($map)
  56. ->count();
  57. return $count;
  58. }
  59. // 每个短剧更具贡献值分红
  60. public function dividend(){
  61. }
  62. }