Active.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace app\task\model\sharing;
  3. use app\common\model\sharing\Active as ActiveModel;
  4. /**
  5. * 拼团拼单模型
  6. * Class Active
  7. * @package app\task\model\sharing
  8. */
  9. class Active extends ActiveModel
  10. {
  11. /**
  12. * 获取已过期的拼单列表
  13. * @return false|\PDOStatement|string|\think\Collection
  14. * @throws \think\db\exception\DataNotFoundException
  15. * @throws \think\db\exception\ModelNotFoundException
  16. * @throws \think\exception\DbException
  17. */
  18. public function getEndedList()
  19. {
  20. return $this->with(['goods', 'users' => ['user', 'sharingOrder']])
  21. ->where('end_time', '<=', time())
  22. ->where('status', '=', 10)
  23. ->select();
  24. }
  25. /**
  26. * 设置拼单失败状态
  27. * @param $activeIds
  28. * @return false|int
  29. */
  30. public function updateEndedStatus($activeIds)
  31. {
  32. if (empty($activeIds)) {
  33. return false;
  34. }
  35. return $this->save(['status' => 30], ['active_id' => ['in', $activeIds]]);
  36. }
  37. }