123456789101112131415161718192021222324252627282930313233343536 |
- <?php
-
-
- namespace app\dao\work;
-
-
- use app\dao\BaseDao;
- use app\model\work\WorkMedia;
-
- /**
- * Class WorkMediaDao
- * @package app\dao\work
- */
- class WorkMediaDao extends BaseDao
- {
-
- /**
- * @return string
- */
- protected function setModel(): string
- {
- return WorkMedia::class;
- }
-
- /**
- * 删除时效的media_id
- */
- public function deleteValidFile()
- {
- return $this->getModel()
- ->where('temporary', 1)
- ->where('valid_time', '<>', 0)
- ->where('valid_time', '<', time())
- ->update(['media_id' => '', 'valid_time' => 0]);
- }
- }
|