大更新,1投稿系统参考文献的类型增加功能,,,2官网数据库功能

This commit is contained in:
wangjinlei
2026-07-08 11:15:44 +08:00
parent 186126a726
commit 05af67bc1a
22 changed files with 1634 additions and 81 deletions

View File

@@ -316,16 +316,17 @@ function getAuthor($article) {
function pushSFTPForScopus($file,$pdf_file,$stage_info)
{
$host = 'sftp-opsbank2.elsevier.com';
$port = 22; // SFTP 默认端口号
$username = 'pdf-e';
$password = '?b#W5=T4';
$cred = config('dbpush.credentials.scopus');
$host = isset($cred['host']) ? $cred['host'] : 'sftp-opsbank2.elsevier.com';
$port = isset($cred['port']) ? $cred['port'] : 22; // SFTP 默认端口号
$username = isset($cred['user']) ? $cred['user'] : 'pdf-e';
$password = isset($cred['pass']) ? $cred['pass'] : '?b#W5=T4';
// 创建 SFTP 连接
$sftp = new SFTP($host, $port);
if (!$sftp->login($username, $password)) {
exit('SFTP 登录失败');
throw new \Exception('Scopus SFTP 登录失败');
}
// 列出远程服务器的文件
@@ -336,7 +337,7 @@ function pushSFTPForScopus($file,$pdf_file,$stage_info)
// 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/';
$bb = isset($cred['base']) ? $cred['base'] : '/data/incoming/tmr/';
// }
$localFile = ROOT_PATH."public/articleXML/".$file;
$remoteFile = $bb.$stage_info['stage_year']."v".$stage_info['stage_vol']."n".$stage_info['stage_no']."-".$file;
@@ -349,13 +350,10 @@ function pushSFTPForScopus($file,$pdf_file,$stage_info)
$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);
if ($res&$res1) {
echo "文件上传成功!";
} else {
// echo $sftp->getErrors();
var_dump($sftp->getErrors());
// return $sftp;
if (!($res && $res1)) {
throw new \Exception('Scopus SFTP 上传失败: ' . implode('; ', (array) $sftp->getErrors()));
}
return true;
}