1
This commit is contained in:
@@ -110,7 +110,7 @@ function getArticleMains($article_id)
|
||||
}
|
||||
|
||||
function grabCiteFromCrossref($article_id,$act="zd"){
|
||||
$article_obj = Db::name("article_id");
|
||||
$article_obj = Db::name("article");
|
||||
$article_cite_obj = Db::name("article_cite");
|
||||
$article_info = $article_obj->where("article_id",$article_id)->find();
|
||||
$cite_days = (time()-$article_info['cite_time'])/3600*24;
|
||||
@@ -126,6 +126,8 @@ function grabCiteFromCrossref($article_id,$act="zd"){
|
||||
$articleEntity['doi'] = $v['doi'];
|
||||
$articleEntity['journal_name'] = $v['journal_title'];
|
||||
$articleEntity['article_name'] = $v['article_title'];
|
||||
$articleEntity['author'] = formateAuthor(isset($v['contributors']['contributor'])?$v['contributors']['contributor']:null);
|
||||
$articleEntity['vol'] = formateVol($v);
|
||||
$articleEntity['ctime'] = time();
|
||||
$articleEntity['state'] = 1;
|
||||
$article_cite_obj->insert($articleEntity);
|
||||
@@ -134,10 +136,47 @@ function grabCiteFromCrossref($article_id,$act="zd"){
|
||||
|
||||
}
|
||||
|
||||
function formateVol($v){
|
||||
$flag = "";
|
||||
if(isset($v['year'])) {
|
||||
$flag .= $v['year']." ";
|
||||
}
|
||||
if(isset($v['volume'])) {
|
||||
$flag .= $v['volume']." ";
|
||||
}
|
||||
if(isset($v['first_page'])) {
|
||||
$flag .= $v['first_page']." ";
|
||||
}
|
||||
if(isset($v['item_number'])&&!isset($v['first_page'])) {
|
||||
$flag .= $v['item_number']." ";
|
||||
}
|
||||
if(isset($v['issue'])) {
|
||||
$flag .= $v['issue']." ";
|
||||
}
|
||||
return trim($flag);
|
||||
}
|
||||
|
||||
function formateAuthor($list){
|
||||
$flag = '';
|
||||
if (count($list)<=3){
|
||||
foreach ($list as $v){
|
||||
$flag .= $v['given_name']." ".$v['surname'].", ";
|
||||
}
|
||||
$flag = trim(trim($flag),",");
|
||||
}else{
|
||||
for ($i=0;$i<3;$i++){
|
||||
$flag .= $list[$i]['given_name']." ".$list[$i]['surname'].", ";
|
||||
}
|
||||
$flag .= "et al";
|
||||
}
|
||||
|
||||
return $flag;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function pCrossrefCite($article_id){
|
||||
$article_obj = Db::name("article_id");
|
||||
$article_obj = Db::name("article");
|
||||
$article_info = $article_obj->where("article_id",$article_id)->find();
|
||||
$get_url = "https://doi.crossref.org/servlet/getForwardLinks";
|
||||
$get_data["usr"] = "books@tmrjournals.com/tmrp";
|
||||
@@ -152,7 +191,8 @@ function pCrossrefCite($article_id){
|
||||
if(isset($re['journal_cite'])){
|
||||
$rr[] = $re['journal_cite'];
|
||||
}else{
|
||||
foreach ($re as $k){
|
||||
foreach ($re as $kk=>$k){
|
||||
if(!isset($k['journal_cite'])){continue;}
|
||||
$rr[] = $k['journal_cite'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -690,6 +690,21 @@ class Article extends Controller
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
|
||||
public function getArticleCitesForSubmit(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"article_id"=>"require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$list = $this->article_cite_obj->where("article_id",$data['article_id'])->where("state",1)->select();
|
||||
$re['list'] = $list;
|
||||
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有分期
|
||||
*/
|
||||
@@ -1140,7 +1155,8 @@ class Article extends Controller
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
grabCiteFromCrossref($data['article_id'],"sx");
|
||||
$res = grabCiteFromCrossref($data['article_id'],"sx");
|
||||
return jsonSuccess($res);
|
||||
}
|
||||
|
||||
public function addArticleCiteNew(){
|
||||
@@ -1151,6 +1167,8 @@ class Article extends Controller
|
||||
"doi" => "require",
|
||||
"journal_name" => "require",
|
||||
"article_name" => "require",
|
||||
"author"=>"require",
|
||||
"vol"=>"require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
@@ -1162,6 +1180,8 @@ class Article extends Controller
|
||||
$entity['article_name'] = $data['article_name'];
|
||||
$entity['ctime'] = time();
|
||||
$entity['state'] = 1;
|
||||
$entity['author'] = $data['author'];
|
||||
$entity['vol'] = $data['vol'];
|
||||
$entity['factor'] = isset($data['factor'])?$data['factor']:0;
|
||||
$entity['is_china'] = isset($data['is_china'])?$data['is_china']:0;
|
||||
$entity['is_wos'] = isset($data['is_wos'])?$data['is_wos']:0;
|
||||
@@ -1180,12 +1200,26 @@ class Article extends Controller
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$this->article_cite_obj->where("article_id",$data['article_id'])->update($data);
|
||||
$this->article_cite_obj->where("article_cite_id",$data['article_cite_id'])->update($data);
|
||||
return jsonSuccess([]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function delArticleCiteForSubmission(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"article_cite_id" => "require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
|
||||
$re = $this->article_cite_obj->where("article_cite_id",$data['article_cite_id'])->update(["state"=>2]);
|
||||
return jsonSuccess();
|
||||
}
|
||||
|
||||
|
||||
public function getArticleMainsForSubmission(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
|
||||
Reference in New Issue
Block a user