消除在线下载记录错误问题,即缺少对应onlineappid

This commit is contained in:
wlx 2012-01-07 11:06:27 +00:00
parent fb87096e6e
commit 91d0989216
1 changed files with 6 additions and 5 deletions

View File

@ -1003,7 +1003,7 @@ class DataController extends Zend_Controller_Action
} }
else else
{ {
$sql="select onlineappid,id from dataorder where userid='$userid' and uuid='$uuid' order by id desc"; $sql="select onlineappid,id from dataorder where status=0 and userid='$userid' and uuid='$uuid' order by id desc";
$re=$this->db->query($sql); $re=$this->db->query($sql);
$row=$re->fetch(); $row=$re->fetch();
if(empty($row['onlineappid'])) if(empty($row['onlineappid']))
@ -1011,12 +1011,13 @@ class DataController extends Zend_Controller_Action
$data = array( $data = array(
'userid' => $userid, 'userid' => $userid,
'uuid' => $uuid, 'uuid' => $uuid,
'onlineappid'=> $onlineappid, 'onlineappid'=> $onlineappid,
'ts_approved'=>'now()',
); );
try {$this->db->insert('dataorder',$data);} catch (Exception $e) {} try {$this->db->insert('dataorder',$data);} catch (Exception $e) {}
}else }else
{ {
$sql="update dataorder set onlineappid='$onlineappid' where id='{$row['id']}'"; $sql="update dataorder set onlineappid='$onlineappid',ts_approved=now() where id='{$row['id']}'";
try {$this->db->exec($sql);} catch (Exception $e) {} try {$this->db->exec($sql);} catch (Exception $e) {}
} }
} }
@ -1107,12 +1108,12 @@ class DataController extends Zend_Controller_Action
@$this->view->links=$links; @$this->view->links=$links;
//更新下载记录 //更新下载记录
//todo: 尝试添加一个RULE若有对应数据存在则不插入 userid,uuid,status=0,ts_approved:null) //todo: 尝试添加一个RULE若有对应数据存在则不插入 userid,uuid,status=0,ts_approved:null)
$sql="select * from dataorder where userid=? and uuid=? and status=0 and (ts_approved is null)"; /*$sql="select * from dataorder where userid=? and uuid=? and status=0 and (ts_approved is null)";
$u=$this->db->fetchRow($sql,array($userid,$uuid)); $u=$this->db->fetchRow($sql,array($userid,$uuid));
if (empty($u)) { if (empty($u)) {
$sql="insert into dataorder (userid,uuid,ts_created) values(?,?,now())"; $sql="insert into dataorder (userid,uuid,ts_created) values(?,?,now())";
$this->db->query($sql,array($userid,$uuid)); $this->db->query($sql,array($userid,$uuid));
} }*/
} }
/* /*
* 离线申请(可以包括在线数据),在无数据参数时,则显示已有列表 * 离线申请(可以包括在线数据),在无数据参数时,则显示已有列表