MoneyIn.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 MoneyIn extends Backend
  10. {
  11. /**
  12. * Mongyin模型对象
  13. * @var \app\admin\model\trade\Mongyin
  14. */
  15. protected $model = null;
  16. protected $mapType = null;
  17. public function _initialize()
  18. {
  19. parent::_initialize();
  20. $this->mapType = array();
  21. $this->model = new \app\common\model\MoneyIn;
  22. $this->assign('typeList', $this->model->getTypeList());
  23. }
  24. /**
  25. * 查看
  26. * @return string|Json
  27. * @throws \think\Exception
  28. * @throws DbException
  29. */
  30. public function index()
  31. {
  32. //设置过滤方法
  33. $this->request->filter(['strip_tags', 'trim']);
  34. if (false === $this->request->isAjax()) {
  35. return $this->view->fetch();
  36. }
  37. //如果发送的来源是 Selectpage,则转发到 Selectpage
  38. if ($this->request->request('keyField')) {
  39. return $this->selectpage();
  40. }
  41. [$where, $sort, $order, $offset, $limit] = $this->buildparams();
  42. //tab
  43. $type = $this->request->param('order_type/d');
  44. if($type > 0) $this->mapType['order_type'] = $type;
  45. $list = $this->model->with('users,admins')
  46. ->where($where)
  47. ->where($this->mapType)
  48. ->order($sort, $order)
  49. ->paginate($limit);
  50. $result = ['total' => $list->total(), 'rows' => $list->items()];
  51. return json($result);
  52. }
  53. }