Teacs.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace app\admin\controller\user;
  3. use app\common\controller\Backend;
  4. /**
  5. * 用户Teac交易记录管理
  6. *
  7. * @icon fa fa-circle-o
  8. */
  9. class Teacs extends Backend
  10. {
  11. /**
  12. * Teacs模型对象
  13. * @var \app\admin\model\user\Teacs
  14. */
  15. protected $model = null;
  16. public function _initialize()
  17. {
  18. parent::_initialize();
  19. $this->model = new \app\common\model\UserTeac();
  20. $this->assignconfig('ids', $this->request->param('ids'));
  21. }
  22. public function index()
  23. {
  24. //设置过滤方法
  25. $this->request->filter(['strip_tags', 'trim']);
  26. if (false === $this->request->isAjax()) {
  27. return $this->view->fetch();
  28. }
  29. //如果发送的来源是 Selectpage,则转发到 Selectpage
  30. if ($this->request->request('keyField')) {
  31. return $this->selectpage();
  32. }
  33. [$where, $sort, $order, $offset, $limit] = $this->buildparams();
  34. $ids = $this->request->param('ids');
  35. $list = $this->model->with('users')
  36. ->where($where)->where('trade_id', '=', $ids)
  37. ->order($sort, $order)
  38. ->paginate($limit);
  39. $result = ['total' => $list->total(), 'rows' => $list->items()];
  40. return json($result);
  41. }
  42. }