Order.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. namespace app\seller\controller;
  3. use app\common\validate\IDMustBePositiveInt;
  4. use app\common\controller\SellerController;
  5. use app\http\IResponse;
  6. use think\Controller;
  7. class Order extends SellerController
  8. {
  9. /**
  10. *
  11. * @author 许祖兴 < zuxing.xu@lettered.cn>
  12. * @date 2020/7/16 17:59
  13. *
  14. * @return mixed
  15. * @throws \Lettered\Support\Exceptions\FailedException
  16. * @throws \think\exception\DbException
  17. */
  18. public function index()
  19. {
  20. $where = [];
  21. //组合搜索
  22. !empty(input('name')) && $where[]
  23. = ['name', 'like', '%' . input('name') . '%'];
  24. $order = model('common/GoodsOrder');
  25. // TODO 商家要依据自己的ID查询
  26. return IResponse::paginate($order->where($where)
  27. ->where(['seller_id' => $this->seller->id])
  28. ->with(['user','addr'])
  29. ->paginate(input('limit'),false));
  30. }
  31. public function getOrderDetailById($id){
  32. (new IDMustBePositiveInt())->valid();
  33. //
  34. $order = model('common/GoodsOrderDetail');
  35. // TODO 商家要依据自己的ID查询
  36. return IResponse::paginate($order ->where(['order_id' => $id])
  37. ->order(['created_at' => 'desc'])
  38. ->paginate(input('limit'),false));
  39. }
  40. /**
  41. *
  42. * @author 许祖兴 < zuxing.xu@lettered.cn>
  43. * @date 2020/9/20 17:09
  44. *
  45. * @return mixed
  46. * @throws \Lettered\Support\Exceptions\FailedException
  47. * @throws \think\exception\DbException
  48. */
  49. public function getOrderService(){
  50. $service = model('common/GoodsOrderService');
  51. // TODO 商家要依据自己的ID查询
  52. return IResponse::paginate($service->where(['seller_id' => $this->seller->id])
  53. ->order(['created_at' => 'desc'])
  54. ->paginate(input('limit'),false));
  55. }
  56. }