public function delete() { $id = urldecode($this->input['id']); if (!$id) { $this->errorOutput(OBJECT_NULL); } else { $sql = "SELECT * FROM " . DB_PREFIX . "server_config WHERE 1 AND state=1"; $q = $this->db->query($sql); $server_config = array(); while ($row = $this->db->fetch_array($q)) { $server_config[$row['id']] = $row; } $sql = "SELECT * FROM " . DB_PREFIX . "program_record WHERE id IN (" . $id . ")"; $q = $this->db->query($sql); include_once ROOT_PATH . 'lib/class/live.class.php'; $newLive = new live(); $info = array(); $channel_id = array(); while ($row = $this->db->fetch_array($q)) { $info[] = $row; $channel_id[$row['channel_id']] = $row['channel_id']; } $channel_node = $channel_parent_node = array(); if ($channel_id) { $channel = $newLive->getChannelById(implode(',', $channel_id), -1); if (!empty($channel)) { foreach ($channel as $k => $v) { $tmp_data = $newLive->getFatherNodeByid($v['node_id']); $channel_node[$v['id']] = $tmp_data[0]; $channel_parent_node[$v['id']] = $v['node_id']; } } } include_once ROOT_PATH . 'lib/class/curl.class.php'; $id_success = array(); $delete_id = $space = ""; $ret = array(); foreach ($info as $k => $row) { $this->curl = new curl($server_config[$row['server_id']]['host'] . ':' . $server_config[$row['server_id']]['port'], $server_config[$row['server_id']]['dir']); #####整合数据进行权限 $nodes = array(); $nodes['nodes'][$row['channel_id']] = $row['channel_id']; //hg_pre($nodes);exit; $this->verify_content_prms($nodes); if ($this->user['group_type'] > MAX_ADMIN_TYPE) { switch ($this->user['prms']['default_setting']['manage_other_data']) { case 1: //组织内,修改者和作者是否在同一组织 if ($this->user['org_id'] != $row['org_id']) { $this->errorOutput(NO_PRIVILEGE); } break; case 5: //全部 break; case 0: //只能自己修改 if ($this->user['user_id'] != $row['user_id']) { $this->errorOutput(NO_PRIVILEGE); } break; default: break; } } #####整合数据进行权限结束 if ($row['conid'] && $row['start_time'] > TIMENOW + 5) { $sql = "SELECT * FROM " . DB_PREFIX . "program_queue WHERE id=" . $row['conid']; $tmp_first = $this->db->query_first($sql); if (!empty($tmp_first)) { $this->curl->mPostContentType('string'); $this->curl->setSubmitType('get'); $this->curl->setReturnFormat('json'); $this->curl->initPostData(); if (!defined('IS_WOZA') || !IS_WOZA) { $this->curl->addRequestData('action', 'DELETE'); } else { $this->curl->addRequestData('action', 'delete'); } $this->curl->addRequestData('id', $tmp_first['conid']); $record_xml = $this->curl->request(''); $record_array = xml2Array($record_xml); if ($record_array['result']) { $id_success[] = $row['id']; } } } $delete_id .= $space . $row['id']; $space = ','; $ret[] = $row; } if ($delete_id) { $sql = "DELETE FROM " . DB_PREFIX . "program_record WHERE id IN (" . $delete_id . ")"; $this->db->query($sql); $sql = "DELETE FROM " . DB_PREFIX . "program_record_relation WHERE record_id IN (" . $delete_id . ")"; $this->db->query($sql); $sql = "DELETE FROM " . DB_PREFIX . "program_record_log WHERE record_id IN (" . $delete_id . ")"; $this->db->query($sql); $sql = "DELETE FROM " . DB_PREFIX . "program_queue WHERE record_id IN (" . $delete_id . ")"; $this->db->query($sql); } $this->addLogs('删除录制', $ret, '', '', '', '删除录制' . $delete_id); } $re = array(); $id_array = explode(',', $id); $delid_array = explode(',', $delete_id); if (count($id_array) == count($delid_array)) { $re['info'] = ''; } else { $re['info'] = '来自于节目单或者节目单计划的录制内容无法删除!'; } $re['id'] = $delete_id; $this->setXmlNode('program_record', 'info'); $this->addItem($re); $this->output(); }