RoomVideoController.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace App\Admin\Controllers;
  3. use Encore\Admin\Controllers\AdminController;
  4. use App\Models\Rome;
  5. use Encore\Admin\Grid;
  6. use Encore\Admin\Layout\Content;
  7. use Encore\Admin\Show;
  8. use Encore\Admin\Admin;
  9. use App\Api\Util\IM;
  10. class RoomVideoController extends AdminController
  11. {
  12. use IM;
  13. protected $title = '房间监控';
  14. // public function index(Content $content)
  15. // {
  16. // $data=[['id'=>1,'url'=>2,'name'=>'2342']];//Rome::where('end',0)->get();
  17. // $content->title('房间监控');
  18. // $content->description('房间监控');
  19. // $content->row();
  20. // $x='if (flvjs.isSupported()) { ';
  21. // foreach($data as $k=>$v){
  22. // $url=config('love.PLAY_DOMAINS').'/live/'.config('love.IM_SDKAPPID').'_r'.$v->id.'.flv';
  23. // $x=$x."var videoElement$k = document.getElementById('videoElement$k');
  24. // var flvPlayer$k = flvjs.createPlayer({type: 'flv',url: '$url'});
  25. // flvPlayer$k.attachMediaElement(videoElement$k);flvPlayer$k.load();flvPlayer$k.play();";
  26. // }
  27. // $x=$x.'}';
  28. // Admin::script(''.$x.';console.log("hello world");');
  29. // $grid->setView('admin.grid.card');
  30. // return $content
  31. // ->title('房间监控')
  32. // ->row(function($row) use ($data){
  33. // $row->column(12,view('vomevideo')->with(['envs'=>$data]));
  34. // });
  35. // }
  36. protected function grid()
  37. {
  38. $grid = new Grid(new Rome());
  39. $grid->column('id', __('ID'))->sortable();
  40. $grid->model()->where('end',0)->orderBy('id', 'desc');
  41. $grid->setView('vomevideo');
  42. return $grid;
  43. }
  44. public function store()
  45. {
  46. $id=request('id');
  47. $x=$this->closeGroup($id);
  48. Rome::where('end',0)->where('id',$id)->update(['end'=>time()]);
  49. admin_toastr('断流成功!!!', 'success');
  50. return redirect('admin/romevideo');
  51. }
  52. }