src/Biz/User/Dao/Impl/TokenDaoImpl.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace Biz\User\Dao\Impl;
use Biz\User\Dao\TokenDao;
use Codeages\Biz\Framework\Dao\GeneralDaoImpl;
class TokenDaoImpl extends GeneralDaoImpl implements TokenDao
{
protected $table = 'user_token';
public function get($id, array $options = array())
{
$lock = isset($options['lock']) && $options['lock'] === true;
$sql = "SELECT * FROM {$this->table} WHERE id = ? LIMIT 1";
return $this->db()->fetchAssoc($sql, array($id)) ?: null;
}
public function getByToken($token)
{
$sql = "SELECT * FROM {$this->table} WHERE token = ? LIMIT 1";
return $this->db()->fetchAssoc($sql, array($token)) ?: null;
}
public function findByUserIdAndType($userId, $type)
{
return $this->findByFields(array('userId' => $userId, 'type' => $type));
}
public function getByType($type)
{
$sql = "SELECT * FROM {$this->table} WHERE type = ? and expiredTime > ? order by createdTime DESC LIMIT 1";
return $this->db()->fetchAssoc($sql, array($type, time())) ?: null;
}
public function deleteTopsByExpiredTime($expiredTime, $limit)
{
$limit = (int) $limit;
$sql = "DELETE FROM {$this->table} WHERE expiredTime < ? LIMIT {$limit} ";
return $this->db()->executeQuery($sql, array($expiredTime));
}
public function deleteByTypeAndUserId($type, $userId)
{
return $this->db()->delete($this->table, array('type' => $type, 'userId' => $userId));
}
public function declares()
{
return array(
'conditions' => array('type = :type'),
'serializes' => array('data' => 'php'),
);
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。