add author/fund and fixed a bug in /admin/data/fund

This commit is contained in:
Li Jianxuan 2013-04-21 09:08:43 +00:00
parent 2921d1c5b9
commit 9fb68755a7
10 changed files with 4586 additions and 4068 deletions

View File

@ -89,7 +89,11 @@ table thead tr th {background:#EBF2F6;}
<?php $autoindex=0;
foreach ($this->paginator as $item):
$autoindex++;?>
<?php if(empty($this->md)) { ?>
<tr id="DataLine_<?= $item['id']?>">
<?php }else{?>
<tr id="DataLine_<?= $item['mfid']?>">
<?php }?>
<td><?= $item['title'] ?></td>
<td><?= $item['fund_id'] ?></td>
<td><?= $item['fund_type'] ?></td>

View File

@ -1587,7 +1587,7 @@ class AuthorController extends Zend_Controller_Action
$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))
{
$sql = "SELECT u.realname,u.unit,u.email,m.title,m.uuid FROM normalmetadata m
$sql = "SELECT u.realname,u.unit,u.email,m.title,m.description FROM normalmetadata m
LEFT JOIN mdauthor a ON m.uuid=a.uuid
LEFT JOIN users u ON u.id=a.userid
WHERE status>=0 AND m.uuid=? AND a.status=1
@ -3750,6 +3750,205 @@ class AuthorController extends Zend_Controller_Action
}//metadata()
public function fundAction()
{
//$this->_helper->layout->setLayout('administry');
$ac = $this->_getParam('ac');
$submit = $this->_getParam('submit');
include_once("data/Fund.php");
$fund = new Fund($this->db);
$auth = Zend_Auth::getInstance();
if($auth->hasIdentity())
{
$user = $auth->getIdentity();
$uid = $user->id;
}else{
exit("请重新登录");
}
if($ac=='index' || empty($ac))
{
$uuid = $this->_getParam('uuid');
if(empty($uuid))
{
$rows = $fund->fetch(0,true,$uid);
$fund->addPaginator($rows,$this->view,$this->_request);
}else{
include('data/Metadata.php');
$md = new Metadata($this->db);
$this->view->md = $md->view($uuid);
$rows = $fund->fetch($uuid);
$fund->addPaginator($rows,$this->view,$this->_request);
}
return true;
}
if($ac == "add")
{
$this->_helper->viewRenderer('fund-add');
if(!empty($submit))
{
$data = $fund->_getParams($this->_request);
$data['userid'] = $uid;
if($fund->add($data) == true)
{
$this->view->AlertType = "alert-success";
$this->view->msg = "添加成功!";
$this->view->jump_url = "/author/fund/";
return true;
}else{
$this->view->data = $data;
$this->view->error = "添加失败,请重试";
return true;
}
}
return true;
}//add
if($ac == "edit")
{
$this->_helper->viewRenderer('fund-add');
$id = $this->_getParam('id');
if(empty($id))
{
$this->view->AlertType = "alert-error";
$this->view->msg = "参数错误";
$this->view->jump_url = "/author/fund/";
}
if(!empty($submit))
{
$data = $fund->_getParams($this->_request);
$data['userid'] = $uid;
$state = $fund->update($data,$id,$uid);
if( $state == true)
{
$this->view->AlertType = "alert-success";
$this->view->msg = "修改成功!";
$this->view->jump_url = "/author/fund/";
return true;
}else{
$this->view->data = $data;
if(is_string($state))
{
$this->view->error = $state;
}else{
$this->view->error = "修改失败,请重试";
}
return true;
}
}else{
$this->view->data = $fund->view($id);
}
return true;
}//edit
if($ac == "del")
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$id = $this->_getParam('id');
if(empty($id))
{
$this->jsonexit(array('error'=>'参数错误'));
return true;
}
if($fund->delete($id,$uid) == true)
{
$this->jsonexit(array('success'=>$id));
return true;
}else{
$this->jsonexit(array('error'=>'删除失败'));
return true;
}
}//del
if($ac == "formd")
{
$uuid = $this->_getParam('uuid');
if(empty($uuid))
{
$this->view->AlertType = "alert-error";
$this->view->msg = "参数错误";
$this->view->jump_url = "/admin/data/fund/";
}
$id = $this->_getParam('id');
$order = $this->_getParam('order');
if(!empty($id))
{
if($fund->addToMdfund($uuid,$id,$order))
{
$this->view->AlertType = "alert-success";
$this->view->error = "添加成功!可以继续选择并添加";
}else{
$this->view->AlertType = "alert-error";
$this->view->error = "添加失败!该数据可能已被添加";
}
}
$mfid = $this->_getParam('mfid');
if(!empty($mfid))
{
if($fund->changeorder($mfid,$order))
{
$this->view->AlertType = "alert-success";
$this->view->error = "排序修改成功!";
}else{
$this->view->AlertType = "alert-error";
$this->view->error = "排序修改失败!";
}
$rows = $fund->fetch($uuid,true,$uid);
}else{
$this->view->ct = "ct";
$rows = $fund->fetch($uuid,false,$uid);
}
include('data/Metadata.php');
$md = new Metadata($this->db);
$this->view->md = $md->view($uuid);
$fund->addPaginator($rows,$this->view,$this->_request);
return true;
}//formd
if($ac == "mdfunddel")
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$id = $this->_getParam('id');
if(empty($id))
{
$this->jsonexit(array('error'=>'参数错误'));
return true;
}
if($fund->mfdelete($id) == true)
{
$this->jsonexit(array('success'=>$id));
return true;
}else{
$this->jsonexit(array('error'=>'删除失败'));
return true;
}
}//mdfunddel
}//fund
/*
* jsonexit() 退出并返回json数据
*

View File

@ -7,12 +7,13 @@
$this->breadcrumb('<a href="/account/register">用户注册</a>');
$this->breadcrumb()->setSeparator(' > ');
?>
<div id="info">
<img src="/images/pass_login1.gif" />&nbsp;确认服务条款&nbsp;&nbsp;
<img src="/images/pass_pic_arrowhead_2.gif" />&nbsp;&nbsp;
<img src="/images/pass_login2.gif" />&nbsp;填写基本信息&nbsp;&nbsp;
<img src="/images/pass_pic_arrowhead_2.gif" />&nbsp;&nbsp;
<img src="/images/pass_login3.gif" />&nbsp;注册完成
<?php echo $this->form;?></div>
<div class="row-fluit">
<div class="span12">
<img src="/images/pass_login1.gif" />&nbsp;确认服务条款&nbsp;&nbsp;
<img src="/images/pass_pic_arrowhead_2.gif" />&nbsp;&nbsp;
<img src="/images/pass_login2.gif" />&nbsp;填写基本信息&nbsp;&nbsp;
<img src="/images/pass_pic_arrowhead_2.gif" />&nbsp;&nbsp;
<img src="/images/pass_login3.gif" />&nbsp;注册完成
<?php echo $this->form;?>
</div>
</div>

View File

@ -47,7 +47,8 @@ $this->breadcrumb()->setSeparator(' > ');
<?php } if($item['mdstatus']==7){ ?>
| <a href="/author/delegate/ac/cancel/uuid/<?php echo $item['uuid'];?>" onclick="return confirm('是否确定取消该数据的委托?');">取消委托</a>
<?php }?> |
<a href="/author/sendmail/uuid/<?php echo $item['uuid']; ?>">邮件通知</a>
<a href="/author/sendmail/uuid/<?php echo $item['uuid']; ?>">邮件通知</a> |
<a href="/author/fund/ac/formd/uuid/<?php echo $item['uuid']; ?>">支持项目</a>
</span>
<?php endif; ?>

View File

@ -0,0 +1,91 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->author);
$this->headTitle()->setSeparator(' - ');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/author">数据作者</a>');
$this->headLink()->appendStylesheet('/css/author.css');
$this->breadcrumb('申请成为元数据作者');
$this->breadcrumb()->setSeparator(' > ');
$this->theme->AppendPlus($this,'colorbox');
$this->theme->AppendPlus($this,'admin_plugin');
?>
<div class="row-fluid">
<div class="span3">
<?= $this->partial('author/navi.phtml'); ?>
</div>
<div class="span9">
<div>
<ul class="nav nav-tabs">
<li><a href="/author/fund/">所有项目</a></li>
<li class="active"><a href="/author/fund/ac/add">添加新项目</a></li>
</ul>
</div>
<div class="">
<?php if(!empty($this->error)) { ?>
<div class="alert alert-block alert-error fade in" id="Alert-error-box">
<a class="close" data-dismiss="alert" href="#">×</a>
<?php if(!is_array($this->error)) { ?><h4 class="alert-heading"><?= $this->error ?></h4><?php } else { ?>
<ul>
<?php foreach($this->error as $v) { ?>
<li><?= $v ?></li>
<?php } ?>
</ul>
<?php } ?>
</div>
<?php } ?>
<?php if(!empty($this->msg)) { ?>
<div class="alert <?= $this->AlertType;?>">
<a data-dismiss="alert" class="close">×</a>
<?php echo $this->msg ?>
</div>
<?php if(!empty($this->jump_url)) { ?>
<script language="javascript">setTimeout("self.location='<?php echo $this->jump_url ?>'",3000);</script>
<?php } ?>
<?php } else{ ?>
<form class="form-horizontal" method="post">
<div class="control-group">
<label class="control-label" for="title">项目名称</label>
<div class="controls">
<input type="text" id="title" class="span12" name="title" value="<?= isset($this->data['title']) ? $this->data['title']:"" ?>" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="fund_id">编号</label>
<div class="controls">
<input type="text" id="fund_id" name="fund_id" value="<?= isset($this->data['fund_id']) ? $this->data['fund_id']:"" ?>" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="fund_type">类型</label>
<div class="controls">
<input type="text" id="fund_type" name="fund_type" value="<?= isset($this->data['fund_type']) ? $this->data['fund_type']:"" ?>" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="title_en">英文名称</label>
<div class="controls">
<input type="text" id="title_en" name="title_en" value="<?= isset($this->data['title_en']) ? $this->data['title_en']:"" ?>" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="fund_type_en">英文类型</label>
<div class="controls">
<input type="text" id="fund_type_en" name="fund_type_en" value="<?= isset($this->data['fund_type_en']) ? $this->data['fund_type_en']:"" ?>" />
</div>
</div>
<div class="control-group">
<div class="controls">
<input type="hidden" name="submit" value="1" />
<?php if(!empty($this->id)) { ?>
<input type="hidden" name="id" value=" <?=$this->id?> " />
<?php } ?>
<button type="submit" class="btn btn-primary">提交</button>
</div>
</div>
</form>
<?php } ?>
</div>
</div>
</div>
<!-- //页面内容 -->

View File

@ -0,0 +1,165 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->author);
$this->headTitle()->setSeparator(' - ');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/author">数据作者</a>');
$this->headLink()->appendStylesheet('/css/author.css');
$this->breadcrumb('申请成为元数据作者');
$this->breadcrumb()->setSeparator(' > ');
$this->theme->AppendPlus($this,'colorbox');
$this->theme->AppendPlus($this,'admin_plugin');
?>
<style>
table thead tr th {background:#EBF2F6;}
</style>
<div class="row-fluid">
<div class="span3">
<?= $this->partial('author/navi.phtml'); ?>
</div>
<div class="span9">
<div>
<ul class="nav nav-tabs">
<li class="active"><a href="/author/fund/">所有项目</a></li>
<li><a href="/author/fund/ac/add">添加新项目</a></li>
</ul>
</div>
<?php if(!empty($this->md)) { ?>
<div>
<?php if(empty($this->ct)) { ?>
<a class="btn btn-primary pull-right" href="/author/fund/ac/formd/uuid/<?= $this->md['uuid'] ?>"><i class="icon-plus"></i>为此数据添加项目</a>
<?php }else{ ?>
<a class="pull-right btn" href="/author/fund/uuid/<?= $this->md['uuid'] ?>">返回</a>
<div class="pull-right label label-info">点击“添加此项目”即可将项目添加到元数据</div>
<?php } ?>
<h3><?= $this->md['title'] ?>》 的支持项目</h3>
<hr />
</div>
<?php } ?>
<div>
<div class="input-append">
<form id="datasearch" class="search_form" action="">
<input type="text" id="keyword" name="q" value="<?php if(!empty($this->q)) echo $this->q; ?>" />
<button type="submit" class="btn" id="search_btn">搜索</button>
</form>
</div>
</div>
<?php if(!empty($this->error)) { ?>
<?php if(empty($this->AlertType)) $AlertType = "alert-error";else $AlertType = $this->AlertType;?>
<div class="alert alert-block fade in <?= $AlertType ?>" id="Alert-error-box">
<a class="close" data-dismiss="alert" href="#">×</a>
<?php if(!is_array($this->error)) { ?><h4 class="alert-heading"><?= $this->error ?></h4><?php } else { ?>
<ul>
<?php foreach($this->error as $v) { ?>
<li><?= $v ?></li>
<?php } ?>
</ul>
<?php } ?>
</div>
<?php } ?>
<?php if(!empty($this->msg)) { ?>
<div class="alert <?= $this->AlertType;?>">
<a data-dismiss="alert" class="close">×</a>
<?php echo $this->msg ?>
</div>
<?php if(!empty($this->jump_url)) { ?>
<script language="javascript">setTimeout("self.location='<?php echo $this->jump_url ?>'",3000);</script>
<?php } ?>
<?php } else{ ?>
<div id="datalist">
<?php if (count($this->paginator)): ?>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>名称</th>
<th>编号</th>
<th>类型</th>
<?php if($this->md) { ?>
<th width="80">排序</th>
<?php }else{ ?>
<th>英文标题</th>
<th>英文类型</th>
<?php } ?>
<?php if($this->ct) { ?>
<th>添加</th>
<?php } ?>
<th width="70">操作</th>
</tr>
</thead>
<tbody>
<?php $autoindex=0;
foreach ($this->paginator as $item):
$autoindex++;?>
<?php if(empty($this->md)) { ?>
<tr id="DataLine_<?= $item['id']?>">
<?php }else{?>
<tr id="DataLine_<?= $item['mfid']?>">
<?php }?>
<td><?= $item['title'] ?></td>
<td><?= $item['fund_id'] ?></td>
<td><?= $item['fund_type'] ?></td>
<?php if($this->md) { ?>
<?php if($this->ct) { ?>
<td><input type="text" name="order" id="order_<?= $item['id']?>" class="span12" /></td>
<?php }else{ ?>
<td><input type="text" name="order" id="order_<?= $item['mfid']?>" class="span12" value="<?= $item['place'] ?>" /></td>
<?php }?>
<?php }else{ ?>
<td><?= $item['title_en'] ?></td>
<td><?= $item['fund_type_en'] ?></td>
<?php } ?>
<?php if($this->ct) { ?>
<td><a href="javascript:void(0);" class="addtomd" rel="<?= $item['id']?>">添加此项目</a></td>
<?php } ?>
<td>
<?php if(empty($this->md)) { ?>
<a href="/author/fund/ac/edit/id/<?= $item['id']?>">编辑</a>
<a href="javascript:void(0);" onclick="onedel(<?= $item['id']?>)" id="delbtn_<?= $item['id']?>">删除</a>
<?php }else{ ?>
<?php if(empty($this->ct)) { ?><a href="javascript:void(0);" class="changeorder" rel="<?= $item['mfid']?>">排序</a> <?php } ?>
<a href="javascript:void(0);" onclick="onedel(<?= $item['mfid']?>)" id="delbtn_<?= $item['mfid']?>">移除</a>
<?php } ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
<?php } ?>
</div>
</div>
<!-- //页面内容 -->
<script>
<?php if(!empty($this->ct)) { ?>
$('.addtomd').each(function(index, element) {
$(this).click(function(){
id = $(this).attr('rel');
order = $('#order_'+id).val();
self.location='/author/fund/ac/formd/uuid/<?= $this->md['uuid'] ?>/id/'+id+'/order/'+ order
});
});
<?php }else{ ?>
$('.changeorder').each(function(index, element) {
$(this).click(function(){
id = $(this).attr('rel');
order = $('#order_'+id).val();
self.location='/author/fund/ac/formd/uuid/<?= $this->md['uuid'] ?>/mfid/'+id+'/order/'+ order
});
});
<?php } ?>
<?php if(empty($this->md)) { ?>
var info = {
btn_prefix : "delbtn_",
item_prefix : "DataLine_",
url : "/author/fund/ac/del"
}
<?php }else{ ?>
var info = {
btn_prefix : "delbtn_",
item_prefix : "DataLine_",
url : "/author/fund/ac/mdfunddel/uuid/<?= $this->md['uuid'] ?>"
}
<?php } ?>
</script>

View File

@ -10,6 +10,7 @@
<li id="Nav-author-document"><a href="/author/document"><i class="icon-chevron-right"></i>数据文档管理</a></li>
<li id="Nav-author-news"><a href="/author/news"><i class="icon-chevron-right"></i>数据新闻管理</a></li>
<li id="Nav-author-version"><a href="/author/version"><i class="icon-chevron-right"></i>数据版本管理</a></li>
<li id="Nav-author-version"><a href="/author/fund"><i class="icon-chevron-right"></i>支持项目</a></li>
<!--
<li><a href="/author/survey">数据调查</a></li>
<li><a href="/author/qa">数据QA</a></li> -->

View File

@ -2,47 +2,41 @@
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->author);
$this->headTitle()->setSeparator(' - ');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headLink()->appendStylesheet('/css/author.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/author">数据作者</a>');
$this->breadcrumb('查看数据申请记录');
$this->breadcrumb()->setSeparator(' > ');
?>
<!-- 左侧导航 -->
<div id='sidebar'>
<div id='leftnavi'>
<div class="row">
<div class="span3">
<?= $this->partial('author/navi.phtml'); ?>
</div>
</div>
<!-- //左侧导航 -->
<!-- 页面内容 -->
<div id="wapper">
<div class="span9">
<?php
if(!empty($this->error))
{
echo $this->error;
}
?>
<div id="tabs-controller">
<ul>
<li class="box-shadow"><a class="text-shadow" href="/author/inauthor/ac/online">在线下载记录</a></li>
<li class="box-shadow"><a class="text-shadow" href="/author/inauthor/ac/offline">离线申请记录</a></li>
<li class="box-shadow active"><a class="text-shadow" href="/author/inauthor/ac/datalist">按数据查看</a></li>
<div>
<ul class="nav nav-pills">
<li><a href="/author/inauthor/ac/online">在线下载记录</a></li>
<li><a href="/author/inauthor/ac/offline">离线申请记录</a></li>
<li class="active"><a href="/author/inauthor/ac/datalist">按数据查看</a></li>
</ul>
</div>
<div id="datalist">
<div>
<?php
if (count($this->paginator)):
echo "<h2>申请记录:".$this->mdtitle."</h2>";
echo "<ul>";
echo '<ul class="unstyled">';
$autoindex=0;
foreach ($this->paginator as $item):
$autoindex++;
if(!empty($item['offa_id'])) :
?>
<li>
<li class="well well-small">
<p>【离线申请】<?php echo $item['offa_name'];?> (<?php echo $item['offa_email'];?>)</p>
<p>申请时间:<?php echo $item['offa_tscreated'];?></p>
<p>单位:<?php echo $item['offa_unit'];?></p>
@ -54,7 +48,7 @@ $this->breadcrumb()->setSeparator(' > ');
endif;
if(!empty($item['ona_id'])):
?>
<li>
<li class="well well-small">
<p>【在线下载记录】<?php echo $item['ona_name'];?> (<?php echo $item['ona_email'];?>)</p>
<p>申请时间:<?php echo $item['ona_tscreated'];?></p>
<p>单位:<?php echo $item['ona_unit'];?></p>
@ -69,6 +63,7 @@ $this->breadcrumb()->setSeparator(' > ');
</div>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
</div>
<!-- //页面内容 -->
<script>
$('#wapper').width($('body').width()-300);

View File

@ -15,29 +15,51 @@ class Fund extends Zend_Controller_Plugin_Abstract
$this->auth = $auth;
}
function fetch($uuid = "",$include = true){
function fetch($uuid = "",$include = true,$uid=0){
if(empty($uuid))
{
if(empty($uid))
{
$sql = "SELECT * FROM ".$this->tbl_fund." ORDER BY id DESC";
}else{
$sql = "SELECT * FROM ".$this->tbl_fund." WHERE userid=$uid ORDER BY id DESC";
}
$rs = $this->db->query($sql);
$rows = $rs->fetchAll();
return $rows;
}else{
$wheresql = array();
if($include)
{
$sql = "SELECT f.*,mf.place,mf.id as mfid FROM ".$this->tbl_fund." f
LEFT JOIN ".$this->tbl_mdfund." mf ON mf.fid=f.id
WHERE uuid='$uuid'
ORDER BY mf.place DESC";
$wheresql[] = " mf.uuid='$uuid' ";
}else{
$fids = $this->getMdFunds($uuid);
if(count($fids)>0)
{
$fids = ' WHERE f.id NOT IN ('.join(",",$fids).')';
}else{
$fids = "";
$wheresql[] = ' f.id NOT IN ('.join(",",$fids).')';
}
$sql = "SELECT f.* FROM ".$this->tbl_fund." f $fids ORDER BY f.id DESC";
}
if(!empty($uid) && is_int($uid))
{
$wheresql[] = " f.userid='$uid' ";
}
if(count($wheresql)>0)
{
$wheresql = " WHERE ".join(" AND ",$wheresql);
}else{
$wheresql = "";
}
if($include)
{
$sql = "SELECT f.*,mf.place,mf.id as mfid FROM ".$this->tbl_fund." f
LEFT JOIN ".$this->tbl_mdfund." mf ON mf.fid=f.id
$wheresql
ORDER BY mf.place DESC";
}else{
$sql = "SELECT f.* FROM ".$this->tbl_fund." f $wheresql ORDER BY f.id DESC";
}
$rs = $this->db->query($sql);
$rows = $rs->fetchAll();
@ -52,17 +74,35 @@ class Fund extends Zend_Controller_Plugin_Abstract
return $dbh->insert($this->tbl_fund,$data);
}
function update($data,$id)
function update($data,$id,$uid=0)
{
include_once("helper/dbh.php");
$dbh = new dbh($this->db);
if(empty($id))
if(!is_numeric($id))
{
return "参数错误";
}
$state = $dbh->update($this->tbl_fund,$data,"id=$id",true);
if(!empty($uid))
{
if(!is_numeric($uid))
{
return "参数错误";
}
$sql = "SELECT * FROM ".$this->tbl_fund." WHERE userid=$uid AND id=$id";
$rs = $this->db->query($sql);
$row = $rs->fetch();
if(empty($row['id']))
{
return "您无权修改这条记录";
}
$condition = " id=$id AND userid=$uid ";
}else{
$condition = " id=$id ";
}
include_once("helper/dbh.php");
$dbh = new dbh($this->db);
$state = $dbh->update($this->tbl_fund,$data,$condition,true);
if( $state == true)
{
@ -72,8 +112,29 @@ class Fund extends Zend_Controller_Plugin_Abstract
}
}
function delete($id){
$sql = "DELETE FROM ".$this->tbl_fund." WHERE id=$id";
function delete($id,$uid=0){
if(!is_numeric($id))
{
return "参数错误";
}
if(!empty($uid))
{
if(!is_numeric($uid))
{
return "参数错误";
}
$sql = "SELECT * FROM ".$this->tbl_fund." WHERE userid=$uid AND id=$id";
$rs = $this->db->query($sql);
$row = $rs->fetch();
if(empty($row['id']))
{
return "您无权修改这条记录";
}
$condition = " id=$id AND userid=$uid ";
}else{
$condition = " id=$id ";
}
$sql = "DELETE FROM ".$this->tbl_fund." WHERE $condition";
return $this->db->exec($sql);
}