Userscorelog.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. namespace app\admin\controller;
  3. use app\common\controller\Backend;
  4. /**
  5. * 用户积分流水
  6. *
  7. * @icon fa fa-circle-o
  8. */
  9. class Userscorelog extends Backend
  10. {
  11. /**
  12. * Userscorelog模型对象
  13. * @var \app\admin\model\Userscorelog
  14. */
  15. protected $model = null;
  16. public function _initialize()
  17. {
  18. parent::_initialize();
  19. $this->model = new \app\admin\model\Userscorelog;
  20. }
  21. /**
  22. * 查看
  23. */
  24. public function index()
  25. {
  26. //设置过滤方法
  27. $this->request->filter(['strip_tags', 'trim']);
  28. if (false === $this->request->isAjax()) {
  29. return $this->view->fetch();
  30. }
  31. //如果发送的来源是 Selectpage,则转发到 Selectpage
  32. if ($this->request->request('keyField')) {
  33. return $this->selectpage();
  34. }
  35. list($where, $sort, $order, $offset, $limit) = $this->buildparams();
  36. $list = $this->model
  37. ->where($where)
  38. ->order($sort, $order)
  39. ->paginate($limit);
  40. $wallet_logtype = config('wallet.logtype');
  41. $lists = collection($list->items())->toArray();
  42. foreach ($lists as &$row) {
  43. $row['log_type_text'] = isset($wallet_logtype[$row['log_type']]) ? $wallet_logtype[$row['log_type']] : '';
  44. }
  45. $result = ['total' => $list->total(), 'rows' => $lists];
  46. return json($result);
  47. }
  48. }