fix bug #106. 处理重复申请数据的问题

This commit is contained in:
wlx 2009-12-24 13:58:54 +00:00
parent 36044538ab
commit 620afdfaec
2 changed files with 6 additions and 3 deletions

View File

@ -744,14 +744,17 @@ class DataController extends Zend_Controller_Action
//首先判断离线申请的数据数量是否超过系统限制 //首先判断离线申请的数据数量是否超过系统限制
$sql="select count(*) as datacount from dataorder where (ts_approved is null) and userid=? and status>0 and status<6"; $sql="select count(*) as datacount from dataorder where (ts_approved is null) and userid=? and status>0 and status<6";
$r=$this->db->fetchRow($sql,array($userid)); $r=$this->db->fetchRow($sql,array($userid));
if ($r['datacount']<$this->view->config->download->max) { //保证添加的离线数据申请未申请
$sql="select count(*) as datacount from dataorder where (ts_approved is null) and userid=? and uuid=? and status=1";
$r1=$this->db->fetchRow($sql,array($userid,$uuid));
if ($r['datacount']<$this->view->config->download->max && $r1['datacount']<1) {
$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));
//成功信息提示 //成功信息提示
$sql=$this->db->quoteInto("select title,uuid from metadata where uuid=?",$uuid); $sql=$this->db->quoteInto("select title,uuid from metadata where uuid=?",$uuid);
$this->view->md=$this->db->fetchRow($sql); $this->view->md=$this->db->fetchRow($sql);
} else { } else {
$this->view->msg="错误:您正在进行的离线申请的数据数已经超过系统允许的最大值,请在完成本次离线申请后再进行操作!"; $this->view->msg="错误:您正在进行的离线申请的数据数已经超过系统允许的最大值,请在完成本次离线申请后再进行操作!或者您申请的数据已经在数据蓝中。";
} }
} elseif ($del) { } elseif ($del) {
//删除数据申请 //删除数据申请

View File

@ -38,7 +38,7 @@
<?php endif; ?> <?php endif; ?>
<?php if ($this->dataorder1) : ?> <?php if ($this->dataorder1) : ?>
<div id="dataorder1"> <div id="dataorder1">
<h1>准备提交的离线申请(<a href="/data/order/apply/all">提交所有离线申请</a> <a href="">下载所有在线数据</a></h1> <h1>准备提交的离线申请(<a href="/data/order/apply/all">提交所有离线申请</a></h1>
<ul class="title"><li class="time">申请时间</li> <ul class="title"><li class="time">申请时间</li>
<li class="datatype">数据类型</li> <li class="datatype">数据类型</li>
<li class="name">数据名称</li> <li class="name">数据名称</li>