Order.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // |
  4. // +----------------------------------------------------------------------
  5. // |
  6. // +----------------------------------------------------------------------
  7. // |
  8. // +----------------------------------------------------------------------
  9. // |
  10. // +----------------------------------------------------------------------
  11. // +----------------------------------------------------------------------
  12. // | 订单管理
  13. // +----------------------------------------------------------------------
  14. namespace app\index\controller\cms;
  15. use addons\cms\model\Order as OrderModel;
  16. use app\common\controller\Frontend;
  17. class Order extends Frontend
  18. {
  19. protected $noNeedLogin = [];
  20. protected $noNeedRight = ['*'];
  21. //订单列表
  22. public function index()
  23. {
  24. if ($this->request->isAjax()) {
  25. $limit = $this->request->param('limit/d', 10);
  26. $page = $this->request->param('page/d', 1);
  27. $_list = OrderModel::where('user_id', $this->auth->id)->page($page, $limit)->order('id DESC')->select();
  28. $total = OrderModel::where('user_id', $this->auth->id)->count();
  29. $result = ["code" => 0, "count" => $total, "data" => $_list];
  30. return json($result);
  31. } else {
  32. $this->assign('title', '订单记录');
  33. return $this->fetch('order_list');
  34. }
  35. }
  36. }