1
This commit is contained in:
@@ -163,6 +163,8 @@ class Article extends Controller {
|
|||||||
}else{
|
}else{
|
||||||
$stack = [];
|
$stack = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
grabCiteFromCrossref($data['article_id']);
|
||||||
$re["track"] = $stack;
|
$re["track"] = $stack;
|
||||||
|
|
||||||
return jsonSuccess($re);
|
return jsonSuccess($re);
|
||||||
@@ -183,6 +185,10 @@ class Article extends Controller {
|
|||||||
return jsonSuccess($re);
|
return jsonSuccess($re);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function getArticleDetailCites(){
|
public function getArticleDetailCites(){
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
$rule = new Validate([
|
$rule = new Validate([
|
||||||
@@ -191,28 +197,17 @@ class Article extends Controller {
|
|||||||
if(!$rule->check($data)){
|
if(!$rule->check($data)){
|
||||||
return jsonError($rule->getError());
|
return jsonError($rule->getError());
|
||||||
}
|
}
|
||||||
$article_info = $this->article_obj->where("article_id",$data['article_id'])->find();
|
$rr = pCrossrefCite($data['article_id']);
|
||||||
$get_url = "https://doi.crossref.org/servlet/getForwardLinks";
|
|
||||||
$get_data["usr"] = "books@tmrjournals.com/tmrp";
|
|
||||||
$get_data["pwd"] = "849192806pnX";
|
|
||||||
$get_data["doi"] = $article_info['doi'];
|
|
||||||
$r = xml_to_array(myGet($get_url,$get_data));
|
|
||||||
$re = isset($r['crossref_result']['query_result']["body"]['forward_link'])?$r['crossref_result']['query_result']["body"]['forward_link']:null;
|
|
||||||
|
|
||||||
if($re==null){
|
|
||||||
return jsonSuccess(null);
|
|
||||||
}
|
|
||||||
if(isset($re['journal_cite'])){
|
|
||||||
$rr[] = $re['journal_cite'];
|
|
||||||
}else{
|
|
||||||
foreach ($re as $k){
|
|
||||||
$rr[] = $k['journal_cite'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return jsonSuccess($rr);
|
return jsonSuccess($rr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function myttt() {
|
public function myttt() {
|
||||||
echo 'ok';
|
echo 'ok';
|
||||||
}
|
}
|
||||||
@@ -311,7 +306,6 @@ class Article extends Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return jsonSuccess($f);
|
return jsonSuccess($f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -109,6 +109,58 @@ function getArticleMains($article_id)
|
|||||||
return $frag;
|
return $frag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function grabCiteFromCrossref($article_id,$act="zd"){
|
||||||
|
$article_obj = Db::name("article_id");
|
||||||
|
$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;
|
||||||
|
if($act=="zd"&&$cite_days<7){
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
$rr = pCrossrefCite($article_id);
|
||||||
|
foreach ($rr as $v){
|
||||||
|
$c = $article_cite_obj->where("doi",$v['doi'])->find();
|
||||||
|
if($c){continue;}
|
||||||
|
$articleEntity['article_id'] = $article_id;
|
||||||
|
$articleEntity['journal_id'] = $article_info['journal_id'];
|
||||||
|
$articleEntity['doi'] = $v['doi'];
|
||||||
|
$articleEntity['journal_name'] = $v['journal_title'];
|
||||||
|
$articleEntity['article_name'] = $v['article_title'];
|
||||||
|
$articleEntity['ctime'] = time();
|
||||||
|
$articleEntity['state'] = 1;
|
||||||
|
$article_cite_obj->insert($articleEntity);
|
||||||
|
}
|
||||||
|
$article_obj->where("article_id",$article_id)->update(['cite_time'=>time()]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function pCrossrefCite($article_id){
|
||||||
|
$article_obj = Db::name("article_id");
|
||||||
|
$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";
|
||||||
|
$get_data["pwd"] = "849192806pnX";
|
||||||
|
$get_data["doi"] = $article_info['doi'];
|
||||||
|
$r = xml_to_array(myGet($get_url,$get_data));
|
||||||
|
$re = isset($r['crossref_result']['query_result']["body"]['forward_link'])?$r['crossref_result']['query_result']["body"]['forward_link']:null;
|
||||||
|
if($re==null){
|
||||||
|
return jsonSuccess(null);
|
||||||
|
}
|
||||||
|
$rr = [];
|
||||||
|
if(isset($re['journal_cite'])){
|
||||||
|
$rr[] = $re['journal_cite'];
|
||||||
|
}else{
|
||||||
|
foreach ($re as $k){
|
||||||
|
$rr[] = $k['journal_cite'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $rr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function hasHtml($article_id){
|
function hasHtml($article_id){
|
||||||
$article_main_obj = Db::name("article_main");
|
$article_main_obj = Db::name("article_main");
|
||||||
$list = $article_main_obj->where('article_id', $article_id)->where('state', 0)->where('is_add', 0)->find();
|
$list = $article_main_obj->where('article_id', $article_id)->where('state', 0)->where('is_add', 0)->find();
|
||||||
|
|||||||
@@ -1110,6 +1110,7 @@ class Article extends Controller
|
|||||||
}
|
}
|
||||||
$cm = $this->article_main_obj->where('article_id',$v['article_id'])->where('state',0)->find();
|
$cm = $this->article_main_obj->where('article_id',$v['article_id'])->where('state',0)->find();
|
||||||
$article_list[$k]['mains'] = $cm?1:0;
|
$article_list[$k]['mains'] = $cm?1:0;
|
||||||
|
$article_list[$k]["cite_num"] = $this->article_cite_obj->where("article_id",$v['article_id'])->where("state",1)->select();
|
||||||
}
|
}
|
||||||
$count = $this->article_obj
|
$count = $this->article_obj
|
||||||
->join(array(['j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT'], ['j_journal', 'j_journal.journal_id=j_article.journal_id', 'LEFT']))
|
->join(array(['j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT'], ['j_journal', 'j_journal.journal_id=j_article.journal_id', 'LEFT']))
|
||||||
@@ -1131,6 +1132,60 @@ class Article extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function refreshCiteForSubmission(){
|
||||||
|
$data = $this->request->post();
|
||||||
|
$rule = new Validate([
|
||||||
|
"article_id"=>"require"
|
||||||
|
]);
|
||||||
|
if(!$rule->check($data)){
|
||||||
|
return jsonError($rule->getError());
|
||||||
|
}
|
||||||
|
grabCiteFromCrossref($data['article_id'],"sx");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addArticleCiteNew(){
|
||||||
|
$data = $this->request->post();
|
||||||
|
$rule = new Validate([
|
||||||
|
"article_id" => "require",
|
||||||
|
"journal_id" => "require",
|
||||||
|
"doi" => "require",
|
||||||
|
"journal_name" => "require",
|
||||||
|
"article_name" => "require",
|
||||||
|
]);
|
||||||
|
if(!$rule->check($data)){
|
||||||
|
return jsonError($rule->getError());
|
||||||
|
}
|
||||||
|
$entity["article_id"] = $data['article_id'];
|
||||||
|
$entity['journal_id'] = $data['journal_id'];
|
||||||
|
$entity['doi'] = trim($data['doi']);
|
||||||
|
$entity['journal_name'] = $data['journal_name'];
|
||||||
|
$entity['article_name'] = $data['article_name'];
|
||||||
|
$entity['ctime'] = time();
|
||||||
|
$entity['state'] = 1;
|
||||||
|
$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;
|
||||||
|
$this->article_cite_obj->insert($entity);
|
||||||
|
return jsonSuccess([]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function editArticleCite(){
|
||||||
|
$data = $this->request->post();
|
||||||
|
$rule = new Validate([
|
||||||
|
"article_cite_id"=>"require",
|
||||||
|
"factor"=>"require",
|
||||||
|
"is_china"=>"require",
|
||||||
|
"is_wos"=>"require"
|
||||||
|
]);
|
||||||
|
if(!$rule->check($data)){
|
||||||
|
return jsonError($rule->getError());
|
||||||
|
}
|
||||||
|
$this->article_cite_obj->where("article_id",$data['article_id'])->update($data);
|
||||||
|
return jsonSuccess([]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getArticleMainsForSubmission(){
|
public function getArticleMainsForSubmission(){
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
$rule = new Validate([
|
$rule = new Validate([
|
||||||
|
|||||||
Reference in New Issue
Block a user