Moneylog.php 1.2 KB

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