Platform.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. namespace app\admin\controller\platform;
  3. use app\common\controller\Backend;
  4. /**
  5. * 第三方平台列表
  6. *
  7. */
  8. class Platform 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\Platform;
  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. ->order($sort, $order)
  39. ->limit($offset, $limit)
  40. ->select();
  41. $result = array("total" => $total, "rows" => $list);
  42. return json($result);
  43. }
  44. return $this->view->fetch();
  45. }
  46. /**
  47. * 编辑
  48. */
  49. public function edit($ids = NULL)
  50. {
  51. $row = $this->model->get($ids);
  52. if (!$row)
  53. $this->error(__('No Results were found'));
  54. return parent::edit($ids);
  55. }
  56. public function add()
  57. {
  58. return parent::add();
  59. }
  60. }