1
This commit is contained in:
@@ -142,6 +142,7 @@ class Article extends Controller {
|
||||
$article_info['publication'] = date('Y/m/d', strtotime($article_info['pub_date']));
|
||||
//修改keywords
|
||||
$article_info['keywords'] = str_replace(',', ' ', $article_info['keywords']);
|
||||
$article_info['has_html'] = hasHtml($article_info['article_id']);
|
||||
//更改适应期刊改名后的期刊名称
|
||||
$journal_info['title'] = choiseti1($article_info['article_id'],$journal_info['title']);
|
||||
//返回数据
|
||||
|
||||
@@ -268,6 +268,9 @@ function getAuthor($article) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function pushSFTPForScopus($file,$pdf_file,$stage_info)
|
||||
{
|
||||
$host = 'sftp-opsbank2.elsevier.com';
|
||||
|
||||
@@ -245,7 +245,7 @@ class Datebase extends Controller
|
||||
|
||||
$file = ROOT_PATH."public/articleXML/".substr($article_info['doi'],strpos($article_info['doi'],"/")+1).".xml";
|
||||
if(is_file($file)){
|
||||
return ;
|
||||
return $file;
|
||||
}
|
||||
|
||||
|
||||
@@ -392,6 +392,7 @@ class Datebase extends Controller
|
||||
|
||||
|
||||
file_put_contents($file, $x);
|
||||
return $file;
|
||||
|
||||
}
|
||||
|
||||
@@ -819,10 +820,43 @@ class Datebase extends Controller
|
||||
if($journal_info['journal_id']==1){
|
||||
$this->scopusPushXML($data["journal_stage_id"]);//scopus数据库
|
||||
}
|
||||
if(in_array($journal_info["journal_id"],[2,8,20,15,9,10,3,1])){//ep数据库
|
||||
$this->pushXmlToEp($data["journal_stage_id"]);
|
||||
}
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
|
||||
public function Eptest(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"stage_id"=>"require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$this->pushXmlToEp($data['stage_id']);
|
||||
}
|
||||
|
||||
|
||||
public function pushXmlToEp($stage_id){
|
||||
$stage_info = $this->journal_stage_obj->where("journal_stage_id",$stage_id)->find();
|
||||
$list = $this->article_obj->where("journal_stage_id",$stage_id)->select();
|
||||
$journal_info = $this->journal_obj->where("journal_id",$stage_info['journal_id'])->find();
|
||||
foreach ($list as $v){
|
||||
$local_file = $this->xmlCreateForArticle($v['article_id']);
|
||||
$file = substr($v['doi'],strpos($v['doi'],"/")+1).".xml";
|
||||
$remote_file = "/".$journal_info['title']."/".$stage_info['stage_year']."v".$stage_info['stage_vol']."n".$stage_info['stage_no']."-".$file;
|
||||
$this->pushFtpForEp($remote_file,$local_file);
|
||||
$localPdf = ROOT_PATH."public/articlePDF/".$v['file_pdf'];
|
||||
$remotePdf = "/".$journal_info['title']."/".$stage_info['stage_year']."v".$stage_info['stage_vol']."n".$stage_info['stage_no']."-".substr($v['doi'],strpos($v['doi'],"/")+1).".pdf";
|
||||
$this->pushFtpForEp($remotePdf,$localPdf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function dataPushForLx(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
@@ -1129,6 +1163,29 @@ class Datebase extends Controller
|
||||
phpinfo();
|
||||
}
|
||||
|
||||
|
||||
private function pushFtpForEp($remote_file,$local_file){
|
||||
$ftp = [
|
||||
'server' => 'ftp.epnet.com',
|
||||
'user' => '56704',
|
||||
'pass' => 'o3Mys"(S'
|
||||
];
|
||||
$con = ftp_connect($ftp['server']);
|
||||
$res = ftp_login($con, $ftp['user'], $ftp['pass']);
|
||||
if (!$res) { //连接失败
|
||||
exit('连接失败');
|
||||
}
|
||||
ftp_pasv($con, true);
|
||||
$data = ftp_put($con, $remote_file,$local_file, FTP_BINARY);
|
||||
if (!$data) { // 上传失败
|
||||
exit('上传失败');
|
||||
}
|
||||
ftp_close($con);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 连接ftp
|
||||
private function sendFtp($url, $title)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user