Video.php 966 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace app\api\controller;
  3. use app\common\controller\Api;
  4. use think\Db;
  5. /**
  6. * 视频
  7. */
  8. class Video extends Api
  9. {
  10. // 无需登录的接口,*表示全部
  11. protected $noNeedLogin = [];
  12. // 无需鉴权的接口,*表示全部
  13. protected $noNeedRight = ['*'];
  14. public function lists(){
  15. $week = input('week',1);
  16. if($week == 1){
  17. $starttime = strtotime(date('Y-m-d')) - 86400*7;
  18. }else{
  19. $starttime = strtotime(date('Y-m-d')) - 86400*14;
  20. }
  21. $list = Db::name('video')->where('createtime','>',$starttime)->where('is_show',1)->order('weigh desc')->autopage()->select();
  22. $list = list_domain_image($list,['video_file']);
  23. $this->success(1,$list);
  24. }
  25. public function info(){
  26. $id = input('id');
  27. $info = Db::name('video')->where('id',$id)->find();
  28. $info = info_domain_image($info,['video_file']);
  29. $this->success(1,$info);
  30. }
  31. }