fix #272, 解决数据篮中重复数据问题,即离线申请时正在进行中的申请保证数据不重复
This commit is contained in:
parent
0eeacbad79
commit
9f616a7367
|
@ -1079,11 +1079,14 @@ class DataController extends Zend_Controller_Action
|
||||||
// -1: 取消了在线下载进程
|
// -1: 取消了在线下载进程
|
||||||
//首先判断离线申请的数据数量是否超过系统限制
|
//首先判断离线申请的数据数量是否超过系统限制
|
||||||
$sql="select count(*) as datacount from dataorder where (ts_approved is null) and userid=? and status>0 and status<5";
|
$sql="select count(*) as datacount from dataorder where (ts_approved is null) and userid=? and status>0 and status<5";
|
||||||
$r=$this->db->fetchRow($sql,array($userid));
|
$r=$this->db->fetchRow($this->db->quoteInto($sql,$userid));
|
||||||
//保证添加的离线数据申请未申请
|
//保证添加的离线数据申请未申请
|
||||||
$sql="select count(*) as datacount from dataorder where (ts_approved is null) and userid=? and uuid=? and status=1";
|
$sql="select count(*) as datacount from dataorder where (ts_approved is null) and userid='$userid' and uuid=? and status in (1,2,3,4)";
|
||||||
$r1=$this->db->fetchRow($sql,array($userid,$uuid));
|
$r1=$this->db->fetchRow($this->db->quoteInto($sql,$uuid));
|
||||||
if ($r['datacount']<$this->view->config->download->max && $r1['datacount']<1) {
|
//保证添加的离线数据是正式发布的数据
|
||||||
|
$sql="select count(*) as mdcount from normalmetadata where uuid=?";
|
||||||
|
$r2=$this->db->fetchRow($this->db->quoteInto($sql,$uuid));
|
||||||
|
if ($r['datacount']<$this->view->config->download->max && $r1['datacount']<1 && $r2['mdcount']>0) {
|
||||||
$sql="insert into dataorder (uuid,ts_created,userid,status) values(?,now(),?,?)";
|
$sql="insert into dataorder (uuid,ts_created,userid,status) values(?,now(),?,?)";
|
||||||
$this->db->query($sql,array($uuid,$userid,1));
|
$this->db->query($sql,array($uuid,$userid,1));
|
||||||
//成功信息提示
|
//成功信息提示
|
||||||
|
@ -1091,7 +1094,9 @@ class DataController extends Zend_Controller_Action
|
||||||
$this->view->md=$this->db->fetchRow($sql);
|
$this->view->md=$this->db->fetchRow($sql);
|
||||||
} else {
|
} else {
|
||||||
if ($r1['datacount']>=1)
|
if ($r1['datacount']>=1)
|
||||||
$this->view->msg="错误:您申请的数据已经在数据蓝中!";
|
$this->view->msg="错误:您申请的数据已经在数据蓝中!";
|
||||||
|
elseif ($r2['mdcount']==0)
|
||||||
|
$this->view->msg="错误:您申请的数据不存在。";
|
||||||
else
|
else
|
||||||
$this->view->msg="错误:您正在进行的离线申请的数据数已经超过系统允许的最大值,请在完成本次离线申请后再进行操作!";
|
$this->view->msg="错误:您正在进行的离线申请的数据数已经超过系统允许的最大值,请在完成本次离线申请后再进行操作!";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue