westdc-zf1/vendor/Westdc/Metadata/Thumb.php

46 lines
954 B
PHP

<?php
namespace Westdc\Metadata;
use Sookon\Helpers\View as view;
use Sookon\Helpers\Dbh as dbh;
use Sookon\Helpers\PDO;
use Sookon\Helpers\Config;
use Sookon\Helpers\Table;
use Zend\Http\PhpEnvironment\Request;
class Thumb
{
private $db; //传入PDO对象
private $config; //站点设置
private $table;
public $opt;
protected $events = NULL;
function __construct()
{
$this->db = new PDO;
$this->config = Config::get();
$this->table = new Table;
$this->opt = new \stdClass();
$this->opt->sort = "DESC";
$this->opt->logic = "AND";
}
public function getMetadataThumbById($id)
{
if (!\Sookon\Helpers\Uuid::test($id)) {
$where = " m.id=$id ";
} else {
$where = " m.uuid='$id' ";
}
$sql = "select t.* from thumbnail t left join metadata m on t.id=m.id where ".$where;
$thumb = $this->db->query($sql);
return $thumb->fetch();
}
}