Teacs.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace app\admin\controller\product;
  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\product\Teacs
  14. */
  15. protected $model = null;
  16. public function _initialize()
  17. {
  18. parent::_initialize();
  19. $this->model = new \app\common\model\ProductTeac();
  20. }
  21. public function index()
  22. {
  23. //设置过滤方法
  24. $this->request->filter(['strip_tags', 'trim']);
  25. if (false === $this->request->isAjax()) {
  26. return $this->view->fetch();
  27. }
  28. //如果发送的来源是 Selectpage,则转发到 Selectpage
  29. if ($this->request->request('keyField')) {
  30. return $this->selectpage();
  31. }
  32. [$where, $sort, $order, $offset, $limit] = $this->buildparams();
  33. $list = $this->model->with('user')
  34. ->where($where)
  35. //->where('synthesis_id', '=', $ids)
  36. ->order($sort, $order)
  37. ->paginate($limit);
  38. $result = ['total' => $list->total(), 'rows' => $list->items()];
  39. return json($result);
  40. }
  41. }