|
|
|
|
@@ -4,6 +4,7 @@ namespace app\api\controller;
|
|
|
|
|
|
|
|
|
|
use think\Controller;
|
|
|
|
|
use think\Db;
|
|
|
|
|
use think\Queue;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @title 期刊web接口
|
|
|
|
|
@@ -28,6 +29,8 @@ class Journal extends Controller {
|
|
|
|
|
protected $article_to_line_obj = '';
|
|
|
|
|
protected $journal_paper_obj = '';
|
|
|
|
|
protected $journal_paper_art_obj = '';
|
|
|
|
|
protected $subscribe_journal_obj = '';
|
|
|
|
|
protected $subscribe_topic_obj = '';
|
|
|
|
|
|
|
|
|
|
public function __construct(\think\Request $request = null) {
|
|
|
|
|
parent::__construct($request);
|
|
|
|
|
@@ -46,6 +49,8 @@ class Journal extends Controller {
|
|
|
|
|
$this->article_to_line_obj = Db::name('article_to_line');
|
|
|
|
|
$this->journal_paper_obj = Db::name('journal_paper');
|
|
|
|
|
$this->journal_paper_art_obj = Db::name('journal_paper_art');
|
|
|
|
|
$this->subscribe_journal_obj = Db::name('subscribe_journal');
|
|
|
|
|
$this->subscribe_topic_obj = Db::name('subscribe_topic');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@@ -69,7 +74,7 @@ class Journal extends Controller {
|
|
|
|
|
->select();
|
|
|
|
|
return json(['code' => 0, 'msg' => 'success', 'data' => ['journalList' => $res]]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @title 获取期刊列表byname
|
|
|
|
|
* @description 获取期刊列表byname
|
|
|
|
|
@@ -109,11 +114,11 @@ class Journal extends Controller {
|
|
|
|
|
public function getJournal() {
|
|
|
|
|
$data = $this->request->post();
|
|
|
|
|
$journal_info = $this->journal_obj->where('journal_id', $data['journal_id'])->find();
|
|
|
|
|
$rearr = $journal_info['relate']==''?[]:explode(',',$journal_info['relate']);
|
|
|
|
|
$relatelist = $this->journal_obj->where('journal_id','in',$rearr)->where('state',0)->select();
|
|
|
|
|
$rearr = $journal_info['relate'] == '' ? [] : explode(',', $journal_info['relate']);
|
|
|
|
|
$relatelist = $this->journal_obj->where('journal_id', 'in', $rearr)->where('state', 0)->select();
|
|
|
|
|
$absList = $this->journal_abs_obj->where('journal_id', $data['journal_id'])->where('state', 0)->order('sort')->select();
|
|
|
|
|
$stageList = $this->journal_stage_obj->where('journal_id', $data['journal_id'])->where('is_publish', 1)->where('state', 0)->order('stage_year desc,stage_no desc')->select();
|
|
|
|
|
return json(['code' => 0, 'msg' => 'success', 'data' => ['journal' => $journal_info,'relats'=>$relatelist ,'journalAbs' => $absList, 'journalStage' => $stageList]]);
|
|
|
|
|
return json(['code' => 0, 'msg' => 'success', 'data' => ['journal' => $journal_info, 'relats' => $relatelist, 'journalAbs' => $absList, 'journalStage' => $stageList]]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@@ -157,7 +162,7 @@ class Journal extends Controller {
|
|
|
|
|
}
|
|
|
|
|
return $vv;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @title 获取期刊line
|
|
|
|
|
* @description 获取期刊line
|
|
|
|
|
@@ -169,14 +174,14 @@ class Journal extends Controller {
|
|
|
|
|
*
|
|
|
|
|
* @return lines:期刊line数组#
|
|
|
|
|
*/
|
|
|
|
|
public function getJournalLine(){
|
|
|
|
|
public function getJournalLine() {
|
|
|
|
|
$data = $this->request->post();
|
|
|
|
|
$list = $this->journal_line_obj->where('journal_id',$data['journal_id'])->where('state',0)->order('journal_line_id')->select();
|
|
|
|
|
|
|
|
|
|
$list = $this->journal_line_obj->where('journal_id', $data['journal_id'])->where('state', 0)->order('journal_line_id')->select();
|
|
|
|
|
|
|
|
|
|
$re['lines'] = $list;
|
|
|
|
|
return jsonSuccess($re);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @title 获取期刊line文章
|
|
|
|
|
* @description 获取期刊line文章
|
|
|
|
|
@@ -189,14 +194,14 @@ class Journal extends Controller {
|
|
|
|
|
* @return journalLine:期刊时间线信息#
|
|
|
|
|
* @return articles:期刊line文章数组#
|
|
|
|
|
*/
|
|
|
|
|
public function getJournalLineArt(){
|
|
|
|
|
public function getJournalLineArt() {
|
|
|
|
|
$data = $this->request->post();
|
|
|
|
|
$journalLine = $this->journal_line_obj->where('journal_line_id',$data['journal_line_id'])->find();
|
|
|
|
|
$journal_info = $this->journal_obj->where('journal_id',$journalLine['journal_id'])->find();
|
|
|
|
|
$journalLine = $this->journal_line_obj->where('journal_line_id', $data['journal_line_id'])->find();
|
|
|
|
|
$journal_info = $this->journal_obj->where('journal_id', $journalLine['journal_id'])->find();
|
|
|
|
|
$list = $this->article_to_line_obj->field('j_article.*,j_journal_stage.*')
|
|
|
|
|
->join([['j_article','j_article_to_line.article_id = j_article.article_id','LEFT'],['j_journal_stage','j_journal_stage.journal_stage_id = j_article.journal_stage_id','LEFT']])
|
|
|
|
|
->where('j_article_to_line.journal_line_id',$data['journal_line_id'])
|
|
|
|
|
->where('j_article_to_line.state',0)
|
|
|
|
|
->join([['j_article', 'j_article_to_line.article_id = j_article.article_id', 'LEFT'], ['j_journal_stage', 'j_journal_stage.journal_stage_id = j_article.journal_stage_id', 'LEFT']])
|
|
|
|
|
->where('j_article_to_line.journal_line_id', $data['journal_line_id'])
|
|
|
|
|
->where('j_article_to_line.state', 0)
|
|
|
|
|
->order('j_article.sort desc')
|
|
|
|
|
->select();
|
|
|
|
|
//标题斜体
|
|
|
|
|
@@ -208,10 +213,10 @@ class Journal extends Controller {
|
|
|
|
|
}
|
|
|
|
|
$list[$k]['title'] = $cache_title;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取作者
|
|
|
|
|
foreach ($list as $k => $v) {
|
|
|
|
|
$stage_info = $this->journal_stage_obj->where('journal_stage_id',$v['journal_stage_id'])->find();
|
|
|
|
|
$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'];
|
|
|
|
|
@@ -223,7 +228,7 @@ class Journal extends Controller {
|
|
|
|
|
// foreach ($list as $k => $v) {
|
|
|
|
|
// $list[$k]['authortitle'] = $this->getAuthor($v);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$re['journalLine'] = $journalLine;
|
|
|
|
|
$re['articles'] = $list;
|
|
|
|
|
return jsonSuccess($re);
|
|
|
|
|
@@ -258,25 +263,26 @@ class Journal extends Controller {
|
|
|
|
|
}
|
|
|
|
|
$list[$k]['title'] = $cache_title;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取作者
|
|
|
|
|
foreach ($list as $k => $v) {
|
|
|
|
|
//组合cite信息
|
|
|
|
|
$no = $stage_info['stage_no'] == 0 ? ':' : '(' . $stage_info['stage_no'] . '):';
|
|
|
|
|
|
|
|
|
|
if($journal_info['journal_id']==22){
|
|
|
|
|
|
|
|
|
|
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{
|
|
|
|
|
} 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>' . $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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return json(['code' => 0, 'msg' => 'success', 'data' => ['stage' => $stage_info, 'articleList' => $list]]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function getAuthor($article) {
|
|
|
|
|
$where['article_id'] = $article['article_id'];
|
|
|
|
|
$where['state'] = 0;
|
|
|
|
|
@@ -302,7 +308,7 @@ class Journal extends Controller {
|
|
|
|
|
public function getOnlineArticle() {
|
|
|
|
|
$data = $this->request->post();
|
|
|
|
|
$stages = $this->journal_stage_obj->where('journal_id', $data['journal_id'])->where('is_publish', 0)->where('state', 0)->column('journal_stage_id');
|
|
|
|
|
$journal_info = $this->journal_obj->where('journal_id',$data['journal_id'])->find();
|
|
|
|
|
$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')
|
|
|
|
|
@@ -323,7 +329,7 @@ class Journal extends Controller {
|
|
|
|
|
|
|
|
|
|
//获取作者
|
|
|
|
|
foreach ($list as $k => $v) {
|
|
|
|
|
$stage_info = $this->journal_stage_obj->where('journal_stage_id',$v['journal_stage_id'])->find();
|
|
|
|
|
$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'];
|
|
|
|
|
@@ -348,7 +354,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');
|
|
|
|
|
$journal_info = $this->journal_obj->where('journal_id',$data['journal_id'])->find();
|
|
|
|
|
$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')
|
|
|
|
|
@@ -359,7 +365,7 @@ class Journal extends Controller {
|
|
|
|
|
->select();
|
|
|
|
|
//获取作者
|
|
|
|
|
foreach ($list as $k => $v) {
|
|
|
|
|
$stage_info = $this->journal_stage_obj->where('journal_stage_id',$v['journal_stage_id'])->find();
|
|
|
|
|
$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'];
|
|
|
|
|
@@ -392,7 +398,7 @@ class Journal extends Controller {
|
|
|
|
|
*/
|
|
|
|
|
public function getTopArticle() {
|
|
|
|
|
$data = $this->request->post();
|
|
|
|
|
$journal_info = $this->journal_obj->where('journal_id',$data['journal_id'])->find();
|
|
|
|
|
$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_id', $data['journal_id'])
|
|
|
|
|
@@ -402,7 +408,7 @@ class Journal extends Controller {
|
|
|
|
|
|
|
|
|
|
//获取作者
|
|
|
|
|
foreach ($list as $k => $v) {
|
|
|
|
|
$stage_info = $this->journal_stage_obj->where('journal_stage_id',$v['journal_stage_id'])->find();
|
|
|
|
|
$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'];
|
|
|
|
|
@@ -483,14 +489,14 @@ class Journal extends Controller {
|
|
|
|
|
->select();
|
|
|
|
|
|
|
|
|
|
//获取作者
|
|
|
|
|
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>' . $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);
|
|
|
|
|
}
|
|
|
|
|
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>' . $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);
|
|
|
|
|
}
|
|
|
|
|
//标题斜体
|
|
|
|
|
foreach ($list as $k => $v) {
|
|
|
|
|
$caches = $this->article_ltai_obj->where('article_id', $v['article_id'])->where('state', 0)->column('content');
|
|
|
|
|
@@ -609,4 +615,88 @@ class Journal extends Controller {
|
|
|
|
|
return jsonSuccess($re);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @title 获取期刊话题列表
|
|
|
|
|
* @description 获取期刊话题列表
|
|
|
|
|
* @author wangjinlei
|
|
|
|
|
* @url /api/Journal/getTopicForSubscribe
|
|
|
|
|
* @method POST
|
|
|
|
|
*
|
|
|
|
|
* @param name:journal_id type:int require:1 desc:期刊id
|
|
|
|
|
*
|
|
|
|
|
* @return topics:话题列表array#
|
|
|
|
|
*/
|
|
|
|
|
public function getTopicForSubscribe() {
|
|
|
|
|
$data = $this->request->post();
|
|
|
|
|
$list = $this->journal_topic_obj->where('journal_id', $data['journal_id'])->where('state', 0)->where('level', 2)->select();
|
|
|
|
|
|
|
|
|
|
$re['topics'] = $list;
|
|
|
|
|
return jsonSuccess($re);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @title 添加期刊订阅
|
|
|
|
|
* @description 添加期刊订阅
|
|
|
|
|
* @author wangjinlei
|
|
|
|
|
* @url /api/Journal/addSubscribeJournal
|
|
|
|
|
* @method POST
|
|
|
|
|
*
|
|
|
|
|
* @param name:journal_id type:int require:1 desc:期刊id
|
|
|
|
|
* @param name:email type:string require:1 desc:邮件地址
|
|
|
|
|
*/
|
|
|
|
|
public function addSubscribeJournal() {
|
|
|
|
|
$data = $this->request->post();
|
|
|
|
|
//去重
|
|
|
|
|
$repeat = $this->subscribe_journal_obj
|
|
|
|
|
->where('journal_id', $data['journal_id'])
|
|
|
|
|
->where('email', $data['email'])
|
|
|
|
|
->find();
|
|
|
|
|
if ($repeat) {
|
|
|
|
|
return jsonError('repeat subscribe!');
|
|
|
|
|
}
|
|
|
|
|
$insert['journal_id'] = $data['journal_id'];
|
|
|
|
|
$insert['email'] = $data['email'];
|
|
|
|
|
$this->subscribe_journal_obj->insert($insert);
|
|
|
|
|
return jsonSuccess([]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @title 添加期刊话题订阅
|
|
|
|
|
* @description 添加期刊话题订阅
|
|
|
|
|
* @author wangjinlei
|
|
|
|
|
* @url /api/Journal/addSubscribeTopic
|
|
|
|
|
* @method POST
|
|
|
|
|
*
|
|
|
|
|
* @param name:topic_id type:int require:1 desc:期刊话题id
|
|
|
|
|
* @param name:email type:string require:1 desc:邮箱地址
|
|
|
|
|
*/
|
|
|
|
|
public function addSubscribeTopic() {
|
|
|
|
|
$data = $this->request->post();
|
|
|
|
|
//去重
|
|
|
|
|
$repeat = $this->subscribe_topic_obj
|
|
|
|
|
->where('topic_id', $data['topic_id'])
|
|
|
|
|
->where('email', $data['email'])
|
|
|
|
|
->find();
|
|
|
|
|
if ($repeat) {
|
|
|
|
|
return jsonError('repeat subscribe!');
|
|
|
|
|
}
|
|
|
|
|
$insert['topic_id'] = $data['topic_id'];
|
|
|
|
|
$insert['email'] = $data['email'];
|
|
|
|
|
$this->subscribe_topic_obj->insert($insert);
|
|
|
|
|
return jsonSuccess([]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testEmail() {
|
|
|
|
|
// phpinfo();die;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$tt = 'mytestemail.';
|
|
|
|
|
$maidata['email'] = '751475802@qq.com';
|
|
|
|
|
$maidata['title'] = '测试邮件1';
|
|
|
|
|
$maidata['content'] = $tt;
|
|
|
|
|
$maidata['tmail'] = 'tmr@tmrjournals.com';
|
|
|
|
|
$maidata['tpassword'] = 'Wu999999tm';
|
|
|
|
|
Queue::push('app\api\job\mail@fire', $maidata, "mail");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|