select_all('recycle', $whereData); } /** * 获取回收站详情 * @param $whereData 查询条件 * @param array $data 自定义处理数组 * @return array|bool|false|string|void */ function getInfo($whereData, $data = array()) { if (!empty($whereData)) { $data['field'] = empty($data['field']) ? '*' : $data['field']; $Info = $this->select_once('recycle', $whereData, $data['field']); } return $Info; } /** * 创建回收站 * @param $data * @return mixed */ function addInfo($data) { if (isset($data) && !empty($data)) { $return['id'] = $this->insert_into('outside', $data); $return['msg'] = '回收站(ID:' . $return['id'] . ')'; $return['errcode'] = $return['id'] ? '9' : '8'; $return['msg'] = $return['id'] ? $return['msg'] . '添加成功!' : $return['msg'] . '添加失败!'; return $return; } } /** * @desc 恢复数据,单表恢复 * @param array $where * @return array */ function recoverTb($where = array()) { $return = array( 'errcode' => 8, 'msg' => '' ); if (!empty($where)) { $id = $where['id']; if (is_array($id)) { $ids = $id; } else { $ids = @explode(',', $id); } $recycleList = $this->getList(array('id' => array('in', pylode(',', $ids)))); if (!empty($recycleList)) { foreach ($recycleList as $v) { $body = unserialize($v['body']); $this->insert_into($v['tablename'], $body); $this->delRecycle(array('id' => $v['id'])); } $return['errcode'] = 9; $return['msg'] = '数据恢复成功!'; } else { $return['msg'] = '请选择有效数据进行恢复!'; } } else { $return['msg'] = '参数错误!'; } return $return; } /** * @desc 恢复数据,一键恢复,通过删除插入的总记录进行查询恢复 * @param array $where * @return array */ function recoverByIdent($where = array()) { $return = array( 'errcode' => 8, 'msg' => '' ); if (!empty($where)) { $rLists = $this->getList($where); if (isset($rLists) && !empty($rLists)) { foreach ($rLists as $v) { $body = unserialize($v['body']); $this->insert_into($v['tablename'], $body); $this->delRecycle(array('id' => $v['id'])); } $return['errcode'] = 9; $return['msg'] = '数据恢复成功!'; } else { $return['msg'] = '请选择有效数据进行恢复!'; } } else { $return['msg'] = '参数错误!'; } return $return; } /** * 删除数据调用 * @param $whereData 查询条件 istime 是否根据时间删除 * @return mixed */ function delRecycle($whereData) { if ($whereData) { if (is_array($whereData['id'])) { $delId = $whereData['id'][1]; } else { $delId = $whereData['id']; } $return['id'] = $this->delete_all('recycle', $whereData, '', '', '1'); $return['msg'] = '回收站数据(ID:' . $delId . ')'; $return['errcode'] = $return['id'] ? '9' : '8'; $return['msg'] = $return['id'] ? $return['msg'] . '删除成功!' : $return['msg'] . '删除失败!'; } else { $return['msg'] = '请选择您要删除的信息!'; $return['errcode'] = 8; } return $return; } }