public function deleteDoc($ct, $lu, $from, $doc_id, $direct_post, $opuid, $opuname, $token, $power, $t, $sub_status) { $data = array('ct' => $ct, 'lu' => $lu, 'from' => $from, 'doc_id' => $doc_id, 'direct_post' => $direct_post, 'opuid' => $opuid, 'opuname' => $opuname, 'token' => $token, 'power' => $power, 't' => $t, 'sub_status' => $sub_status); //$data = http_build_query($data); $data = $this->Array2ReqBody($data); $url = DELETE_URL; $ret = $this->_libPlatHttp->Post($url, $data); $content = $this->_libPlatHttp->getContent(); $error = $this->_libPlatHttp->getError(); if ($error !== '') { $this->_errno = 500; $this->_errmsg = $error; Plat_Log::fatal($error, 500); Plat_Log::fatal("update error:{$doc_id}"); return false; } $delete_ret = json_decode($content, true); return $delete_ret; }
require_once LIB_PATH . 'Upload.php'; require_once LIB_PATH . 'Http.php'; require_once LIB_PATH . 'Log.php'; require_once LIB_PATH . 'Log.class.php'; $cookie = 'BDUSS=' . BDUSS; $bduss = BDUSS; $flag = FLAG; $path = urldecode($argv[1]); $title = urldecode($argv[2]); $file_name_arr = explode(".", $path); $ext = array_pop($file_name_arr); if (!mb_check_encoding($title, 'UTF-8')) { $title = mb_convert_encoding($title, 'UTF-8', 'GBK'); } if (empty($title) || empty($ext)) { Plat_Log::fatal('empty title or ext in:' . $file); exit(0); } $min = date('i'); $date_tail = intval($min / GAP) * GAP; $log_name = sprintf('%s%s%02d%s', 'upload', date("YmdH"), $date_tail, '.log'); Plat_Log::setOdp(false); Plat_Log::setLogPath(LOG_PATH . $log_name); $upload = new Plat_Upload($cookie); for ($i = 0; $i < 2; $i++) { $doc_id = $upload->run($title, $ext, $path, $flag); if (!empty($doc_id)) { break; } } if (empty($doc_id)) {
public function getAutoClass($doc_id, $title, $size, $type, $index = 1, $summary = '', $app = 'getClass') { $data = array('app' => $app, 'doc_id' => $doc_id, 'title' => $title, 'summary' => $summary, 'size' => $size, 'type' => $type, 'index' => $index); $data = http_build_query($data); $url = AUTOCLASS_URL; $ret = $this->_libPlatHttp->Post($url, $data); $content = $this->_libPlatHttp->getContent(); $error = $this->_libPlatHttp->getError(); if ($error !== '') { $this->_errno = 500; $this->_errmsg = $error; Plat_Log::fatal($error, 500); return false; } $auto_class = json_decode($content, true); return $auto_class; }
$tag_str = ''; $summary = ''; // 截取文件名 if (strlen($title) > 100) { $title = mb_substr($title, 0, 90); } // 判断是否是付费文档 if ($flag == 10) { $update_ret = $upload->update($title, $summary, $cid1, $cid2, $cid3, $cid4, $tag_str, $privacy, $flag, $price_rule['pay_price'], $price_rule['free_page'], $downloadable, $doc_id, $new_upload); } else { $update_ret = $upload->updateFree($title, $summary, $cid1, $cid2, $cid3, $cid4, $tag_str, $privacy, $flag, $downloadable, $doc_id, $new_upload); } var_dump($update_ret); Plat_Log::addNotice('update ret', json_encode($update_ret)); if (!$update_ret || $update_ret['errno'] != 0) { Plat_Log::fatal('update error:' . json_encode($update_ret) . ':' . $doc_id); exit(0); } exit(0); function docInfoOk($doc_info_ret, $doc_id) { if (empty($doc_id)) { return false; } if (empty($doc_info_ret['data'][$doc_id]['page'])) { return false; } if (empty($doc_info_ret['data'][$doc_id]['title'])) { return false; } if (empty($doc_info_ret['data'][$doc_id]['size'])) {