// +---------------------------------------------------------------------- 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 * @return \crmeb\basic\BaseModel */ public function deleteValidFile() { return $this->getModel() ->where('temporary', 1) ->where('valid_time', '<>', 0) ->where('valid_time', '<', time()) ->update(['media_id' => '', 'valid_time' => 0]); } }