You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

WorkMediaDao.php 624B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace app\dao\work;
  3. use app\dao\BaseDao;
  4. use app\model\work\WorkMedia;
  5. /**
  6. * Class WorkMediaDao
  7. * @package app\dao\work
  8. */
  9. class WorkMediaDao extends BaseDao
  10. {
  11. /**
  12. * @return string
  13. */
  14. protected function setModel(): string
  15. {
  16. return WorkMedia::class;
  17. }
  18. /**
  19. * 删除时效的media_id
  20. */
  21. public function deleteValidFile()
  22. {
  23. return $this->getModel()
  24. ->where('temporary', 1)
  25. ->where('valid_time', '<>', 0)
  26. ->where('valid_time', '<', time())
  27. ->update(['media_id' => '', 'valid_time' => 0]);
  28. }
  29. }