1
This commit is contained in:
@@ -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){
|
||||
|
||||
Reference in New Issue
Block a user