Task.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\bargain;
  10. use app\common\model\bargain\Task as TaskModel;
  11. /**
  12. * 砍价任务模型
  13. * Class Task
  14. * @package app\api\model\bargain
  15. */
  16. class Task extends TaskModel
  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 getEndList()
  26. {
  27. return $this->where('end_time', '<=', time())
  28. ->where('status', '=', 1)
  29. ->where('is_delete', '=', 0)
  30. ->select();
  31. }
  32. /**
  33. * 将砍价任务标记为已结束(批量)
  34. * @param $taskIds
  35. * @return false|int
  36. */
  37. public function setIsEnd($taskIds)
  38. {
  39. return $this->isUpdate(true)->save([
  40. 'status' => 0
  41. ], ['task_id' => ['in', $taskIds]]);
  42. }
  43. }