StoreOrderStatusDao.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\common\dao\store\order;
  12. use app\common\dao\BaseDao;
  13. use app\common\model\BaseModel;
  14. use app\common\model\store\order\StoreOrderStatus;
  15. /**
  16. * Class StoreOrderStatusDao
  17. * @package app\common\dao\store\order
  18. * @author xaboy
  19. * @day 2020/6/12
  20. */
  21. class StoreOrderStatusDao extends BaseDao
  22. {
  23. /**
  24. * @return string
  25. * @author xaboy
  26. * @day 2020/6/12
  27. */
  28. protected function getModel(): string
  29. {
  30. return StoreOrderStatus::class;
  31. }
  32. /**
  33. * @param $id
  34. * @return mixed
  35. * @author xaboy
  36. * @day 2020/6/12
  37. */
  38. public function search($id)
  39. {
  40. return $query = ($this->getModel()::getDB())->where('order_id', $id);
  41. }
  42. public function getTimeoutDeliveryOrder($end)
  43. {
  44. return StoreOrderStatus::getDB()->alias('A')->leftJoin('StoreOrder B', 'A.order_id = B.order_id')
  45. ->whereIn('A.change_type', ['delivery_0', 'delivery_1', 'delivery_2'])
  46. ->where('A.change_time', '<', $end)->where('B.paid', 1)->where('B.status', 1)
  47. ->column('A.order_id');
  48. }
  49. }