Active.php 1.1 KB

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