Order.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace app\task\model\dealer;
  3. use app\common\model\dealer\Order as OrderModel;
  4. use app\common\service\Order as OrderService;
  5. /**
  6. * 分销商订单模型
  7. * Class Apply
  8. * @package app\task\model\dealer
  9. */
  10. class Order extends OrderModel
  11. {
  12. /**
  13. * 获取未结算的分销订单
  14. * @return false|\PDOStatement|string|\think\Collection
  15. * @throws \think\db\exception\DataNotFoundException
  16. * @throws \think\db\exception\ModelNotFoundException
  17. * @throws \think\exception\DbException
  18. */
  19. public function getUnSettledList()
  20. {
  21. $list = $this->where('is_invalid', '=', 0)
  22. ->where('is_settled', '=', 0)
  23. ->select();
  24. if ($list->isEmpty()) {
  25. return $list;
  26. }
  27. // 整理订单信息
  28. $with = ['goods' => ['refund']];
  29. return OrderService::getOrderList($list, 'order_master', $with);
  30. }
  31. /**
  32. * 标记订单已失效(批量)
  33. * @param $ids
  34. * @return false|int
  35. */
  36. public function setInvalid($ids)
  37. {
  38. return $this->isUpdate(true)
  39. ->save(['is_invalid' => 1], ['id' => ['in', $ids]]);
  40. }
  41. }