Order.php 1.2 KB

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