Vplatform.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. }
  19. /**
  20. * 查看
  21. */
  22. public function index()
  23. {
  24. //设置过滤方法
  25. $this->request->filter(['strip_tags']);
  26. if ($this->request->isAjax()) {
  27. //如果发送的来源是Selectpage,则转发到Selectpage
  28. if ($this->request->request('keyField')) {
  29. return $this->selectpage();
  30. }
  31. list($where, $sort, $order, $offset, $limit) = $this->buildparams();
  32. $total = $this->model
  33. ->where($where)
  34. ->order($sort, $order)
  35. ->count();
  36. $list = $this->model
  37. ->where($where)
  38. ->with('platform,videolist')
  39. ->order($sort, $order)
  40. ->limit($offset, $limit)
  41. ->select();
  42. $result = array("total" => $total, "rows" => $list);
  43. return json($result);
  44. }
  45. return $this->view->fetch();
  46. }
  47. /**
  48. * 编辑
  49. */
  50. public function edit($ids = NULL)
  51. {
  52. $row = $this->model->get($ids);
  53. if (!$row)
  54. $this->error(__('No Results were found'));
  55. return parent::edit($ids);
  56. }
  57. public function add()
  58. {
  59. return parent::add();
  60. }
  61. }