RwaExchangeRecord.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace app\admin\controller\offline;
  3. use app\common\controller\Backend;
  4. /**
  5. * Rwa茶兑换记录管理
  6. *
  7. * @icon fa fa-circle-o
  8. */
  9. class RwaExchangeRecord extends Backend
  10. {
  11. /**
  12. * RwaExchangeRecord模型对象
  13. * @var \app\admin\model\offline\RwaExchangeRecord
  14. */
  15. protected $model = null;
  16. protected $relationSearch = true;
  17. public function _initialize()
  18. {
  19. parent::_initialize();
  20. $this->model = new \app\common\model\RwaExchangeRecordModel;
  21. }
  22. /**
  23. * 查看
  24. *
  25. * @return string|Json
  26. * @throws \think\Exception
  27. * @throws DbException
  28. */
  29. public function index()
  30. {
  31. //设置过滤方法
  32. $this->request->filter(['strip_tags', 'trim']);
  33. if (false === $this->request->isAjax()) {
  34. return $this->view->fetch();
  35. }
  36. //如果发送的来源是 Selectpage,则转发到 Selectpage
  37. if ($this->request->request('keyField')) {
  38. return $this->selectpage();
  39. }
  40. [$where, $sort, $order, $offset, $limit] = $this->buildparams();
  41. $list = $this->model->with('users,welfarereda')
  42. ->where($where)
  43. ->order($sort, $order)
  44. ->paginate($limit);
  45. $result = ['total' => $list->total(), 'rows' => $list->items()];
  46. return json($result);
  47. }
  48. }