diff --git a/application/admin/controllers/DataController.php b/application/admin/controllers/DataController.php index 4fc1dd65..90a24927 100755 --- a/application/admin/controllers/DataController.php +++ b/application/admin/controllers/DataController.php @@ -390,10 +390,11 @@ class Admin_DataController extends Zend_Controller_Action $reply = $this->_getParam('reply'); $replylist = $this->_getParam('replylist'); $delreply = $this->_getParam('delreply'); + $submd=$this->view->config->sub->metadata; if ($delete) { - $sql="delete from comments where id=?"; + $sql="delete from comments where id=? and uuid in (select uuid from $submd)"; try { $this->db->query($sql,array($delete)); $this->messenger->addMessage('提示信息:您已经成功删除该评论。'); @@ -465,7 +466,7 @@ class Admin_DataController extends Zend_Controller_Action if($uuid) { $sql = "SELECT c.*,md.title,md.uuid FROM comments c - LEFT JOIN metadata md ON md.uuid=c.uuid + LEFT JOIN $submd md ON md.uuid=c.uuid WHERE c.uuid=?"; $sth = $this->db->prepare($sql); $sth->execute(array($uuid)); @@ -531,7 +532,7 @@ class Admin_DataController extends Zend_Controller_Action $sql = "SELECT cm.*,md.title,(SELECT count(id) as counts FROM comments cms WHERE cms.reply=cm.id AND cms.reply!=0) as reply_count FROM comments cm - LEFT JOIN metadata md ON md.uuid=cm.uuid + LEFT JOIN $submd md ON md.uuid=cm.uuid WHERE cm.reply=0 ORDER BY cm.ts_created DESC,cm.id DESC";