2014-11-04 09:05:21 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Created by PhpStorm.
|
|
|
|
* User: Administrator
|
|
|
|
* Date: 14-9-25
|
|
|
|
* Time: 下午2:41
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Westdc\Metadata;
|
|
|
|
|
2014-12-18 13:14:30 +00:00
|
|
|
use Zend\ServiceManager\ServiceManager;
|
|
|
|
use Zend\ServiceManager\ServiceManagerAwareInterface;
|
2014-12-18 15:25:15 +00:00
|
|
|
use Westdc\EventModel\AbstractEventManager;
|
2014-11-04 09:05:21 +00:00
|
|
|
|
2014-12-18 15:25:15 +00:00
|
|
|
class Metadata extends AbstractEventManager implements ServiceManagerAwareInterface{
|
2014-11-04 09:05:21 +00:00
|
|
|
|
2014-12-18 15:25:15 +00:00
|
|
|
protected $serviceManager;
|
2014-11-04 09:05:21 +00:00
|
|
|
|
2014-12-18 15:25:15 +00:00
|
|
|
private $db;
|
2014-11-04 09:05:21 +00:00
|
|
|
|
2014-12-18 15:25:15 +00:00
|
|
|
public function setServiceManager(ServiceManager $serviceManager)
|
|
|
|
{
|
|
|
|
$this->serviceManager = $serviceManager;
|
|
|
|
|
|
|
|
$this->init();
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
private function init()
|
|
|
|
{
|
|
|
|
$dbService = $this->serviceManager->get('Db');
|
|
|
|
$this->db = $dbService->getPdo();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function delete($uuid)
|
|
|
|
{
|
|
|
|
|
|
|
|
$tools = $this->serviceManager->get('Tools');
|
|
|
|
|
|
|
|
if( false == $tools->isUUID($uuid) )
|
|
|
|
return "参数错误";
|
|
|
|
|
2014-12-21 03:21:38 +00:00
|
|
|
|
|
|
|
$sql = "delete from mdstatus where uuid='$uuid'";
|
|
|
|
$sql1 = "delete from mdauthor where uuid='$uuid'";
|
|
|
|
$sql2="delete from metadata where uuid='$uuid'";
|
|
|
|
|
|
|
|
try{
|
|
|
|
$this->db->exec($sql);
|
|
|
|
$this->db->exec($sql1);
|
|
|
|
$this->db->exec($sql2);
|
|
|
|
|
|
|
|
$search=new Search();
|
|
|
|
$search->del($uuid,'uuid');
|
|
|
|
}catch(\Exception $e){
|
|
|
|
return $e->getMessage();
|
|
|
|
}
|
|
|
|
|
2014-12-18 15:25:15 +00:00
|
|
|
return true;
|
|
|
|
}//delete 删除元数据
|
2014-11-04 09:05:21 +00:00
|
|
|
|
|
|
|
}
|