21,887
社区成员
发帖
与我相关
我的任务
分享
function delete_dj($id) {
$ret = $this->get_row($this->_table, array('Id'=>$id));
if ($ret['status'] < 0) {
return $this->format_ret(NODATA);
}
//开始事务
$this->db->trans_begin();
try {
$ret = $this->delete($this->_table, array('Id'=>$id));
if ($ret['status'] < 0) throw new Exception('delete dj failed!');
$ret = $this->delete($this->_table.'mi', array('p_id'=>$id));
if ($ret['status'] < 0) throw new Exception('delete djmi failed!');
$ret = $this->delete($this->_table.'mx', array('dj_id'=>$id));
if ($ret['status'] < 0) throw new Exception('delete djmx failed!');
$this->db->trans_commit();
$status = SUCCESS;
} catch (Exception $e) {
$this->db->trans_rollback();
$status = ERROR;
}
return $this->format_ret($status);
}
$this->db->trans_rollback();