增加离线申请限制

This commit is contained in:
wlx 2014-06-24 23:58:46 +00:00
parent eed79dc33a
commit 867b746458
1 changed files with 6 additions and 2 deletions

View File

@ -153,9 +153,13 @@ class Order
$uid = view::User('id'); $uid = view::User('id');
} }
$sql = "select count(*) as cnt from dataorder where status=1 and uuid in (select uuid from en.mdstatus) and userid=".$uid;
$row=$this->db->FetchRow($sql);
if ($row['cnt']>=$this->config->download->max) return "Reached the maximum limits of one offline application. Please remove some data.";
if($id == -1) if($id == -1)
{ {
$sql = $this->db->quoteInto("update dataorder set status=2 where status=1 and userid=?",$uid); $sql = $this->db->quoteInto("update dataorder set status=2 where status=1 and uuid in (select uuid from en.mdstatus) and userid=?",$uid);
if($this->db->exec($sql)) if($this->db->exec($sql))
{ {
return true; return true;
@ -166,7 +170,7 @@ class Order
if($id > 0) if($id > 0)
{ {
$sql = $this->db->quoteInto("update dataorder set status=2 where status=1 and userid=$uid and id=?",$id); $sql = $this->db->quoteInto("update dataorder set status=2 where status=1 and uuid in (select uuid from en.mdstatus) and userid=$uid and id=?",$id);
if($this->db->exec($sql)) if($this->db->exec($sql))
{ {
return true; return true;