This commit is contained in:
wangjinlei
2022-10-26 17:54:59 +08:00
parent 8f4a3b4e75
commit 53b4860416

View File

@@ -505,6 +505,7 @@ class Article extends Controller {
if($aid&&$organ_res&&$author_res&&$ato_res&&$ca_au_id){ if($aid&&$organ_res&&$author_res&&$ato_res&&$ca_au_id){
Db::commit(); Db::commit();
$this->pushDoiToCrossref($data['doi'],$aid);
return jsonSuccess([]); return jsonSuccess([]);
} else { } else {
Db::rollback(); Db::rollback();
@@ -513,6 +514,22 @@ class Article extends Controller {
} }
private function pushDoiToCrossref($doi,$article_id){
$url = 'https://doi.crossref.org/servlet/deposit';
$file = ROOT_PATH . 'public' . DS . 'xml' . DS . $article_id . '.xml';
$d['doi_num'] = $doi;
$d['article_id'] = $article_id;
$this->crossRef($d);
//发送请求
$par['login_id'] = 'books@tmrjournals.com/tmrp';
$par['login_passwd'] = '849192806pnX';
$par['fname'] = new \CURLFile($file);
$res = $this->myPost($url, $par);
return $res;
}
/** /**
* 获取online文章列表 * 获取online文章列表
*/ */
@@ -1560,8 +1577,9 @@ class Article extends Controller {
curl_setopt($httph, CURLOPT_POST, 1); //设置为POST方式 curl_setopt($httph, CURLOPT_POST, 1); //设置为POST方式
curl_setopt($httph, CURLOPT_POSTFIELDS, $param); curl_setopt($httph, CURLOPT_POSTFIELDS, $param);
curl_exec($httph); $res = curl_exec($httph);
curl_close($httph); curl_close($httph);
return $res;
// echo '<pre>'; // echo '<pre>';
// var_dump($rst); // var_dump($rst);
// echo '</pre>'; // echo '</pre>';