Order.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. namespace app\admin\controller\vip;
  3. use app\common\controller\Backend;
  4. /**
  5. * VIP订单管理
  6. *
  7. * @icon fa fa-circle-o
  8. */
  9. class Order extends Backend
  10. {
  11. /**
  12. * Order模型对象
  13. * @var \app\admin\model\vip\Order
  14. */
  15. protected $model = null;
  16. public function _initialize()
  17. {
  18. parent::_initialize();
  19. $this->model = new \app\admin\model\vip\Order;
  20. $this->view->assign("statusList", $this->model->getStatusList());
  21. }
  22. /**
  23. * 查看
  24. */
  25. public function index()
  26. {
  27. //设置过滤方法
  28. $this->request->filter(['strip_tags', 'trim']);
  29. if ($this->request->isAjax()) {
  30. $this->relationSearch = true;
  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. ->with(['user', 'vip'])
  38. ->where($where)
  39. ->order($sort, $order)
  40. ->paginate($limit);
  41. foreach ($list as $index => $item) {
  42. if ($item->user) {
  43. $item->user->visible(['nickname']);
  44. }
  45. }
  46. $result = array("total" => $list->total(), "rows" => $list->items());
  47. return json($result);
  48. }
  49. return $this->view->fetch();
  50. }
  51. }