修改数据进入评审库的流程,并修复sql join的问题

This commit is contained in:
wlx 2012-05-17 02:01:08 +00:00
parent ef3b13b913
commit e2d29d62c4
1 changed files with 30 additions and 33 deletions

View File

@ -21,7 +21,7 @@ class Admin_ReviewController extends Zend_Controller_Action
function indexAction() function indexAction()
{ {
$sql = "select m.id,md.title,u.username,u.realname,m.status from mdstatus m $sql = "select m.id,md.title,u.username,u.realname,m.status from mdstatus m
left join metadata md on md.uuid=m.uuid right join metadata md on md.uuid=m.uuid
left join users u on u.id=m.userid left join users u on u.id=m.userid
order by m.id desc limit 10 "; order by m.id desc limit 10 ";
$re = $this->db->query($sql); $re = $this->db->query($sql);
@ -43,7 +43,7 @@ class Admin_ReviewController extends Zend_Controller_Action
} }
$sql = "select m.id,md.title,u.username,u.realname,m.status from mdstatus m $sql = "select m.id,md.title,u.username,u.realname,m.status from mdstatus m
left join metadata md on md.uuid=m.uuid right join metadata md on md.uuid=m.uuid
left join users u on u.id=m.userid left join users u on u.id=m.userid
where u.id='$userid'"; where u.id='$userid'";
@ -163,7 +163,7 @@ class Admin_ReviewController extends Zend_Controller_Action
if(!empty($keyword)) if(!empty($keyword))
{ {
$sql = "select m.*,u.username,u.realname from mdstatus m $sql = "select m.*,u.username,u.realname from mdstatus m
left join metadata md on md.uuid=m.uuid right join metadata md on md.uuid=m.uuid
left join users u on u.id=m.userid left join users u on u.id=m.userid
where m.status=1 where m.status=1
and md.title like '%$keyword%' and md.title like '%$keyword%'
@ -182,7 +182,7 @@ class Admin_ReviewController extends Zend_Controller_Action
else else
{ {
$sql = "select m.*,md.title,u.username,u.realname from mdstatus m $sql = "select m.*,md.title,u.username,u.realname from mdstatus m
left join metadata md on md.uuid=m.uuid right join metadata md on md.uuid=m.uuid
left join users u on u.id=m.userid left join users u on u.id=m.userid
where m.status=1"; where m.status=1";
$re = $this->db->query($sql); $re = $this->db->query($sql);
@ -219,7 +219,7 @@ class Admin_ReviewController extends Zend_Controller_Action
{ {
$sql = "select m.*,md.*,u.realname from mdstatus m $sql = "select m.*,md.*,u.realname from mdstatus m
left join metadata md on md.uuid=m.uuid right join metadata md on md.uuid=m.uuid
left join users u on u.id=m.userid left join users u on u.id=m.userid
where m.id=$show where m.id=$show
"; ";
@ -275,7 +275,7 @@ class Admin_ReviewController extends Zend_Controller_Action
} }
$sql = "select m.id,md.title,m.status,m.uuid from mdstatus m $sql = "select m.id,md.title,m.status,m.uuid from mdstatus m
left join metadata md on md.uuid=m.uuid right join metadata md on md.uuid=m.uuid
where m.status in (2,3,4) $searchjoin"; where m.status in (2,3,4) $searchjoin";
$rs = $this->db->query($sql); $rs = $this->db->query($sql);
$rows = $rs->fetchAll(); $rows = $rs->fetchAll();
@ -516,9 +516,10 @@ class Admin_ReviewController extends Zend_Controller_Action
* *
* return view * return view
*/ */
function addonAction(){ function addonAction()
{
$uuid=$this->_request->getParam('uuid'); $uuid=$this->_request->getParam('uuid');
$userid=Zend_Auth::getInstance()->getIdentity()->id;
$sql = "select * from mdstatus where uuid='$uuid'"; $sql = "select * from mdstatus where uuid='$uuid'";
$re = $this->db->query($sql); $re = $this->db->query($sql);
@ -526,12 +527,7 @@ class Admin_ReviewController extends Zend_Controller_Action
if(empty($row['id'])) if(empty($row['id']))
{ {
$auth = Zend_Auth::getInstance(); $sql = "insert into mdstatus (uuid,userid,status) values ('$uuid','$userid','0')";
if($auth->hasIdentity())
{
$user = $auth->getIdentity();
$userid = $user->id;
$sql = "insert into mdstatus (uuid,userid,ts_scheduled,status) values ('$uuid','$userid','".date("Y-m-d H:i:s")."','0')";
try{ try{
if($this->db->exec($sql)>0) if($this->db->exec($sql)>0)
{ {
@ -542,11 +538,12 @@ class Admin_ReviewController extends Zend_Controller_Action
$this->messenger->addMessage('操作失败:'.$e->getMessage()); $this->messenger->addMessage('操作失败:'.$e->getMessage());
$this->_redirect("/admin/review/draft"); $this->_redirect("/admin/review/draft");
} }
} } else if ($row['status']==5){
$sql="update mdstatus set status=1 where status=5 and id=".$row['id'];
} $this->db->query($sql);
else $this->messenger->addMessage('操作成功!该数据已重新放入评审');
{ $this->_redirect("/admin/review/accept");
} else {
$this->messenger->addMessage('该数据已放入评审'); $this->messenger->addMessage('该数据已放入评审');
$this->_redirect("/admin/data/md"); $this->_redirect("/admin/data/md");
} }
@ -584,7 +581,7 @@ class Admin_ReviewController extends Zend_Controller_Action
} }
$sql = "select m.id,md.uuid,md.title,u.username,u.realname,m.status from mdstatus m $sql = "select m.id,md.uuid,md.title,u.username,u.realname,m.status from mdstatus m
left join metadata md on md.uuid=m.uuid right join metadata md on md.uuid=m.uuid
left join users u on u.id=m.userid left join users u on u.id=m.userid
where m.status in (0,1,2,3,4) and u.id='$userid' $searchjoin order by m.status desc"; where m.status in (0,1,2,3,4) and u.id='$userid' $searchjoin order by m.status desc";
@ -765,7 +762,7 @@ class Admin_ReviewController extends Zend_Controller_Action
} }
$sql = "select m.id,md.title,md.uuid,u.username,u.realname,m.status,m.ts_created from mdstatus m $sql = "select m.id,md.title,md.uuid,u.username,u.realname,m.status,m.ts_created from mdstatus m
left join metadata md on md.uuid=m.uuid right join metadata md on md.uuid=m.uuid
left join users u on u.id=m.userid left join users u on u.id=m.userid
where status=0 $searchjoin"; where status=0 $searchjoin";
@ -826,7 +823,7 @@ class Admin_ReviewController extends Zend_Controller_Action
} }
$sql = "select m.id,md.title,md.uuid,u.username,u.realname,m.status from mdstatus m $sql = "select m.id,md.title,md.uuid,u.username,u.realname,m.status from mdstatus m
left join metadata md on md.uuid=m.uuid right join metadata md on md.uuid=m.uuid
left join users u on u.id=m.userid left join users u on u.id=m.userid
where status=-1 $searchjoin"; where status=-1 $searchjoin";
@ -866,7 +863,7 @@ class Admin_ReviewController extends Zend_Controller_Action
} }
$sql = "select m.id,md.title,md.uuid,u.username,u.realname,m.status,m.ts_finished from mdstatus m $sql = "select m.id,md.title,md.uuid,u.username,u.realname,m.status,m.ts_finished from mdstatus m
left join metadata md on md.uuid=m.uuid right join metadata md on md.uuid=m.uuid
left join users u on u.id=m.userid left join users u on u.id=m.userid
where status=5 $searchjoin"; where status=5 $searchjoin";