Vplatform.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. namespace app\admin\controller\platform;
  3. use app\common\controller\Backend;
  4. /**
  5. * 第三方平台列表
  6. *
  7. */
  8. class Vplatform extends Backend
  9. {
  10. protected $relationSearch = true;
  11. protected $model = null;
  12. public function _initialize()
  13. {
  14. parent::_initialize();
  15. // $this->model = new \app\admin\model\third\Platform;
  16. $this->model = new \app\common\model\VideoPlatform;
  17. // $this->model = model('platform');
  18. $videolist=model('videolist')->field('id,name')->select();
  19. $platformlist=model('platform')->field('id,name')->select();
  20. $this->view->assign('videolist', $videolist);
  21. $this->view->assign('platformlist', $platformlist);
  22. }
  23. /**
  24. * 查看
  25. */
  26. public function index()
  27. {
  28. //设置过滤方法
  29. $this->request->filter(['strip_tags']);
  30. if ($this->request->isAjax()) {
  31. //如果发送的来源是Selectpage,则转发到Selectpage
  32. if ($this->request->request('keyField')) {
  33. return $this->selectpage();
  34. }
  35. list($where, $sort, $order, $offset, $limit) = $this->buildparams();
  36. $total = $this->model
  37. ->where($where)
  38. ->order($sort, $order)
  39. ->count();
  40. $list = $this->model
  41. ->where($where)
  42. ->with('platform,videolist')
  43. ->order($sort, $order)
  44. ->limit($offset, $limit)
  45. ->select();
  46. $result = array("total" => $total, "rows" => $list);
  47. return json($result);
  48. }
  49. return $this->view->fetch();
  50. }
  51. /**
  52. * 编辑
  53. */
  54. public function edit($ids = NULL)
  55. {
  56. $row = $this->model->get($ids);
  57. if (!$row)
  58. $this->error(__('No Results were found'));
  59. return parent::edit($ids);
  60. }
  61. public function add()
  62. {
  63. return parent::add();
  64. }
  65. }