Juese.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. namespace app\admin\controller\video;
  3. use app\common\controller\Backend;
  4. /**
  5. * 会员管理
  6. *
  7. * @icon fa fa-user
  8. */
  9. class Juese extends Backend
  10. {
  11. protected $relationSearch = true;
  12. /**
  13. * @var \app\admin\model\User
  14. */
  15. protected $model = null;
  16. public function _initialize()
  17. {
  18. parent::_initialize();
  19. $this->model = model('Juese');
  20. }
  21. /**
  22. * 查看
  23. */
  24. public function index()
  25. {
  26. //设置过滤方法
  27. $this->request->filter(['strip_tags']);
  28. if ($this->request->isAjax()) {
  29. //如果发送的来源是Selectpage,则转发到Selectpage
  30. if ($this->request->request('keyField')) {
  31. return $this->selectpage();
  32. }
  33. list($where, $sort, $order, $offset, $limit) = $this->buildparams();
  34. $map=[];
  35. if(input('pid')){
  36. $map['juese.pid']= input('pid');
  37. }
  38. $total = $this->model
  39. ->with('videolist,user')
  40. ->where($where)
  41. ->where($map)
  42. ->order($sort, $order)
  43. ->count();
  44. $list = $this->model
  45. ->with('videolist,user')
  46. ->where($where)
  47. ->where($map)
  48. ->order($sort, $order)
  49. ->limit($offset, $limit)
  50. ->select();
  51. $result = array("total" => $total, "rows" => $list);
  52. return json($result);
  53. }
  54. return $this->view->fetch();
  55. }
  56. /**
  57. * 编辑
  58. */
  59. public function edit($ids = NULL,$pid = NULL)
  60. {
  61. $row = $this->model->get($ids);
  62. if (!$row)
  63. $this->error(__('No Results were found'));
  64. return parent::edit($ids);
  65. }
  66. public function add($pid = NULL)
  67. {
  68. $Videolist = model('Videolist')->get($pid);
  69. if($Videolist){
  70. return parent::add();
  71. }else{
  72. echo '请到视频管理里添加';
  73. }
  74. }
  75. }