Order.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. *
  4. * @copyright ©2020 点小铺
  5. * @author hanj
  6. * @link: https://dyuit.com
  7. * Created by VSCode
  8. */
  9. namespace app\store\model\wow;
  10. use app\common\model\wow\Order as OrderModel;
  11. /**
  12. * 好物圈订单同步记录模型
  13. * Class Order
  14. * @package app\store\model\wow
  15. */
  16. class Order extends OrderModel
  17. {
  18. /**
  19. * 获取列表
  20. * @param string $search
  21. * @return \think\Paginator
  22. * @throws \think\exception\DbException
  23. */
  24. public function getList($search = '')
  25. {
  26. $this->setBaseQuery($this->alias, [
  27. ['order', 'order_id'],
  28. ['user', 'user_id'],
  29. ]);
  30. // 检索查询条件
  31. if (!empty($search)) {
  32. $this->where(function ($query) use ($search) {
  33. $query->whereOr('order.order_no', 'like', "%{$search}%")
  34. ->whereOr('user.nickName', 'like', "%{$search}%");
  35. });
  36. }
  37. // 返回列表数据
  38. return $this->with(['user'])
  39. ->field(['wow_order.*', 'order.order_no', 'order.pay_price'])
  40. ->where("{$this->alias}.is_delete", '=', 0)
  41. ->order(["{$this->alias}.create_time" => 'desc'])
  42. ->paginate(15, false, [
  43. 'query' => request()->request()
  44. ]);
  45. }
  46. }