serviceManager = $serviceManager; $this->init(); return $this; } private function init() { $dbService = $this->serviceManager->get('Db'); $this->db = $dbService->getPdo(); } public function simpleFetch($uuid) { $sql="select * from metadata where uuid='$uuid'"; $rs = $this->db->query($sql); return $rs->fetch(); }//simpleFetch /** * 通过UUID删除元数据 * @param $uuid * @return bool|string */ public function delete($uuid) { $tools = $this->serviceManager->get('Tools'); if( false == $tools->isUUID($uuid) ) return "参数错误"; $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(); } return true; }//delete 删除元数据 }