This commit is contained in:
王金磊
2023-03-30 11:44:42 +08:00
parent 70d535038b
commit 7b473ffa5c

View File

@@ -1329,6 +1329,21 @@ class Article extends Controller {
}
}
public function getArticleReportAuthors(){
$num = $this->request->post('num');
// $num = 1;
$size = 500;
$f = ($num-1)*$size;
$list = $this->article_obj->where('state',0)->limit($f,$size)->select();
foreach($list as $k => $v){
$author = $this->article_author_obj->where('article_id',$v['article_id'])->where('is_report',1)->where('state',0)->select();
$list[$k]['author'] = $author;
}
$re['list'] = $list;
return jsonSuccess($re);
}
/**
* @title 文章文件上传
* @description 文章文件上传
@@ -1629,52 +1644,52 @@ class Article extends Controller {
// die;
}
public function cccc(){
die;
$data = $this->request->post();
$rule = new Validate([
'num'=>'require'
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
// public function cccc(){
// die;
// $data = $this->request->post();
// $rule = new Validate([
// 'num'=>'require'
// ]);
// if(!$rule->check($data)){
// return jsonError($rule->getError());
// }
$limit_start = ($data['num'] - 1) * 20;
$list = $this->article_obj->where('doi','like',"10.12032%")->where('state',0)->limit($limit_start,20)->select();
foreach($list as $v){
$c = explode('/',$v['doi']);
// $limit_start = ($data['num'] - 1) * 20;
// $list = $this->article_obj->where('doi','like',"10.12032%")->where('state',0)->limit($limit_start,20)->select();
// foreach($list as $v){
// $c = explode('/',$v['doi']);
$author = $this->article_author_obj->where('article_id', $v['article_id'])->where('state', 0)->find();
if ($author == null) {
continue;
}
$article_info = $this->article_obj->where('article_id', $v['article_id'])->find();
if ($article_info['npp'] == '') {
continue;
}
$url = 'https://doi.crossref.org/servlet/deposit';
$file = ROOT_PATH . 'public' . DS . 'xml' . DS . $v['article_id'] . '.xml';
// $author = $this->article_author_obj->where('article_id', $v['article_id'])->where('state', 0)->find();
// if ($author == null) {
// continue;
// }
// $article_info = $this->article_obj->where('article_id', $v['article_id'])->find();
// if ($article_info['npp'] == '') {
// continue;
// }
// $url = 'https://doi.crossref.org/servlet/deposit';
// $file = ROOT_PATH . 'public' . DS . 'xml' . DS . $v['article_id'] . '.xml';
$d['article_id'] = $v['article_id'];
$d['doi_num'] = $c[1];
$this->crossRef($d);
// $d['article_id'] = $v['article_id'];
// $d['doi_num'] = $c[1];
// $this->crossRef($d);
//存储
$this->article_obj->where('article_id', $v['article_id'])->update(['doi' => '10.53388/' . $c[1]]);
// //存储
// $this->article_obj->where('article_id', $v['article_id'])->update(['doi' => '10.53388/' . $c[1]]);
//发送请求
$par['login_id'] = 'books@tmrjournals.com/tmrp';
$par['login_passwd'] = '849192806pnX';
$par['fname'] = new \CURLFile($file);
// //发送请求
// $par['login_id'] = 'books@tmrjournals.com/tmrp';
// $par['login_passwd'] = '849192806pnX';
// $par['fname'] = new \CURLFile($file);
$this->myPost($url, $par);
// echo '10.53388/'.$c[1];
// echo '<br/>';
}
// $this->myPost($url, $par);
// // echo '10.53388/'.$c[1];
// // echo '<br/>';
// }
// dump($list);
}
// // dump($list);
// }
public function crossRef($data) {
$xml = '';
@@ -1743,6 +1758,11 @@ http://www.crossref.org/schemas/crossref4.3.7.xsd">' . PHP_EOL . PHP_EOL;
$xml .= '<doi_data>' . PHP_EOL;
$xml .= '<doi>10.53388/' . trim($data['doi_num']) . '</doi>' . PHP_EOL;
$xml .= '<resource><![CDATA[https://www.tmrjournals.com/article.html?J_num=' . $journal_info['journal_id'] . '&a_id=' . $article_info['article_id'] . ']]></resource>' . PHP_EOL;
$xml .= '<collection property="crawler-based">'.PHP_EOL;
$xml .= '<item crawler="iParadigms">'.PHP_EOL;
$xml .= '<resource><![CDATA[https://www.tmrjournals.com/public/articlePDF/' . $article_info['file_pdf'] . ']]></resource>'.PHP_EOL;
$xml .= '</item>'.PHP_EOL;
$xml .= '</collection>'.PHP_EOL;
$xml .= '</doi_data>' . PHP_EOL;
$xml .= '</journal_article>' . PHP_EOL;
$xml .= '</journal>' . PHP_EOL;