1
This commit is contained in:
@@ -56,6 +56,21 @@ class Article extends Controller {
|
||||
return jsonSuccess($r);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getRelationArticles(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"article_id" => "require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取文章详情
|
||||
* @description 获取文章详情
|
||||
@@ -127,21 +142,13 @@ class Article extends Controller {
|
||||
$article_info['keywords'] = str_replace(',', ' ', $article_info['keywords']);
|
||||
//更改适应期刊改名后的期刊名称
|
||||
$journal_info['title'] = choiseti1($article_info['article_id'],$journal_info['title']);
|
||||
//获取文章引用信息
|
||||
// $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['crossref_cite'] = isset($r['crossref_result']['query_result']["body"]['forward_link'])?$r['crossref_result']['query_result']["body"]['forward_link']:null;
|
||||
//返回数据
|
||||
$re['articleInfo'] = $article_info;
|
||||
$re['journalInfo'] = $journal_info;
|
||||
$re['stageInfo'] = $stage_info;
|
||||
$re['author'] = $author;
|
||||
$re['cite'] = $cite;
|
||||
// $re['mains'] = getArticleMains($data['article_id']);
|
||||
// $re['refers'] = getArticleRefers($data['article_id']);
|
||||
$re['html'] = hasHtml($data['article_id']);
|
||||
if((($article_info['journal_id']==13||$article_info['journal_id']==19||$article_info['journal_id']==9)&&($article_info['ctime']>1688140800))||(($article_info['journal_id']!=13||$article_info['journal_id']!=19||$article_info['journal_id']!=9)&&($article_info['ctime']>1682870400))){
|
||||
$stack = getArticleTracks($article_info['doi']);
|
||||
//增加online
|
||||
@@ -188,8 +195,20 @@ class Article extends Controller {
|
||||
$get_data["pwd"] = "849192806pnX";
|
||||
$get_data["doi"] = $article_info['doi'];
|
||||
$r = xml_to_array(myGet($get_url,$get_data));
|
||||
$re['crossref_cite'] = isset($r['crossref_result']['query_result']["body"]['forward_link'])?$r['crossref_result']['query_result']["body"]['forward_link']:null;
|
||||
return jsonSuccess($re);
|
||||
$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);
|
||||
}
|
||||
|
||||
public function myttt() {
|
||||
@@ -351,8 +370,8 @@ class Article extends Controller {
|
||||
$list[$k]['topic'] = $cache_topic;
|
||||
$list[$k]['cite'] = $cite;
|
||||
$list[$k]['authortitle'] = $this->getAuthor($v);
|
||||
|
||||
$list[$k]['mains'] = getArticleMains($v['article_id']);
|
||||
$list[$k]['html'] = hasHtml($v['article_id']);
|
||||
// $list[$k]['mains'] = getArticleMains($v['article_id']);
|
||||
}
|
||||
//标题斜体
|
||||
foreach ($list as $k => $v) {
|
||||
|
||||
@@ -844,8 +844,9 @@ class Journal extends Controller {
|
||||
->where('j_article.journal_stage_id', 'in', $stages)
|
||||
->where('j_article.state', 0)
|
||||
->where('j_journal_stage.stage_year', '>', '2018')
|
||||
->where('j_article.type', ['like', 'News'], ['like', 'Comment'], 'or')
|
||||
->where('j_article.type', ['eq', 'News'], ['eq', 'Comment'], 'or')
|
||||
->order('j_journal_stage.stage_year desc,j_journal_stage.stage_vol desc,j_journal_stage.stage_no desc,j_article.article_id desc')
|
||||
->limit(4)
|
||||
->select();
|
||||
//获取作者
|
||||
foreach ($list as $k => $v) {
|
||||
@@ -858,8 +859,9 @@ class Journal extends Controller {
|
||||
$list[$k]['topic'] = $cache_topic;
|
||||
$list[$k]['cite'] = $cite;
|
||||
$list[$k]['authortitle'] = $this->getAuthor($v);
|
||||
$list[$k]['html'] = hasHtml($v['article_id']);
|
||||
|
||||
$list[$k]['mains'] = getArticleMains($v['article_id']);
|
||||
// $list[$k]['mains'] = getArticleMains($v['article_id']);
|
||||
}
|
||||
//标题斜体
|
||||
foreach ($list as $k => $v) {
|
||||
@@ -884,6 +886,92 @@ class Journal extends Controller {
|
||||
return json(['code' => 0, 'msg' => 'success', 'data' => ['articlelist' => $list]]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @title 获取news文章
|
||||
* @description 获取news文章
|
||||
* @author wangjinlei
|
||||
* @url /api/Journal/getNewsArticle
|
||||
* @method POST
|
||||
*
|
||||
* @param name:journal_id type:int require:1 desc:期刊id
|
||||
*
|
||||
* @return articlelist:文章列表array#
|
||||
*/
|
||||
public function getNewsArticleNew() {
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"journal_id" => "require",
|
||||
"limit" =>"require",
|
||||
"page" => "require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
|
||||
$stages = $this->journal_stage_obj->where('journal_id', $data['journal_id'])->where('state', 0)->column('journal_stage_id');
|
||||
$journal_info = $this->journal_obj->where('journal_id', $data['journal_id'])->find();
|
||||
$list = $this->article_obj
|
||||
->field('j_article.*,j_journal_stage.*')
|
||||
->join('j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT')
|
||||
->where('j_article.journal_stage_id', 'in', $stages)
|
||||
->where('j_article.state', 0)
|
||||
->where('j_journal_stage.stage_year', '>', '2018')
|
||||
->where('j_article.type', ['eq', 'News'], ['eq', 'Comment'], 'or')
|
||||
->order('j_journal_stage.stage_year desc,j_journal_stage.stage_vol desc,j_journal_stage.stage_no desc,j_article.article_id desc')
|
||||
->page($data['page'],$data['limit'])
|
||||
->select();
|
||||
$count= $this->article_obj
|
||||
->field('j_article.*,j_journal_stage.*')
|
||||
->join('j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT')
|
||||
->where('j_article.journal_stage_id', 'in', $stages)
|
||||
->where('j_article.state', 0)
|
||||
->where('j_journal_stage.stage_year', '>', '2018')
|
||||
->where('j_article.type', ['eq', 'News'], ['eq', 'Comment'], 'or')
|
||||
->count();
|
||||
|
||||
//获取作者
|
||||
foreach ($list as $k => $v) {
|
||||
$stage_info = $this->journal_stage_obj->where('journal_stage_id', $v['journal_stage_id'])->find();
|
||||
//组合cite信息
|
||||
$no = $stage_info['stage_no'] == 0 ? ':' : '(' . $stage_info['stage_no'] . '):';
|
||||
$cite = $v['abbr'] . '. ' . $v['title'] . '. <i>' . choiseJabbr($v['article_id'], $journal_info['jabbr']) . '</i>. ' . $stage_info['stage_year'] . ';' . $stage_info['stage_vol'] . $no . $v['npp'] . '. doi:' . $v['doi'];
|
||||
$cache_topic = $this->article_to_topic_obj->field('j_journal_topic.*')->join('j_journal_topic', 'j_journal_topic.journal_topic_id = j_article_to_topic.topic_id', 'left')->where('j_article_to_topic.article_id', $v['article_id'])->where('j_article_to_topic.state', 0)->select();
|
||||
|
||||
$list[$k]['topic'] = $cache_topic;
|
||||
$list[$k]['cite'] = $cite;
|
||||
$list[$k]['authortitle'] = $this->getAuthor($v);
|
||||
$list[$k]['html'] = hasHtml($v['article_id']);
|
||||
// $list[$k]['mains'] = 1;
|
||||
// $list[$k]['mains'] = getArticleMains($v['article_id']);
|
||||
}
|
||||
//标题斜体
|
||||
foreach ($list as $k => $v) {
|
||||
$caches = $this->article_ltai_obj->where('article_id', $v['article_id'])->where('state', 0)->column('content');
|
||||
$cache_title = $v['title'];
|
||||
foreach ($caches as $val) {
|
||||
$cache_title = str_replace($val, '<i>' . $val . '</i>', $cache_title);
|
||||
}
|
||||
$list[$k]['title'] = $cache_title;
|
||||
}
|
||||
|
||||
//连续出版判断,决定是否显示出版时间
|
||||
foreach ($list as $k => $v) {
|
||||
$ca_stage = $this->journal_stage_obj->where('journal_stage_id', $v['journal_stage_id'])->find();
|
||||
if (($v['journal_id'] == 2 && $ca_stage['stage_year'] >= 2022) || ($v['journal_id'] == 18 && $ca_stage['stage_year'] >= 2022) || ($v['journal_id'] == 17 && $ca_stage['stage_year'] >= 2019)) {
|
||||
$list[$k]['isShowOtime'] = 1;
|
||||
} else {
|
||||
$list[$k]['isShowOtime'] = 0;
|
||||
}
|
||||
}
|
||||
$re['articlelist'] = $list;
|
||||
$re['count'] = $count;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @title 获取top前4条article
|
||||
* @description 获取top前4条article
|
||||
@@ -935,8 +1023,8 @@ class Journal extends Controller {
|
||||
$list[$k]['topic'] = $cache_topic;
|
||||
$list[$k]['cite'] = $cite;
|
||||
$list[$k]['authortitle'] = $this->getAuthor($v);
|
||||
|
||||
$list[$k]['mains'] = getArticleMains($v['article_id']);
|
||||
$list[$k]['html'] = hasHtml($v['article_id']);
|
||||
// $list[$k]['mains'] = getArticleMains($v['article_id']);
|
||||
}
|
||||
//连续出版判断,决定是否显示出版时间
|
||||
foreach ($list as $k => $v){
|
||||
|
||||
@@ -192,8 +192,9 @@ class Main extends Controller {
|
||||
$cache_title = str_replace($val, '<i>' . $val . '</i>', $cache_title);
|
||||
}
|
||||
$list[$k]['title'] = $cache_title;
|
||||
$list[$k]['html'] = hasHtml($v['article_id']);
|
||||
|
||||
$list[$k]['mains'] = getArticleMains($v['article_id']);
|
||||
// $list[$k]['mains'] = getArticleMains($v['article_id']);
|
||||
}
|
||||
|
||||
//连续出版判断,决定是否显示出版时间
|
||||
|
||||
@@ -109,6 +109,12 @@ function getArticleMains($article_id)
|
||||
return $frag;
|
||||
}
|
||||
|
||||
function hasHtml($article_id){
|
||||
$article_main_obj = Db::name("article_main");
|
||||
$list = $article_main_obj->where('article_id', $article_id)->where('state', 0)->where('is_add', 0)->find();
|
||||
return $list?1:0;
|
||||
}
|
||||
|
||||
function getArticleRefers($article_id)
|
||||
{
|
||||
$article_obj = Db::name("article");
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace app\super\controller;
|
||||
|
||||
use think\Controller;
|
||||
use think\Validate;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
@@ -127,6 +128,14 @@ class Publish extends Controller {
|
||||
*/
|
||||
public function getAllDateForJournal() {
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"issn"=>"require",
|
||||
"start"=>"require",
|
||||
"end"=>"require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
|
||||
// $data['issn'] = '2703-4631';
|
||||
// $data['start'] = '2021-01-01';
|
||||
@@ -558,6 +567,26 @@ class Publish extends Controller {
|
||||
return $frag;
|
||||
}
|
||||
|
||||
|
||||
public function getGJHByIssn(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"issn"=>"require",
|
||||
"year"=>"require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$journal_info = $this->journal_obj->where("issn",$data['issn'])->find();
|
||||
$start = strtotime($data['year']."-01-01");
|
||||
$end = strtotime($data['year']."-12-31 23:59:59");
|
||||
$r = $this->getGJH($journal_info['journal_id'],$start,$end);
|
||||
$re['result'] = $r['list'];
|
||||
|
||||
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
private function getGJH($journal_id, $start, $end) {
|
||||
$stages = $this->journal_stage_obj
|
||||
->where('journal_id', $journal_id)
|
||||
|
||||
Reference in New Issue
Block a user