Ticket # 303 修复了对离线申请记录操作的逻辑错误
This commit is contained in:
parent
e880df2546
commit
7665772a9a
|
@ -108,6 +108,7 @@ class AuthorController extends Zend_Controller_Action
|
|||
if($ac == "offline")
|
||||
{
|
||||
$pr = $this->_request->getParam('pr');
|
||||
$oid = $this->_request->getParam('oid');
|
||||
|
||||
if(!empty($pr))
|
||||
{
|
||||
|
@ -116,20 +117,22 @@ class AuthorController extends Zend_Controller_Action
|
|||
$this->_helper->viewRenderer->setNoRender();
|
||||
|
||||
$uuid = $this->_request->getParam('uuid');
|
||||
|
||||
if(!preg_match("/^[0-9A-Za-z]{8}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{12}$/",$uuid))
|
||||
{
|
||||
echo "参数有误!";exit();
|
||||
}
|
||||
|
||||
//如果用户已经下载过了,就无法在更改对数据申请的意见
|
||||
$sql = "select md.title,d.uuid,d.status as datastatus,d.authorpermitted from offlineapp o
|
||||
left join dataorder d on o.id=d.offlineappid
|
||||
left join metadata md on md.uuid=d.uuid
|
||||
left join mdauthor a on a.uuid=d.uuid
|
||||
where o.ts_approved is null and o.pdflink is not null and d.uuid=? and a.userid=?
|
||||
where o.ts_approved is null and o.pdflink is not null and d.uuid=? and a.userid=? and d.offlineappid=?
|
||||
order by o.ts_created desc";
|
||||
|
||||
$sth = $this->db->prepare($sql);
|
||||
$sth->execute(array($uuid,$u_id));
|
||||
$sth->execute(array($uuid,$u_id,$oid));
|
||||
$row = $sth->fetch();
|
||||
|
||||
if($row['datastatus']>4)
|
||||
|
@ -138,13 +141,14 @@ class AuthorController extends Zend_Controller_Action
|
|||
exit();
|
||||
}
|
||||
|
||||
//同意用户下载
|
||||
if($pr=="confrim")
|
||||
{
|
||||
$sql = "UPDATE dataorder SET authorpermitted=1 WHERE uuid=?";
|
||||
$sql = "UPDATE dataorder SET authorpermitted=1 WHERE uuid=? AND offlineappid=?";
|
||||
$sth = $this->db->prepare($sql);
|
||||
if($sth->execute(array($uuid)))
|
||||
if($sth->execute(array($uuid,$oid)))
|
||||
{
|
||||
$btn = $this->createOfflineCtBtn($uuid,'c');
|
||||
$btn = $this->createOfflineCtBtn($uuid,'c',$oid);
|
||||
echo ''.$btn.'<script>alert("您已经同意用户的离线数据申请");</script>';
|
||||
exit();
|
||||
}else{
|
||||
|
@ -152,13 +156,15 @@ class AuthorController extends Zend_Controller_Action
|
|||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
//反对用户下载
|
||||
if($pr == "objection")
|
||||
{
|
||||
$sql = "UPDATE dataorder SET authorpermitted=-1 WHERE uuid=?";
|
||||
$sql = "UPDATE dataorder SET authorpermitted=-1 WHERE uuid=? AND offlineappid=?";
|
||||
$sth = $this->db->prepare($sql);
|
||||
if($sth->execute(array($uuid)))
|
||||
if($sth->execute(array($uuid,$oid)))
|
||||
{
|
||||
$btn = $this->createOfflineCtBtn($uuid,'o');
|
||||
$btn = $this->createOfflineCtBtn($uuid,'o',$oid);
|
||||
echo ''.$btn.'<script>alert("您已经反对用户的离线数据申请");</script>';
|
||||
exit();
|
||||
}else{
|
||||
|
@ -190,11 +196,11 @@ class AuthorController extends Zend_Controller_Action
|
|||
foreach ($rows as $k=>$v)
|
||||
{
|
||||
if($v['authorpermitted']==0)
|
||||
{$rows[$k]['btns']=$this->createOfflineCtBtn($v['uuid'],'');}
|
||||
{$rows[$k]['btns']=$this->createOfflineCtBtn($v['uuid'],'',$v['id']);}
|
||||
if($v['authorpermitted']>0)
|
||||
{$rows[$k]['btns']=$this->createOfflineCtBtn($v['uuid'],'c');}
|
||||
{$rows[$k]['btns']=$this->createOfflineCtBtn($v['uuid'],'c',$v['id']);}
|
||||
if($v['authorpermitted']<0)
|
||||
{$rows[$k]['btns']=$this->createOfflineCtBtn($v['uuid'],'o');}
|
||||
{$rows[$k]['btns']=$this->createOfflineCtBtn($v['uuid'],'o',$v['id']);}
|
||||
}
|
||||
|
||||
$paginator = Zend_Paginator::factory($rows);
|
||||
|
@ -231,11 +237,11 @@ class AuthorController extends Zend_Controller_Action
|
|||
foreach ($rows as $k=>$v)
|
||||
{
|
||||
if($v['authorpermitted']==0)
|
||||
{$rows[$k]['btns']=$this->createOfflineCtBtn($v['uuid'],'');}
|
||||
{$rows[$k]['btns']=$this->createOfflineCtBtn($v['uuid'],'',$v['id']);}
|
||||
if($v['authorpermitted']>0)
|
||||
{$rows[$k]['btns']=$this->createOfflineCtBtn($v['uuid'],'c');}
|
||||
{$rows[$k]['btns']=$this->createOfflineCtBtn($v['uuid'],'c',$v['id']);}
|
||||
if($v['authorpermitted']<0)
|
||||
{$rows[$k]['btns']=$this->createOfflineCtBtn($v['uuid'],'o');}
|
||||
{$rows[$k]['btns']=$this->createOfflineCtBtn($v['uuid'],'o',$v['id']);}
|
||||
}
|
||||
|
||||
$paginator = Zend_Paginator::factory($rows);
|
||||
|
@ -253,16 +259,16 @@ class AuthorController extends Zend_Controller_Action
|
|||
* createOfflineCtBtn() 创建离线申请记录的操作按钮
|
||||
*
|
||||
*/
|
||||
function createOfflineCtBtn($uuid, $type=""){
|
||||
function createOfflineCtBtn($uuid, $type="",$oid){
|
||||
$urlHref = 'href="javascript:;"';
|
||||
$baseStyle = "offline-ct-btns box-shadow";
|
||||
$selectedStyle = "offline-select";
|
||||
|
||||
$confrimText = "同意";
|
||||
$confrimFunc = 'onclick="confrim(\''.$uuid.'\')"';
|
||||
$confrimFunc = 'onclick="confrim(\''.$uuid.'\',\''.$oid.'\')"';
|
||||
|
||||
$objectionText = "反对";
|
||||
$objectionFunc = 'onclick="objection(\''.$uuid.'\')"';
|
||||
$objectionFunc = 'onclick="objection(\''.$uuid.'\',\''.$oid.'\')"';
|
||||
|
||||
$btns='';
|
||||
if(empty($type))
|
||||
|
|
|
@ -55,17 +55,17 @@ $this->breadcrumb()->setSeparator(' > ');
|
|||
</div>
|
||||
<!-- //页面内容 -->
|
||||
<script>
|
||||
function confrim(uuid){
|
||||
doPD(uuid,"confrim");
|
||||
function confrim(uuid,oid){
|
||||
doPD(uuid,"confrim",oid);
|
||||
}
|
||||
function objection(uuid){
|
||||
doPD(uuid,"objection");
|
||||
function objection(uuid,oid){
|
||||
doPD(uuid,"objection",oid);
|
||||
}
|
||||
function doPD(uuid,pr){
|
||||
function doPD(uuid,pr,oid){
|
||||
$.ajax({
|
||||
'type':"POST",
|
||||
'url':'/author/inauthor/ac/offline',
|
||||
'data':'pr='+ pr +'&uuid='+uuid,
|
||||
'data':'pr='+ pr +'&uuid='+uuid+'&oid='+oid,
|
||||
'success':function(html){
|
||||
$('#ct_'+uuid).html(html);$('#data_'+uuid).html('');
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue