Order.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /**
  3. *
  4. * User: anyluck
  5. * Date: 2020/6/2
  6. * Time: 17:41
  7. */
  8. namespace app\admin\controller;
  9. use think\facade\Request;
  10. use think\facade\View;
  11. class Order
  12. {
  13. // 订单管理
  14. /**
  15. * 求购订单列表
  16. */
  17. public function buy()
  18. {
  19. if (Request::isPost()) {
  20. $name = input("name");
  21. $page = input("page") ?: 1;
  22. $limit = input("limit") ?: 10;
  23. $where = [];
  24. // if ($name){
  25. // $where["name"]=["like","% $name %"];
  26. // }
  27. $where["status"]=0;
  28. $list = \app\common\model\Order::where($where)->order("id desc")->paginate(["list_row" => $limit, "page" => $page])->each(function ($item) {
  29. $user = \app\common\model\User::where(["id" => $item["buy_user"]])->field("name")->find();
  30. $item["user_name"] = $user->name;
  31. $item["add_time"]=date("Y-m-d H:i:s",$item["add_time"]);
  32. return $item;
  33. })->toArray();
  34. return $result = ['code' => 0, 'msg' => lang('get info success'), 'data' => $list['data'] ?: [], 'count' => $list['total'] ?: 0];
  35. }
  36. return View::fetch();
  37. }
  38. /**
  39. * 持有订单列表
  40. */
  41. public function push()
  42. {
  43. }
  44. /**
  45. * 申述处理
  46. */
  47. public function bond()
  48. {
  49. }
  50. }