20201112
This commit is contained in:
@@ -33,6 +33,10 @@ class Journal extends Controller {
|
||||
protected $subscribe_topic_obj = '';
|
||||
protected $board_obj = '';
|
||||
protected $board_group_obj = '';
|
||||
protected $base_topic_obj = '';
|
||||
protected $subscribe_base_topic_obj = '';
|
||||
|
||||
|
||||
|
||||
public function __construct(\think\Request $request = null) {
|
||||
parent::__construct($request);
|
||||
@@ -55,6 +59,8 @@ class Journal extends Controller {
|
||||
$this->subscribe_topic_obj = Db::name('subscribe_topic');
|
||||
$this->board_obj = Db::name('board');
|
||||
$this->board_group_obj = Db::name('board_group');
|
||||
$this->base_topic_obj = Db::name('base_topic');
|
||||
$this->subscribe_base_topic_obj = Db::name('subscribe_base_topic');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -64,7 +70,6 @@ class Journal extends Controller {
|
||||
* @url /api/Journal/getJournalList
|
||||
* @method POST
|
||||
*
|
||||
*
|
||||
* @return journalList:期刊列表@
|
||||
* @journalList title:标题 issn:issn editorinchief:editorinchief acceptance:acceptance finaldecision:finaldecision apc:apc
|
||||
*/
|
||||
@@ -160,7 +165,6 @@ class Journal extends Controller {
|
||||
->where('parent_id', 0)
|
||||
->order('sort')
|
||||
->select();
|
||||
|
||||
$res = $this->journal_topic_obj
|
||||
->where('journal_id', $data['journal_id'])
|
||||
->where('state', 0)
|
||||
@@ -248,7 +252,7 @@ class Journal extends Controller {
|
||||
$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>' . $journal_info['jabbr'] . '</i>. ' . $stage_info['stage_year'] . ';' . $stage_info['stage_vol'] . $no . $v['npp'] . '. doi:' . $v['doi'];
|
||||
$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;
|
||||
@@ -265,6 +269,219 @@ class Journal extends Controller {
|
||||
$re['articles'] = $list;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取期刊五个话题
|
||||
* @description 获取期刊五个话题
|
||||
* @author wangjinlei
|
||||
* @url /api/Journal/getJournalFiveTopics
|
||||
* @method POST
|
||||
*
|
||||
* @return journals:期刊话题列表array#
|
||||
*/
|
||||
public function getJournalFiveTopics(){
|
||||
$journals = $this->journal_obj->where('state',0)->select();
|
||||
foreach ($journals as $k => $v){
|
||||
$topic_info = $this->journal_topic_obj->where('journal_id',$v['journal_id'])->where('title','Topics')->where('state',0)->find();
|
||||
$cache = $this->journal_topic_obj->where('parent_id',$topic_info['journal_topic_id'])->where('state',0)->limit(5)->select();
|
||||
$journals[$k]['topics'] = $cache;
|
||||
}
|
||||
|
||||
$re['journals'] = $journals;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取所有期刊话题
|
||||
* @description 获取所有期刊话题
|
||||
* @author wangjinlei
|
||||
* @url /api/Journal/getAllTopics
|
||||
* @method POST
|
||||
*
|
||||
* @return topic:话题列表array#
|
||||
*/
|
||||
public function getAllTopics(){
|
||||
$parents = $this->base_topic_obj->where('parent_id',0)->where('state',0)->order('sort desc')->select();
|
||||
$topicIds = $this->journal_topic_obj->where('title','Topics')->where('state',0)->column('journal_topic_id');
|
||||
$ca = $this->journal_topic_obj->where('parent_id','in',$topicIds)->where('state',0)->select();
|
||||
foreach ($parents as $k => $v){
|
||||
$cache = $this->base_topic_obj->where('parent_id',$v['base_topic_id'])
|
||||
->where('state',0)
|
||||
->order('sort desc')
|
||||
->select();
|
||||
$cache1 = [];
|
||||
foreach ($cache as $val){
|
||||
if($this->myCheckTopic($val['title'],$ca)){
|
||||
$cache1[] = $val;
|
||||
}
|
||||
}
|
||||
$parents[$k]['children'] = $cache1;
|
||||
}
|
||||
$re['topic'] = $parents;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
private function myCheckTopic($value,$array){
|
||||
$frag = false;
|
||||
foreach ($array as $v){
|
||||
if($v['title']==$value){
|
||||
$frag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $frag;
|
||||
}
|
||||
|
||||
|
||||
private function check_topic($value,$frag){
|
||||
$fra = false;
|
||||
foreach ($frag as $k => $v){
|
||||
if($value['title'] == $v['title']){
|
||||
$fra = true;
|
||||
}
|
||||
}
|
||||
return $fra;
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 查找话题期刊
|
||||
* @description 查找话题期刊
|
||||
* @author wangjinlei
|
||||
* @url /api/Journal/findJournalTopic1
|
||||
* @method POST
|
||||
*
|
||||
* @param name:topic type:string require:1 desc:话题
|
||||
*
|
||||
* @return journals:期刊list#
|
||||
*/
|
||||
public function findJournalTopic1(){
|
||||
$data = $this->request->post();
|
||||
$base_topic = $this->base_topic_obj->where('base_topic_id',$data['topic'])->find();
|
||||
$topicids = $this->journal_topic_obj->where('title','Topics')->where('state',0)->column('journal_topic_id');
|
||||
$list = $this->journal_topic_obj
|
||||
->field('j_journal.*,j_journal_topic.title topic_title,j_journal_topic.journal_topic_id')
|
||||
->join('j_journal','j_journal.journal_id = j_journal_topic.journal_id','left')
|
||||
->where('j_journal_topic.parent_id','in',$topicids)
|
||||
->where('j_journal_topic.state',0)
|
||||
->where('j_journal_topic.title','like','%'.$base_topic['title'].'%')
|
||||
->select();
|
||||
|
||||
foreach ($list as $k => $v){
|
||||
$abs = $this->journal_abs_obj->where('journal_id',$v['journal_id'])->where('state',0)->order('sort')->limit(4)->select();
|
||||
$list[$k]['abs'] = $abs;
|
||||
}
|
||||
|
||||
$re['journals'] = $list;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 查找话题期刊
|
||||
* @description 查找话题期刊
|
||||
* @author wangjinlei
|
||||
* @url /api/Journal/findJournalTopic
|
||||
* @method POST
|
||||
*
|
||||
* @param name:journal_topic_id type:int require:1 desc:话题id
|
||||
*
|
||||
* @return journals:期刊list#
|
||||
*/
|
||||
public function findJournalTopic(){
|
||||
$data = $this->request->post();
|
||||
$list = [];
|
||||
if($data['journal_topic_id'] == 0){
|
||||
$journals = $this->journal_obj->where('state',0)->select();
|
||||
foreach ($journals as $k => $v){
|
||||
$topic_info = $this->journal_topic_obj->where('journal_id',$v['journal_id'])->where('title','Topics')->where('state',0)->find();
|
||||
$cache = $this->journal_topic_obj->where('parent_id',$topic_info['journal_topic_id'])->where('state',0)->limit(5)->select();
|
||||
$journals[$k]['topics'] = $cache;
|
||||
}
|
||||
$list = $journals;
|
||||
}else{
|
||||
$topic_info = $this->journal_topic_obj->where('journal_topic_id',$data['journal_topic_id'])->find();
|
||||
$tpids = $this->journal_topic_obj->where('title','Topics')->where('state',0)->column('journal_topic_id');
|
||||
$journals = $this->journal_topic_obj
|
||||
->field('j_journal.*,j_journal_topic.title topic_title,j_journal_topic.journal_topic_id')
|
||||
->join('j_journal','j_journal.journal_id = j_journal_topic.journal_id','left')
|
||||
->where('j_journal_topic.parent_id','in',$tpids)
|
||||
->where('j_journal_topic.title',$topic_info['title'])
|
||||
->where('j_journal_topic.state',0)
|
||||
->select();
|
||||
$list = $journals;
|
||||
}
|
||||
foreach ($list as $k => $v){
|
||||
$abs = $this->journal_abs_obj->where('journal_id',$v['journal_id'])->where('state',0)->order('sort')->limit(4)->select();
|
||||
$list[$k]['abs'] = $abs;
|
||||
}
|
||||
$re['journals'] = $list;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取通用话题文章
|
||||
* @description 获取通用话题文章
|
||||
* @author wangjinlei
|
||||
* @url /api/Journal/getBaseTopicArticles
|
||||
* @method POST
|
||||
*
|
||||
* @param name:base_topic_id type:int require:1 desc:通用话题id
|
||||
* @param name:pageIndex type:int require:1 desc:当前页码数
|
||||
* @param name:pageSize type:int require:1 desc:单页数据条数
|
||||
*
|
||||
* @return articleList:文章信息#
|
||||
* @return count:总数
|
||||
*/
|
||||
public function getBaseTopicArticles(){
|
||||
$data = $this->request->post();
|
||||
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
|
||||
$base_topic_info = $this->base_topic_obj->where('base_topic_id',$data['base_topic_id'])->find();
|
||||
$chileds = $this->base_topic_obj->where('parent_id',$base_topic_info['base_topic_id'])->where('state',0)->select();
|
||||
$topicids = $this->journal_topic_obj->where('title',$base_topic_info['title'])->where('state',0)->column('journal_topic_id');
|
||||
foreach ($chileds as $v){
|
||||
$cache_ids = $this->journal_topic_obj->where('title',$v['title'])->where('state',0)->column('journal_topic_id');
|
||||
$topicids = array_merge($topicids,$cache_ids);
|
||||
}
|
||||
$ids = $this->article_to_topic_obj->where('topic_id','in',$topicids)->where('state',0)->column('article_id');
|
||||
$list = $this->article_obj
|
||||
->field('j_article.*,j_journal_stage.*,j_journal.title journal_title')
|
||||
->join('j_journal','j_article.journal_id = j_journal.journal_id','left')
|
||||
->join('j_journal_stage','j_article.journal_stage_id = j_journal_stage.journal_stage_id','left')
|
||||
->where('j_article.article_id','in',$ids)
|
||||
->where('j_article.state',0)
|
||||
->order('j_journal_stage.stage_year desc,j_article.article_id desc')
|
||||
->limit($limit_start,$data['pageSize'])
|
||||
->select();
|
||||
$count = $this->article_obj
|
||||
->where('j_article.article_id','in',$ids)
|
||||
->where('j_article.state',0)
|
||||
->count();
|
||||
//获取作者
|
||||
foreach ($list as $k => $v) {
|
||||
$stage_info = $this->journal_stage_obj->where('journal_stage_id',$v['journal_stage_id'])->find();
|
||||
$journal_info = $this->journal_obj->where('journal_id',$v['journal_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);
|
||||
}
|
||||
//标题斜体
|
||||
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;
|
||||
}
|
||||
$re['topic'] = $base_topic_info;
|
||||
$re['articleList'] = $list;
|
||||
$re['count'] = $count;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取期刊推广文章
|
||||
@@ -300,11 +517,10 @@ class Journal extends Controller {
|
||||
foreach ($list as $k => $v) {
|
||||
//组合cite信息
|
||||
$no = $stage_info['stage_no'] == 0 ? ':' : '(' . $stage_info['stage_no'] . '):';
|
||||
|
||||
if ($journal_info['journal_id'] == 22) {
|
||||
$cite = $v['abbr'] . '. ' . $v['title'] . '[J]. ' . $journal_info['jabbr'] . ',' . $stage_info['stage_year'] . ',' . $stage_info['stage_vol'] . $no . $v['npp'] . '. doi:' . $v['doi'];
|
||||
} else {
|
||||
$cite = $v['abbr'] . '. ' . $v['title'] . '. <i>' . $journal_info['jabbr'] . '</i>. ' . $stage_info['stage_year'] . ';' . $stage_info['stage_vol'] . $no . $v['npp'] . '. doi:' . $v['doi'];
|
||||
$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();
|
||||
|
||||
@@ -330,6 +546,59 @@ class Journal extends Controller {
|
||||
}
|
||||
return $frag;
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取文章作者分布
|
||||
* @description 获取文章作者分布
|
||||
* @author wangjinlei
|
||||
* @url /api/Journal/getAuthorFB
|
||||
* @method POST
|
||||
*
|
||||
* @param name:journal_id type:int require:1 desc:期刊id
|
||||
*/
|
||||
public function getAuthorFB(){
|
||||
$data = $this->request->post();
|
||||
$stages = $this->journal_stage_obj->where('journal_id',$data['journal_id'])->where('stage_year','>', (intval(date('Y'))-3))->where('state',0)->column('journal_stage_id');
|
||||
$articles = $this->article_obj->where('journal_id',$data['journal_id'])->where('journal_stage_id','in',$stages)->where('state',0)->column('article_id');
|
||||
$list = $this->article_author_obj->where('article_id','in',$articles)->where('state',0)->select();
|
||||
$frag = [];
|
||||
foreach ($list as $v){
|
||||
$frag[$v['author_name']] = $v['author_country'];
|
||||
}
|
||||
$f = [];
|
||||
foreach ($frag as $val){
|
||||
if(isset($f[$val])){
|
||||
$f[$val]++;
|
||||
}else{
|
||||
$f[$val] = 1;
|
||||
}
|
||||
}
|
||||
$res = [];
|
||||
foreach ($f as $k => $value){
|
||||
$res[] = array(
|
||||
'author_country'=>$k,
|
||||
'sum'=>$value
|
||||
);
|
||||
}
|
||||
for($i=0;$i<count($res);$i++){
|
||||
for ($j = $i+1; $j < count($res); $j++) {
|
||||
if($res[$i]['sum']<$res[$j]['sum']){
|
||||
$tem = $res[$i]; // 这里临时变量,存贮$i的值
|
||||
$res[$i] = $res[$j]; // 第一次更换位置
|
||||
$res[$j] = $tem; // 完成位置互换
|
||||
}
|
||||
}
|
||||
}
|
||||
$re['countrys'] = $res;
|
||||
// $list = $this->article_author_obj->field('author_country,COUNT(author_country) sum')
|
||||
// ->where('article_id','in',$articles)
|
||||
// ->where('state',0)
|
||||
// ->group('author_country')
|
||||
// ->orderRaw('COUNT(author_country) desc')
|
||||
// ->select();
|
||||
// $re['countrys'] = $list;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取onlinefirst文章
|
||||
@@ -378,14 +647,13 @@ class Journal extends Controller {
|
||||
$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>' . $journal_info['jabbr'] . '</i>. ' . $stage_info['stage_year'] . ';' . $stage_info['stage_vol'] . $no . $v['npp'] . '. doi:' . $v['doi'];
|
||||
$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);
|
||||
}
|
||||
|
||||
return json(['code' => 0, 'msg' => 'success', 'data' => ['articlelist' => $list, 'count' => $count]]);
|
||||
}
|
||||
|
||||
@@ -402,7 +670,7 @@ class Journal extends Controller {
|
||||
*/
|
||||
public function getNewsArticle() {
|
||||
$data = $this->request->post();
|
||||
$stages = $this->journal_stage_obj->where('journal_id', $data['journal_id'])->where('is_publish', 1)->where('state', 0)->column('journal_stage_id');
|
||||
$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.*')
|
||||
@@ -418,7 +686,7 @@ class Journal extends Controller {
|
||||
$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>' . $journal_info['jabbr'] . '</i>. ' . $stage_info['stage_year'] . ';' . $stage_info['stage_vol'] . $no . $v['npp'] . '. doi:' . $v['doi'];
|
||||
$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;
|
||||
@@ -477,7 +745,7 @@ class Journal extends Controller {
|
||||
$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>' . $journal_info['jabbr'] . '</i>. ' . $stage_info['stage_year'] . ';' . $stage_info['stage_vol'] . $no . $v['npp'] . '. doi:' . $v['doi'];
|
||||
$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;
|
||||
@@ -563,7 +831,7 @@ class Journal extends Controller {
|
||||
$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>' . $journal_info['jabbr'] . '</i>. ' . $stage_info['stage_year'] . ';' . $stage_info['stage_vol'] . $no . $v['npp'] . '. doi:' . $v['doi'];
|
||||
$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;
|
||||
@@ -595,7 +863,7 @@ class Journal extends Controller {
|
||||
*
|
||||
* @param name:journal_topic_id type:int require:1 desc:期刊话题id
|
||||
*
|
||||
* @return oldJournal:父期刊信息 Description
|
||||
* @return oldJournal:父期刊信息
|
||||
* @return journalList:话题列表array#
|
||||
*/
|
||||
public function getTopicList() {
|
||||
@@ -661,7 +929,7 @@ class Journal extends Controller {
|
||||
$data = $this->request->post();
|
||||
$papers = $this->journal_paper_obj->where('journal_id', $data['journal_id'])->where('state', 0)->select();
|
||||
foreach ($papers as $k => $v) {
|
||||
$cache_list = $this->journal_paper_art_obj->where('journal_paper_id', $v['journal_paper_id'])->where('state', 0)->select();
|
||||
$cache_list = $this->journal_paper_art_obj->where('journal_paper_id', $v['journal_paper_id'])->where('state', 0)->order('sort desc')->select();
|
||||
$papers[$k]['articles'] = $cache_list;
|
||||
}
|
||||
|
||||
@@ -753,7 +1021,6 @@ class Journal extends Controller {
|
||||
$charSet='utf8';
|
||||
$port='3306';
|
||||
$conn=mysql_connect($host,$user,$padd);
|
||||
|
||||
if(!$conn){
|
||||
echo 'unable to connect to DB '.mysql_error();
|
||||
exit();
|
||||
@@ -974,14 +1241,60 @@ class Journal extends Controller {
|
||||
$maidata['content'] = $tt;
|
||||
$maidata['tmail'] = 'publicrelations@tmrjournals.com';
|
||||
$maidata['tpassword'] = 'pRWU999999';
|
||||
$res = Queue::push('app\api\job\mail@fire', $maidata, "mail");
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 添加通用话题订阅
|
||||
* @description 添加通用话题订阅
|
||||
* @author wangjinlei
|
||||
* @url /api/Journal/addSubscribeBaseTopic
|
||||
* @method POST
|
||||
*
|
||||
* @param name:base_topic_id type:int require:1 desc:期刊话题id
|
||||
* @param name:email type:string require:1 desc:邮箱地址
|
||||
*/
|
||||
public function addSubscribeBaseTopic(){
|
||||
$data = $this->request->post();
|
||||
//去重
|
||||
$repeat = $this->subscribe_base_topic_obj
|
||||
->where('base_topic_id', $data['base_topic_id'])
|
||||
->where('email', $data['email'])
|
||||
->where('state', 0)
|
||||
->find();
|
||||
if ($repeat) {
|
||||
return jsonError('repeat subscribe!');
|
||||
}
|
||||
$insert['base_topic_id'] = $data['base_topic_id'];
|
||||
$insert['email'] = trim($data['email']);
|
||||
$id = $this->subscribe_base_topic_obj->insertGetId($insert);
|
||||
//发送邮件感谢
|
||||
$tt = 'Dear Researcher,<br><br>';
|
||||
$tt .= 'Welcome you to the email alert for the latest research and more. Thank you for your interest in our publications and topics.<br>';
|
||||
$tt .= '<a href="http://journalapi.tmrjournals.com/public/index.php/api/Journal/UnsubscribeBaseTopic/snum/' . $id . '">Unsubscribe</a><br>';
|
||||
$tt .= 'This service is provided by TMR Publishing Group | New Zealand<br>';
|
||||
$tt .= 'Telephone: +64 02108293806';
|
||||
$tt .= 'Email: publisher@tmrjournals.com';
|
||||
$tt .= 'www.tmrjournals.com';
|
||||
$maidata['email'] = $data['email'];
|
||||
$maidata['title'] = 'Thank you for subscribing.';
|
||||
$maidata['content'] = $tt;
|
||||
$maidata['tmail'] = 'publicrelations@tmrjournals.com';
|
||||
$maidata['tpassword'] = 'pRWU999999';
|
||||
Queue::push('app\api\job\mail@fire', $maidata, "mail");
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
|
||||
public function UnsubscribeTopic($snum) {
|
||||
$this->subscribe_topic_obj->where('subscribe_topic_id', $snum)->update(['state' => 1]);
|
||||
echo 'Unsubscribe successfully!';
|
||||
}
|
||||
|
||||
public function UnsubscribeBaseTopic($snum){
|
||||
$this->subscribe_base_topic_obj->where('subscribe_base_topic_id',$snum)->update(['state'=>1]);
|
||||
echo 'Unsubscribe successfully!';
|
||||
}
|
||||
|
||||
public function UnsubscribeJournal($snum) {
|
||||
$this->subscribe_journal_obj->where('subscribe_journal_id', $snum)->update(['state' => 1]);
|
||||
@@ -1022,15 +1335,17 @@ class Journal extends Controller {
|
||||
public function searchArticle() {
|
||||
$data = $this->request->post();
|
||||
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
|
||||
$arts = $this->article_author_obj->where('state', 0)->where('author_name', 'like', '%' . trim($data['keyword']) . '%')->column('article_id');
|
||||
$arts = $this->article_author_obj->where('state', 0)->where("author_name like '%" . str_replace("'","''",trim($data['keyword'])) . "%'")->column('article_id');
|
||||
$list = $this->article_obj
|
||||
->where('journal_id', $data['journal_id'])
|
||||
->where('state', 0)
|
||||
// ->where('article_id', 'in', $arts)
|
||||
// ->where('title like "%' . str_replace("'","''",trim($data['keyword'])) . '%" or abstract like "%' . str_replace("'","''",trim($data['keyword'])) . '%" or keywords like "%' . str_replace("'","''",trim($data['keyword'])) . '%"')
|
||||
->where(function($query)use($arts, $data) {
|
||||
$query->where('article_id', 'in', $arts)
|
||||
->whereOr('title|abstract|keywords', 'like', '%' . trim($data['keyword']) . '%');
|
||||
->whereOr("`title` like '%" . str_replace("'","''",trim($data['keyword'])) . "%' or `abstract` like '%" . str_replace("'","''",trim($data['keyword'])) . "%' or `keywords` like '%" . str_replace("'","''",trim($data['keyword'])) . "%'");
|
||||
})
|
||||
->orderRaw("(CASE WHEN title LIKE '%" . trim($data['keyword']) . "%' THEN 1 ELSE 0 END) desc")
|
||||
->orderRaw("(CASE WHEN title LIKE '%" . str_replace("'","''",trim($data['keyword'])) . "%' THEN 1 ELSE 0 END) desc")
|
||||
->limit($limit_start, $data['pageSize'])
|
||||
->select();
|
||||
$count = $this->article_obj
|
||||
@@ -1038,7 +1353,7 @@ class Journal extends Controller {
|
||||
->where('state', 0)
|
||||
->where(function($query)use($arts, $data) {
|
||||
$query->where('article_id', 'in', $arts)
|
||||
->whereOr('title|abstract|keywords', 'like', '%' . trim($data['keyword']) . '%');
|
||||
->whereOr('title|abstract|keywords', 'like', '%' . str_replace("'","''",trim($data['keyword'])) . '%');
|
||||
})
|
||||
->count();
|
||||
|
||||
@@ -1051,7 +1366,7 @@ class Journal extends Controller {
|
||||
$list[$k]['stage'] = $stage_info;
|
||||
//组合cite信息
|
||||
$no = $stage_info['stage_no'] == 0 ? ':' : '(' . $stage_info['stage_no'] . '):';
|
||||
$cite = $v['abbr'] . '. ' . $v['title'] . '. <i>' . $journal_info['jabbr'] . '</i>. ' . $stage_info['stage_year'] . ';' . $stage_info['stage_vol'] . $no . $v['npp'] . '. doi:' . $v['doi'];
|
||||
$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;
|
||||
@@ -1113,7 +1428,7 @@ class Journal extends Controller {
|
||||
$list[$k]['journal'] = $journal_info;
|
||||
//组合cite信息
|
||||
$no = $stage_info['stage_no'] == 0 ? ':' : '(' . $stage_info['stage_no'] . '):';
|
||||
$cite = $v['abbr'] . '. ' . $v['title'] . '. <i>' . $journal_info['jabbr'] . '</i>. ' . $stage_info['stage_year'] . ';' . $stage_info['stage_vol'] . $no . $v['npp'] . '. doi:' . $v['doi'];
|
||||
$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;
|
||||
@@ -1132,6 +1447,35 @@ class Journal extends Controller {
|
||||
$re['count'] = $count;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 编委国际化
|
||||
* @description 编委国际化
|
||||
* @author wangjinlei
|
||||
* @url /api/Journal/getBWGJH
|
||||
* @method POST
|
||||
*
|
||||
* @param name:journal_id type:int require:1 desc:journal_id
|
||||
*
|
||||
* @return country:国家数组#
|
||||
* @return count:总数
|
||||
*/
|
||||
public function getBWGJH() {
|
||||
$data = $this->request->post();
|
||||
$list = $this->board_obj->where('journal_id', $data['journal_id'])->where('state', 0)->select();
|
||||
$frag = [];
|
||||
foreach ($list as $v) {
|
||||
if (isset($frag[$v['country']])) {
|
||||
$frag[$v['country']]++;
|
||||
} else {
|
||||
$frag[$v['country']] = 1;
|
||||
}
|
||||
}
|
||||
$re['count'] = count($list);
|
||||
$re['country'] = $frag;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @title 查找文章精确查找
|
||||
@@ -1219,7 +1563,7 @@ class Journal extends Controller {
|
||||
$list[$k]['journal'] = $journal_info;
|
||||
//组合cite信息
|
||||
$no = $stage_info['stage_no'] == 0 ? ':' : '(' . $stage_info['stage_no'] . '):';
|
||||
$cite = $v['abbr'] . '. ' . $v['title'] . '. <i>' . $journal_info['jabbr'] . '</i>. ' . $stage_info['stage_year'] . ';' . $stage_info['stage_vol'] . $no . $v['npp'] . '. doi:' . $v['doi'];
|
||||
$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'];
|
||||
$list[$k]['cite'] = $cite;
|
||||
$list[$k]['authortitle'] = $this->getAuthor($v);
|
||||
//斜体变红
|
||||
@@ -1318,7 +1662,7 @@ class Journal extends Controller {
|
||||
$list[$k]['journal'] = $journal_info;
|
||||
//组合cite信息
|
||||
$no = $stage_info['stage_no'] == 0 ? ':' : '(' . $stage_info['stage_no'] . '):';
|
||||
$cite = $v['abbr'] . '. ' . $v['title'] . '. <i>' . $journal_info['jabbr'] . '</i>. ' . $stage_info['stage_year'] . ';' . $stage_info['stage_vol'] . $no . $v['npp'] . '. doi:' . $v['doi'];
|
||||
$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;
|
||||
|
||||
Reference in New Issue
Block a user