This commit is contained in:
wangjinlei
2024-11-06 11:03:25 +08:00
parent 28a3c99ee3
commit 20a27edc57
2 changed files with 18 additions and 9 deletions

View File

@@ -251,7 +251,7 @@ function getAuthor($article) {
} }
function pushSFTPForScopus($file,$pdf_file) function pushSFTPForScopus($file,$pdf_file,$stage_info)
{ {
$host = 'sftp-opsbank2.elsevier.com'; $host = 'sftp-opsbank2.elsevier.com';
$port = 22; // SFTP 默认端口号 $port = 22; // SFTP 默认端口号
@@ -270,21 +270,27 @@ function pushSFTPForScopus($file,$pdf_file)
// print_r($fileList); // print_r($fileList);
// 上传文件到 SFTP 服务器 // 上传文件到 SFTP 服务器
// if($stage_info !=null){
// $bb = '/data/incoming/tmr/'.$stage_info['stage_year']."tmr-".$stage_info['stage_vol']."-".$stage_info['stage_no']."/";
// }else{
$bb = '/data/incoming/tmr/';
// }
$localFile = ROOT_PATH."public/articleXML/".$file; $localFile = ROOT_PATH."public/articleXML/".$file;
$remoteFile = '/data/incoming/tmr/'.$file; $remoteFile = $bb.$stage_info['stage_year']."v".$stage_info['stage_vol']."n".$stage_info['stage_no']."-".$file;
$res = $sftp->put($remoteFile, $localFile, SFTP::SOURCE_LOCAL_FILE); $res = $sftp->put($remoteFile, $localFile, SFTP::SOURCE_LOCAL_FILE);
//上传pdf //上传pdf
$localPdf = ROOT_PATH."public/articlePDF/".$pdf_file; $localPdf = ROOT_PATH."public/articlePDF/".$pdf_file;
$remoteFilePdf = "/data/incoming/tmr/".str_replace(".xml",".pdf",$file); $remoteFilePdf = $bb.$stage_info['stage_year']."v".$stage_info['stage_vol']."n".$stage_info['stage_no']."-".str_replace(".xml",".pdf",$file);
$res1 = $sftp->put($remoteFilePdf,$localPdf,SFTP::SOURCE_LOCAL_FILE); $res1 = $sftp->put($remoteFilePdf,$localPdf,SFTP::SOURCE_LOCAL_FILE);
if ($res&$res1) { if ($res&$res1) {
echo "文件上传成功!"; echo "文件上传成功!";
} else { } else {
var_dump($sftp); // echo $sftp->getErrors();
var_dump($sftp->getErrors());
// return $sftp; // return $sftp;
} }
} }

View File

@@ -326,10 +326,12 @@ class Datebase extends Controller
//pub-date //pub-date
$stage_info = $this->journal_stage_obj->where("journal_stage_id",$article_info['journal_stage_id'])->find(); $stage_info = $this->journal_stage_obj->where("journal_stage_id",$article_info['journal_stage_id'])->find();
if($article_info['pub_date']!=""){
$pubDate = $articleMeta->addChild("pub_date"); $pubDate = $articleMeta->addChild("pub_date");
$pub_date_list = explode(" ",$article_info['pub_date']); $pub_date_list = explode(" ",$article_info['pub_date']);
$pubDate->addChild("year",$pub_date_list[2]); $pubDate->addChild("year",$pub_date_list[2]);
$pubDate->addChild("month",$pub_date_list[1]); $pubDate->addChild("month",$pub_date_list[1]);
}
$vol = $articleMeta->addChild("volume",$stage_info['stage_vol']); $vol = $articleMeta->addChild("volume",$stage_info['stage_vol']);
$vol->addAttribute("content-type","Vol."); $vol->addAttribute("content-type","Vol.");
$issue = $articleMeta->addChild("issue",$article_info['npp']); $issue = $articleMeta->addChild("issue",$article_info['npp']);
@@ -436,11 +438,12 @@ class Datebase extends Controller
public function scopusPushXML($stage_id){ public function scopusPushXML($stage_id){
$list = $this->article_obj->where("journal_stage_id",$stage_id)->where("state",0)->select(); $list = $this->article_obj->where("journal_stage_id",$stage_id)->where("state",0)->select();
$stage_info = $this->journal_stage_obj->where("journal_stage_id",$stage_id)->find();
foreach ($list as $v){ foreach ($list as $v){
$this->xmlCreateForArticle($v['article_id']); $this->xmlCreateForArticle($v['article_id']);
$file = substr($v['doi'],strpos($v['doi'],"/")+1).".xml"; $file = substr($v['doi'],strpos($v['doi'],"/")+1).".xml";
pushSFTPForScopus($file,$v['file_pdf']); pushSFTPForScopus($file,$v['file_pdf'],$stage_info);
} }
} }