1824 lines
78 KiB
PHP
1824 lines
78 KiB
PHP
<?php
|
||
|
||
namespace app\api\controller;
|
||
|
||
use think\Controller;
|
||
use think\Db;
|
||
use think\Queue;
|
||
use think\Validate;
|
||
|
||
/**
|
||
* @title 期刊web接口
|
||
* @description 期刊web相关操作
|
||
* @group 期刊web相关
|
||
*/
|
||
class Journal extends Controller {
|
||
|
||
//put your code here
|
||
protected $admin_obj = '';
|
||
protected $journal_obj = '';
|
||
protected $article_obj = '';
|
||
protected $article_author_obj = '';
|
||
protected $article_ltai_obj = '';
|
||
protected $journal_topic_obj = '';
|
||
protected $journal_stage_obj = '';
|
||
protected $journal_notices_obj = '';
|
||
protected $journal_abs_obj = '';
|
||
protected $journal_cfp_obj = '';
|
||
protected $journal_line_obj = '';
|
||
protected $article_to_topic_obj = '';
|
||
protected $article_to_line_obj = '';
|
||
protected $journal_paper_obj = '';
|
||
protected $journal_paper_art_obj = '';
|
||
protected $subscribe_journal_obj = '';
|
||
protected $subscribe_topic_obj = '';
|
||
protected $board_obj = '';
|
||
protected $board_group_obj = '';
|
||
protected $base_topic_obj = '';
|
||
protected $subscribe_base_topic_obj = '';
|
||
protected $footer_obj = '';
|
||
protected $journal_for_author;
|
||
protected $journal_for_author_yc_obj = '';
|
||
protected $article_main_obj = '';
|
||
protected $article_cite_obj = '';
|
||
|
||
public function __construct(\think\Request $request = null) {
|
||
parent::__construct($request);
|
||
$this->admin_obj = Db::name('admin');
|
||
$this->journal_obj = Db::name('journal');
|
||
$this->article_obj = Db::name('article');
|
||
$this->article_author_obj = Db::name('article_author');
|
||
$this->article_ltai_obj = Db::name('article_ltai');
|
||
$this->journal_topic_obj = Db::name('journal_topic');
|
||
$this->journal_stage_obj = Db::name('journal_stage');
|
||
$this->journal_notices_obj = Db::name('journal_notices');
|
||
$this->journal_abs_obj = Db::name('journal_abstracting');
|
||
$this->journal_cfp_obj = Db::name('journal_cfp');
|
||
$this->journal_line_obj = Db::name('journal_line');
|
||
$this->article_to_topic_obj = Db::name('article_to_topic');
|
||
$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');
|
||
$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');
|
||
$this->footer_obj = Db::name('footer');
|
||
$this->journal_for_author = Db::name('journal_for_author');
|
||
$this->journal_for_author_yc_obj = Db::name('journal_for_author_yc');
|
||
$this->article_main_obj = Db::name("article_main");
|
||
$this->article_cite_obj = Db::name("article_cite");
|
||
}
|
||
|
||
/**
|
||
* @title 获取期刊列表
|
||
* @description 获取期刊列表
|
||
* @author wangjinlei
|
||
* @url /api/Journal/getJournalList
|
||
* @method POST
|
||
*
|
||
* @return journalList:期刊列表@
|
||
* @journalList title:标题 issn:issn editorinchief:editorinchief acceptance:acceptance finaldecision:finaldecision apc:apc
|
||
*/
|
||
public function getJournalList() {
|
||
$res = $this->journal_obj
|
||
->field('j_journal.*,j_admin.realname realname')
|
||
->join('j_admin', 'j_admin.admin_id = j_journal.editor_id', 'LEFT')
|
||
->where('j_journal.state',0)
|
||
// ->where('journal_id','<>',25)//临时去掉25号新刊
|
||
->order(['j_journal.sort desc', 'j_journal.journal_id'])
|
||
->select();
|
||
|
||
foreach($res as $k => $v){
|
||
if($v['journal_id']=='22'){
|
||
$res[$k]['title'] = "Chinese Quintessence Research 国学研究";
|
||
}
|
||
}
|
||
return json(['code' => 0, 'msg' => 'success', 'data' => ['journalList' => $res]]);
|
||
}
|
||
|
||
/**
|
||
* @title 获取期刊列表byname
|
||
* @description 获取期刊列表byname
|
||
* @author wangjinlei
|
||
* @url /api/Journal/getJournalListByName
|
||
* @method POST
|
||
*
|
||
*
|
||
* @return journalList:期刊列表@
|
||
* @journalList title:标题 issn:issn editorinchief:editorinchief acceptance:acceptance finaldecision:finaldecision apc:apc
|
||
*/
|
||
public function getJournalListByName() {
|
||
$where['j_journal.state'] = 0;
|
||
$res = $this->journal_obj
|
||
->field('j_journal.*,j_admin.realname realname')
|
||
->join('j_admin', 'j_admin.admin_id = j_journal.editor_id', 'LEFT')
|
||
->where($where)
|
||
->order('j_journal.title')
|
||
->select();
|
||
return json(['code' => 0, 'msg' => 'success', 'data' => ['journalList' => $res]]);
|
||
}
|
||
|
||
/**
|
||
* @title 获取期刊信息
|
||
* @description 获取期刊信息
|
||
* @author wangjinlei
|
||
* @url /api/Journal/getJournal
|
||
* @method POST
|
||
*
|
||
* @param name:journal_id type:int require:1 desc:期刊id
|
||
*
|
||
* @return journal:期刊基础信息array#
|
||
* @return relats:关联数组#
|
||
* @return journalAbs:期刊外链信息array#
|
||
* @return journalstage:期刊分期信息array#
|
||
*/
|
||
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();
|
||
$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]]);
|
||
}
|
||
|
||
|
||
public function getJournalEthics(){
|
||
$data = $this->request->post();
|
||
$rule = new Validate([
|
||
"journal_id"=>"require"
|
||
]);
|
||
if(!$rule->check($data)){
|
||
return jsonError($rule->getError());
|
||
}
|
||
$journal_info = $this->journal_obj->where('journal_id',$data['journal_id'])->find();
|
||
|
||
$url = "http://api.tmrjournals.com/public/index.php/api/Web/getJournalEthics";
|
||
$program['issn'] = $journal_info['issn'];
|
||
$res = object_to_array(json_decode(myPost($url,$program)));
|
||
return jsonSuccess($res);
|
||
|
||
}
|
||
|
||
/**
|
||
* 获取所有底栏文章
|
||
*/
|
||
public function getAllFooter(){
|
||
$where['footer_state'] = 0;
|
||
$list = $this->footer_obj->where($where)->order('sort desc')->select();
|
||
$frag = [];
|
||
$frag['Guidelines'] = [];
|
||
$frag['Products'] = [];
|
||
$frag['Join Us'] = [];
|
||
$frag['Cooperate with Us'] = [];
|
||
$frag['Publisher Information'] = [];
|
||
foreach ($list as $v) {
|
||
switch ($v['footer_group']) {
|
||
case 1:
|
||
$frag['Guidelines'][] = $v;
|
||
break;
|
||
case 2:
|
||
$frag['Join Us'][] = $v;
|
||
break;
|
||
case 3:
|
||
$frag['Products'][] = $v;
|
||
break;
|
||
case 4:
|
||
$frag['Cooperate with Us'][] = $v;
|
||
break;
|
||
case 5:
|
||
$frag['Publisher Information'][] = $v;
|
||
break;
|
||
}
|
||
}
|
||
$re['footers'] = $frag;
|
||
return jsonSuccess($re);
|
||
}
|
||
|
||
/**
|
||
* 获取底栏文章详情
|
||
*/
|
||
public function getFooterAtrNew(){
|
||
$data = $this->request->post();
|
||
// 验证规则
|
||
$rule = new Validate([
|
||
'footer_id' => 'require'
|
||
]);
|
||
if (!$rule->check($data)) {
|
||
return jsonError($rule->getError());
|
||
}
|
||
$footer_detail = $this->footer_obj->where('footer_id',$data['footer_id'])->find();
|
||
$re['footer'] = $footer_detail;
|
||
return jsonSuccess($re);
|
||
}
|
||
|
||
/**
|
||
* 获取所有forAuthors
|
||
*/
|
||
public function getForAuthors(){
|
||
$data = $this->request->post();
|
||
// 验证规则
|
||
$rule = new Validate([
|
||
'journal_id' => 'require'
|
||
]);
|
||
if (!$rule->check($data)) {
|
||
return jsonError($rule->getError());
|
||
}
|
||
$noinjfa = $this->journal_for_author_yc_obj->where('journal_id',$data['journal_id'])->column('jfa_id');
|
||
if($data['journal_id']!=22){
|
||
$journals[]=0;//0代表公共的项目
|
||
}
|
||
$journals[]=$data['journal_id'];
|
||
// $list = $this->journal_for_author->where('journal_id','in',$journals)->where('pid',0)->where('jfa_state',0)->order("sort desc")->select();
|
||
$list = $this->journal_for_author->where('pid',0)->where('jfa_state',0)->order("sort desc")->select();
|
||
foreach($list as $k => $v){
|
||
$cache_list = $this->journal_for_author->where('journal_id','in',$journals)->where('jfa_id',"not in",$noinjfa)->where('pid',$v['jfa_id'])->where('jfa_state',0)->order("sort desc")->select();
|
||
$list[$k]['children'] = $cache_list;
|
||
}
|
||
$re['forAuthors'] = $list;
|
||
return jsonSuccess($re);
|
||
|
||
|
||
|
||
}
|
||
|
||
/**
|
||
* @title 获取期刊信息通过issn
|
||
* @description 获取期刊信息通过issn
|
||
* @author wangjinlei
|
||
* @url /api/Journal/getJournalByIssn
|
||
* @method POST
|
||
*
|
||
* @param name:issn type:string require:1 desc:issn号
|
||
*
|
||
*/
|
||
public function getJournalByIssn() {
|
||
$data = $this->request->post();
|
||
$journal_info = $this->journal_obj->where('issn', $data['issn'])->find();
|
||
return jsonSuccess($journal_info);
|
||
}
|
||
|
||
/**
|
||
* @title 获取期刊话题
|
||
* @description 获取期刊话题
|
||
* @author wangjinlei
|
||
* @url /api/Journal/getJournalTopic
|
||
* @method POST
|
||
*
|
||
* @param name:journal_id type:int require:1 desc:期刊id
|
||
*
|
||
* @return topicList:期刊话题列表array#
|
||
*/
|
||
public function getJournalTopic() {
|
||
$data = $this->request->post();
|
||
$p_res = $this->journal_topic_obj
|
||
->where('journal_id', $data['journal_id'])
|
||
->where('state', 0)
|
||
->where('parent_id', 0)
|
||
->order('sort')
|
||
->select();
|
||
$res = $this->journal_topic_obj
|
||
->where('journal_id', $data['journal_id'])
|
||
->where('state', 0)
|
||
->where('parent_id', '>', 0)
|
||
->order('sort asc,journal_topic_id asc')
|
||
->select();
|
||
//处理数组
|
||
$frag = $p_res;
|
||
// foreach ($res as $v) {
|
||
// if ($v['parent_id'] == 0) {
|
||
// $frag[] = $v;
|
||
// }
|
||
// }
|
||
foreach ($frag as $kk => $vv) {
|
||
$frag[$kk] = $this->getChieldarr($vv, $res);
|
||
}
|
||
return json(['code' => 0, 'msg' => 'success', 'data' => ['topicList' => $frag]]);
|
||
}
|
||
|
||
private function getChieldarr($vv, $res) {
|
||
if ($vv['is_final'] == 1) {
|
||
return $vv;
|
||
}
|
||
foreach ($res as $v) {
|
||
if ($v['parent_id'] == $vv['journal_topic_id']) {
|
||
$vv['children'][] = $this->getChieldarr($v, $res);
|
||
}
|
||
}
|
||
return $vv;
|
||
}
|
||
|
||
/**
|
||
* @title 获取期刊line
|
||
* @description 获取期刊line
|
||
* @author wangjinlei
|
||
* @url /api/Journal/getJournalLine
|
||
* @method POST
|
||
*
|
||
* @param name:journal_id type:int require:1 desc:期刊id
|
||
*
|
||
* @return lines:期刊line数组#
|
||
*/
|
||
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();
|
||
|
||
$re['lines'] = $list;
|
||
return jsonSuccess($re);
|
||
}
|
||
|
||
/**
|
||
* @title 获取期刊line文章
|
||
* @description 获取期刊line文章
|
||
* @author wangjinlei
|
||
* @url /api/Journal/getJournalLineArt
|
||
* @method POST
|
||
*
|
||
* @param name:journal_line_id type:int require:1 desc:期刊lineid
|
||
*
|
||
* @return journalLine:期刊时间线信息#
|
||
* @return articles:期刊line文章数组#
|
||
*/
|
||
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();
|
||
$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)
|
||
->order('j_article.sort desc')
|
||
->select();
|
||
$re['journalLine'] = $journalLine;
|
||
$re['articles'] = strongArticleList($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)->order("sort desc")->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)
|
||
// ->where("j_journal.journal_id","<>",25)
|
||
->order("j_journal.sort desc")
|
||
->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.jabbr,j_journal.usx,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();
|
||
$re['topic'] = $base_topic_info;
|
||
$re['articleList'] = strongArticleList($list);;
|
||
$re['count'] = $count;
|
||
return jsonSuccess($re);
|
||
}
|
||
|
||
|
||
|
||
/**
|
||
* @title 获取期刊推广文章
|
||
* @description 获取期刊推广文章
|
||
* @author wangjinlei
|
||
* @url /api/Journal/getJournalArticles
|
||
* @method POST
|
||
*
|
||
* @param name:journal_id type:int require:1 desc:期刊id
|
||
*
|
||
* @return articleList:期刊话题列表array#
|
||
* @return stage:当前分期信息array#
|
||
*/
|
||
public function getJournalArticles() {
|
||
$data = $this->request->post();
|
||
$journal_info = $this->journal_obj->where('journal_id', $data['journal_id'])->find();
|
||
$order = "sort asc";
|
||
if(($journal_info['journal_id']==2&&$journal_info['publish_stage_id']>=337)||($journal_info['journal_id']==17&&$journal_info['publish_stage_id']>=346)||($journal_info['journal_id']==18&&$journal_info['publish_stage_id']>=338)){
|
||
$order = "sort desc";
|
||
}
|
||
$list = $this->article_obj->where('journal_stage_id', $journal_info['publish_stage_id'])
|
||
->where('state', 0)
|
||
->order($order)
|
||
->select();
|
||
$stage_info = $this->journal_stage_obj->where('journal_stage_id', $journal_info['publish_stage_id'])->find();
|
||
return json(['code' => 0, 'msg' => 'success', 'data' => ['stage' => $stage_info, 'articleList' => strongArticleList($list)]]);
|
||
}
|
||
|
||
private function getAuthor($article) {
|
||
$where['article_id'] = $article['article_id'];
|
||
$where['state'] = 0;
|
||
$list = $this->article_author_obj->where($where)->select();
|
||
$frag = '';
|
||
foreach ($list as $k => $v) {
|
||
$ca = '';
|
||
if ($v['orcid'] != '') {
|
||
$ca = '<a href="https://orcid.org/' . $v['orcid'] . '" target="_blank"><img src="img/or_id.png" alt="" style="width: 13px;margin-left: 3px;"></a>';
|
||
}
|
||
$frag = $frag == '' ? '' . $v['author_name'] . $ca : $frag . ', ' . $v['author_name'] . $ca;
|
||
}
|
||
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文章
|
||
* @description 获取onlinefirst文章
|
||
* @author wangjinlei
|
||
* @url /api/Journal/getOnlineArticle
|
||
* @method POST
|
||
*
|
||
* @param name:journal_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:文章列表array#
|
||
* @return count:总数
|
||
*/
|
||
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();
|
||
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
|
||
$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_article.is_public',1)
|
||
->order('j_journal_stage.stage_year desc,j_article.sort desc')
|
||
->limit($limit_start, $data['pageSize'])
|
||
->select();
|
||
$count = $this->article_obj
|
||
->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)
|
||
->count();
|
||
|
||
return json(['code' => 0, 'msg' => 'success', 'data' => ['articlelist' => strongArticleList($list), 'count' => $count]]);
|
||
}
|
||
|
||
/**
|
||
* @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 getNewsArticle() {
|
||
$data = $this->request->post();
|
||
$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')
|
||
->limit(4)
|
||
->select();
|
||
return json(['code' => 0, 'msg' => 'success', 'data' => ['articlelist' => strongArticleList($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
|
||
* @author wangjinlei
|
||
* @url /api/Journal/getTopArticle
|
||
* @method POST
|
||
*
|
||
* @param name:journal_id type:int require:1 desc:期刊id
|
||
* @param name:pageIndex type:int require:1 desc:当前页码数
|
||
* @param name:pageSize type:int require:1 desc:单页数据条数
|
||
*
|
||
* @return articles:文章列表array#
|
||
* @return count:总数
|
||
*/
|
||
public function getTopArticle() {
|
||
$data = $this->request->post();
|
||
$journal_info = $this->journal_obj->where('journal_id', $data['journal_id'])->find();
|
||
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
|
||
$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'])
|
||
->where('j_article.state', 0)
|
||
->where('j_journal_stage.is_publish', 1)
|
||
->where("j_journal_stage.stage_year",">",intval(date("Y"))-3)
|
||
->orderRaw('j_article.cited+j_article.abs_num+j_article.pdf_num desc')
|
||
->limit($limit_start, $data['pageSize'])
|
||
->select();
|
||
|
||
$count = $this->article_obj
|
||
->join('j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT')
|
||
->where('j_article.journal_id', $data['journal_id'])
|
||
->where('j_article.state', 0)
|
||
->where('j_journal_stage.is_publish', 1)
|
||
->where("j_journal_stage.stage_year",">",intval(date("Y"))-3)
|
||
->count();
|
||
|
||
if($count>50){//只显示前50片
|
||
$count = 50;
|
||
}
|
||
return jsonSuccess(['articles' => strongArticleList($list), 'count' => $count]);
|
||
}
|
||
|
||
/**
|
||
* @title 获取消息列表
|
||
* @description 获取消息列表
|
||
* @author wangjinlei
|
||
* @url /api/Journal/getNotices
|
||
* @method POST
|
||
*
|
||
* @param name:journal_id type:int require:1 desc:期刊id
|
||
*
|
||
* @return notices:消息列表array#
|
||
*/
|
||
public function getNotices() {
|
||
$data = $this->request->post();
|
||
$list = $this->journal_notices_obj->where('journal_id', $data['journal_id'])->where('state', 0)->order('ctime desc')->select();
|
||
return jsonSuccess(['notices' => $list]);
|
||
}
|
||
|
||
/**
|
||
* @title 获取消息详情
|
||
* @description 获取消息详情
|
||
* @author wangjinlei
|
||
* @url /api/Journal/getNoticesDetail
|
||
* @method POST
|
||
*
|
||
* @param name:journal_notices_id type:int require:1 desc:期刊消息id
|
||
*
|
||
* @return notices:消息内容#
|
||
*/
|
||
public function getNoticesDetail() {
|
||
$data = $this->request->post();
|
||
$notices_info = $this->journal_notices_obj->where('journal_notices_id', $data['journal_notices_id'])->find();
|
||
|
||
$re['notices'] = $notices_info;
|
||
return jsonSuccess($re);
|
||
}
|
||
|
||
/**
|
||
* @title 获取highl话题文章
|
||
* @description 获取highl话题文章
|
||
* @author wangjinlei
|
||
* @url /api/Journal/getHighTopicArticle
|
||
* @method POST
|
||
*
|
||
* @param name:journal_id type:int require:1 desc:期刊id
|
||
*
|
||
* @return topic_info:话题详情
|
||
* @return articlelist:文章列表array#
|
||
*/
|
||
public function getHighTopicArticle() {
|
||
$data = $this->request->post();
|
||
$topic_info = $this->journal_topic_obj->where('journal_id', $data['journal_id'])->where('position', 'highlights')->where('state', 0)->find();
|
||
$journal_info = $this->journal_obj->where('journal_id', $data['journal_id'])->find();
|
||
if ($topic_info) {
|
||
$list = $this->article_to_topic_obj->field('j_article.*,j_journal_stage.*')
|
||
->join(array(['j_article', 'j_article.article_id = j_article_to_topic.article_id', 'LEFT'], ['j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT']))
|
||
->where('j_article_to_topic.topic_id', $topic_info['journal_topic_id'])
|
||
->where('j_article_to_topic.state', 0)
|
||
->where('j_journal_stage.is_publish', 1)
|
||
->order('j_article.sort desc')
|
||
->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>' . 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;
|
||
}
|
||
//连续出版判断,决定是否显示出版时间
|
||
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;
|
||
}
|
||
}
|
||
|
||
return jsonSuccess(['topic_info' => $topic_info, 'articlelist' => $list]);
|
||
} else {
|
||
return jsonError('no highlights');
|
||
}
|
||
}
|
||
|
||
/**
|
||
* @title 获取话题列表
|
||
* @description 获取话题列表
|
||
* @author wangjinlei
|
||
* @url /api/Journal/getTopicList
|
||
* @method POST
|
||
*
|
||
* @param name:journal_topic_id type:int require:1 desc:期刊话题id
|
||
*
|
||
* @return oldJournal:父话题信息
|
||
* @return journalList:话题列表array#
|
||
*/
|
||
public function getTopicList() {
|
||
$data = $this->request->post();
|
||
$parent_info = $this->journal_topic_obj->where('journal_topic_id', $data['journal_topic_id'])->find();
|
||
$list = $this->journal_topic_obj->where('parent_id', $data['journal_topic_id'])->where('state', 0)->order('sort asc')->select();
|
||
|
||
$re['oldJournal'] = $parent_info;
|
||
$re['journalList'] = $list;
|
||
return jsonSuccess($re);
|
||
}
|
||
|
||
/**
|
||
* @title 获取期刊cfp
|
||
* @description 获取期刊cfp
|
||
* @author wangjinlei
|
||
* @url /api/Journal/getJournalCfp
|
||
* @method POST
|
||
*
|
||
* @param name:journal_id type:int require:1 desc:期刊id
|
||
*
|
||
* @return cfps:期刊cfps#
|
||
*/
|
||
public function getJournalCfp() {
|
||
$data = $this->request->post();
|
||
$list = $this->journal_cfp_obj->where('journal_id', $data['journal_id'])->where('state', 0)->order('sort desc ,journal_cfp_id asc')->select();
|
||
|
||
$re['cfps'] = $list;
|
||
return jsonSuccess($re);
|
||
}
|
||
|
||
/**
|
||
* @title 获取期刊cfp详情
|
||
* @description 获取期刊cfp详情
|
||
* @author wangjinlei
|
||
* @url /api/Journal/getCfpDetail
|
||
* @method POST
|
||
*
|
||
* @param name:journal_cfp_id type:int require:1 desc:期刊cfpid
|
||
*
|
||
* @return cfp:期刊cfp信息#
|
||
*/
|
||
public function getCfpDetail() {
|
||
$data = $this->request->post();
|
||
$cfp_info = $this->journal_cfp_obj->where('journal_cfp_id', $data['journal_cfp_id'])->find();
|
||
|
||
$re['cfp'] = $cfp_info;
|
||
return jsonSuccess($re);
|
||
}
|
||
|
||
/**
|
||
* @title 获取期刊footer
|
||
* @description 获取期刊footer
|
||
* @author wangjinlei
|
||
* @url /api/Journal/getFooter
|
||
* @method POST
|
||
*
|
||
* @param name:journal_id type:int require:1 desc:期刊id
|
||
*
|
||
* @return footers:footers#
|
||
*/
|
||
public function getFooter() {
|
||
$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)->order('sort desc')->select();
|
||
$papers[$k]['articles'] = $cache_list;
|
||
}
|
||
|
||
$re['footers'] = $papers;
|
||
return jsonSuccess($re);
|
||
}
|
||
|
||
/**
|
||
* @title 获取期刊footer文章
|
||
* @description 获取期刊footer文章
|
||
* @author wangjinlei
|
||
* @url /api/Journal/getFooterArt
|
||
* @method POST
|
||
*
|
||
* @param name:journal_paper_art_id type:int require:1 desc:期刊footer文章id
|
||
*
|
||
* @return article:文章内容#
|
||
*/
|
||
public function getFooterArt() {
|
||
$data = $this->request->post();
|
||
$article = $this->journal_paper_art_obj->where('journal_paper_art_id', $data['journal_paper_art_id'])->find();
|
||
|
||
$re['article'] = $article;
|
||
return jsonSuccess($re);
|
||
}
|
||
|
||
/**
|
||
* @title 获取期刊编委信息
|
||
* @description 获取期刊编委信息
|
||
* @author wangjinlei
|
||
* @url /api/Journal/getBoard
|
||
* @method POST
|
||
*
|
||
* @param name:journal_id type:int require:1 desc:期刊id
|
||
*
|
||
* @return boards:编委array#
|
||
*/
|
||
public function getBoard() {
|
||
$data = $this->request->post();
|
||
$list = $this->board_obj
|
||
->field('j_board.*,j_board_group.group_name')
|
||
->join('j_board_group', 'j_board.board_group_id = j_board_group.board_group_id', 'left')
|
||
->where('j_board.journal_id', $data['journal_id'])
|
||
->where('j_board.state', 0)
|
||
->order('j_board_group.sort desc,j_board_group.board_group_id,j_board.name')
|
||
->select();
|
||
$frag = [];
|
||
foreach ($list as $k => $v) {
|
||
if ($v['type'] == 0) {
|
||
$frag['main'][] = $v;
|
||
} elseif ($v['type'] == 1) {
|
||
$frag['remain'][] = $v;
|
||
} else {
|
||
if ($v['board_group_id'] == 0) {
|
||
$frag['member'][] = $v;
|
||
} else {
|
||
$frag['member'][$v['group_name']][] = $v;
|
||
}
|
||
}
|
||
}
|
||
$re['boards'] = $frag;
|
||
return jsonSuccess($re);
|
||
}
|
||
|
||
public function getBoard1(){
|
||
$data = $this->request->post();
|
||
$rule = new Validate([
|
||
"journal_id"=>"require"
|
||
]);
|
||
if(!$rule->check($data)){
|
||
return jsonError($rule->getError());
|
||
}
|
||
$journal_info = $this->journal_obj->where('journal_id',$data['journal_id'])->find();
|
||
$url = "http://api.tmrjournals.com/public/index.php/api/Web/getBoardsByIssn";
|
||
$program['issn'] = $journal_info['issn'];
|
||
$res = object_to_array(json_decode(myPost($url,$program)));
|
||
return jsonSuccess($res);
|
||
}
|
||
|
||
/**
|
||
* @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'])
|
||
->where('state', 0)
|
||
->find();
|
||
if ($repeat) {
|
||
return jsonError('repeat subscribe!');
|
||
}
|
||
$insert['journal_id'] = $data['journal_id'];
|
||
$insert['email'] = $data['email'];
|
||
$id = $this->subscribe_journal_obj->insertGetId($insert);
|
||
$journal_info = $this->journal_obj->where("journal_id", $data['journal_id'])->find();
|
||
//发送邮件感谢
|
||
$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/UnsubscribeJournal/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'] = $journal_info['title'] . " ISSN " . $journal_info['issn']; //'Traditional Medicine Research ISSN 2413-3973';
|
||
$maidata['content'] = $tt;
|
||
$maidata['tmail'] = 'publicrelations@tmrjournals.com';
|
||
$maidata['tpassword'] = 'pRWU999999';
|
||
Queue::push('app\api\job\mail@fire', $maidata, "mail");
|
||
|
||
return jsonSuccess([]);
|
||
}
|
||
|
||
/**
|
||
* @title 添加期刊订阅通过issn
|
||
* @description 添加期刊订阅通过issn
|
||
* @author wangjinlei
|
||
* @url /api/Journal/addSubscribeByIssn
|
||
* @method POST
|
||
*
|
||
* @param name:issn type:string require:1 desc:issn号
|
||
* @param name:email type:string require:1 desc:邮件地址
|
||
*/
|
||
public function addSubscribeByIssn() {
|
||
$data = $this->request->post();
|
||
$journal_info = $this->journal_obj->where('issn', $data['issn'])->find();
|
||
//去重
|
||
$repeat = $this->subscribe_journal_obj
|
||
->where('journal_id', $journal_info['journal_id'])
|
||
->where('email', $data['email'])
|
||
->where('state', 0)
|
||
->find();
|
||
if ($repeat) {
|
||
return jsonError('repeat subscribe!');
|
||
}
|
||
$insert['journal_id'] = $journal_info['journal_id'];
|
||
$insert['email'] = $data['email'];
|
||
$id = $this->subscribe_journal_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/UnsubscribeJournal/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'] = $journal_info['title'] . " ISSN " . $journal_info['issn']; //'Traditional Medicine Research ISSN 2413-3973';
|
||
$maidata['content'] = $tt;
|
||
$maidata['tmail'] = 'publicrelations@tmrjournals.com';
|
||
$maidata['tpassword'] = 'pRWU999999';
|
||
Queue::push('app\api\job\mail@fire', $maidata, "mail");
|
||
|
||
return jsonSuccess([]);
|
||
}
|
||
|
||
public function pushEmail() {
|
||
die;
|
||
$list = $this->subscribe_journal_obj->where('journal_id', 1)->select();
|
||
|
||
// $a = [];
|
||
// $a[] = ['email'=>'751475802@qq.com'];
|
||
// $a[] = ['email'=>'13662001490@126.com'];
|
||
foreach ($list as $v) {
|
||
$tt = 'Dear Researcher,<br><br>';
|
||
$tt .= 'We are so kindly to bring you a notice that we are glad to invite eminent people as the Reviewer for Traditional Medicine Research (ISSN 2413-3973).<br><br>';
|
||
$tt .= 'Traditional Medicine Research has been included in Emerging Sources Citation Index (ESCI), Embase, DOAJ, ProQuest, J-Gate, EuroPub, WHO-COVID-19 Database, Google Scholar, EBSCO, ect.<br><br>';
|
||
$tt .= 'TMR is a bimonthly, peer-reviewed open access journal. It is dedicated to report the research of the progress in clinical efficacy, action mechanism and theoretical research in the traditional medicine field. Including traditional medicine, ethnomedicine, herbal medicine, acupuncture and massage, rehabilitation, diet therapy, yoga, and other integrative medicine all over the world.<br><br>';
|
||
$tt .= 'If you interested in our invitation, please kindly send us your Resume and Photograph a d Email address to our Editorial office.<br><br>';
|
||
$tt .= 'Thank you for your attention to our invitation. If you have any questions, do not hesitate to contact us at tmr@tmrjournals.com. we look forward to a favorable reply.<br><br>';
|
||
$tt .= 'Best wishes,<br><br>';
|
||
$tt .= 'Editorial Office-Traditional Medicine Research<br>';
|
||
$tt .= 'Email: tmr@tmrjournals.com<br>';
|
||
$tt .= 'Traditional Medicine Research (TMR)';
|
||
$maidata['email'] = $v['email'];
|
||
$maidata['title'] = 'Traditional Medicine Research ISSN 2413-3973';
|
||
$maidata['content'] = $tt;
|
||
$maidata['tmail'] = 'publicrelations@tmrjournals.com';
|
||
$maidata['tpassword'] = 'pRWU999999';
|
||
Queue::push('app\api\job\mail@fire', $maidata, "mail");
|
||
}
|
||
}
|
||
|
||
/**
|
||
* @title 获取期刊主页分期信息
|
||
* @description 获取期刊主页分期信息
|
||
* @author wangjinlei
|
||
* @url /api/Journal/getMainPageStages
|
||
* @method POST
|
||
*
|
||
* @param name:journal_id type:int require:1 desc:期刊id
|
||
*
|
||
* @return stages:分期信息#
|
||
*/
|
||
public function getMainPageStages() {
|
||
$data = $this->request->post();
|
||
$show_type = $this->journal_obj->where(['journal_id'=> $data['journal_id'],'state'=>0])->value('topic_show_type');
|
||
$frag = [];
|
||
if($show_type==0){
|
||
$list = $this->journal_stage_obj->where('journal_id', $data['journal_id'])->where('stage_year', date("Y"))->where('is_publish', 1)->where('state', 0)->order("stage_no desc")->select();
|
||
if (count($list) == 0) {
|
||
$frag = $this->journal_stage_obj->where('journal_id', $data['journal_id'])->where('stage_year', date("Y", strtotime("-1 year")))->where('is_publish', 1)->where('state', 0)->order("stage_no desc")->select();
|
||
} else {
|
||
$frag = $list;
|
||
}
|
||
}else{
|
||
$frag=$this->journal_stage_obj
|
||
->where('journal_id', $data['journal_id'])
|
||
->where('is_publish', 1)
|
||
->where('state', 0)
|
||
->order("stage_year desc,stage_no desc")
|
||
->limit(1,4)
|
||
->select();
|
||
}
|
||
$re['topic_show_type'] = $show_type;
|
||
$re['stages'] = $frag;
|
||
return jsonSuccess($re);
|
||
}
|
||
|
||
/**
|
||
* @title 添加期刊话题订阅(批量)
|
||
* @description 添加期刊话题订阅(批量)
|
||
* @author wangjinlei
|
||
* @url /api/Journal/addSubscribeTopics
|
||
* @method POST
|
||
*
|
||
* @param name:topic_ids type:string require:1 desc:期刊话题id(1,2,3,4)
|
||
* @param name:email type:string require:1 desc:邮箱地址
|
||
*/
|
||
public function addSubscribeTopics() {
|
||
$data = $this->request->post();
|
||
// $topics = explode(',', $data['topic_ids']);
|
||
$topics = $data['topic_ids'];
|
||
$str = '';
|
||
foreach ($topics as $k => $v) {
|
||
//去重
|
||
$repeat = $this->subscribe_topic_obj
|
||
->where('topic_id', $v)
|
||
->where('email', $data['email'])
|
||
->where('state', 0)
|
||
->find();
|
||
if ($repeat) {
|
||
continue;
|
||
}
|
||
$insert['topic_id'] = $v;
|
||
$insert['email'] = $data['email'];
|
||
$id = $this->subscribe_topic_obj->insertGetId($insert);
|
||
$cache_info = $this->journal_topic_obj->where('journal_topic_id', $v)->find();
|
||
$str .= '<a href="http://journalapi.tmrjournals.com/public/index.php/api/Journal/UnsubscribeTopic/snum/' . $id . '">Unsubscribe topic->' . $cache_info['title'] . '</a><br>';
|
||
}
|
||
if ($str == '') {
|
||
return jsonError('repeat subscribe!');
|
||
}
|
||
//发送邮件感谢
|
||
$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 .= $str;
|
||
$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([]);
|
||
}
|
||
|
||
/**
|
||
* @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'])
|
||
->where('state', 0)
|
||
->find();
|
||
if ($repeat) {
|
||
return jsonError('repeat subscribe!');
|
||
}
|
||
$insert['topic_id'] = $data['topic_id'];
|
||
$insert['email'] = $data['email'];
|
||
$id = $this->subscribe_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/UnsubscribeTopic/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';
|
||
$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]);
|
||
echo 'Unsubscribe successfully!';
|
||
}
|
||
|
||
public function testEmail() {
|
||
// phpinfo();die;
|
||
|
||
|
||
$tt = '<form action="https://www.baidu.com" method="post">
|
||
Email: <input type="text" name="fname"><br>
|
||
<input type="submit" value="提交">
|
||
</form>';
|
||
$maidata['email'] = '751475802@qq.com';
|
||
$maidata['title'] = 'test';
|
||
$maidata['content'] = $tt;
|
||
$maidata['tmail'] = 'tmr@tmrjournals.com';
|
||
$maidata['tpassword'] = 'Wu9999999999';
|
||
Queue::push('app\api\job\mail@fire', $maidata, "mail");
|
||
}
|
||
|
||
/**
|
||
* @title 查找文章
|
||
* @description 查找文章
|
||
* @author wangjinlei
|
||
* @url /api/Journal/searchArticle
|
||
* @method POST
|
||
*
|
||
* @param name:keyword type:string require:1 desc:关键词
|
||
* @param name:journal_id type:int require:1 desc:期刊id
|
||
* @param name:pageIndex type:int require:1 desc:当前页码数
|
||
* @param name:pageSize type:int require:1 desc:单页数据条数
|
||
*
|
||
* @return articles:文章信息#
|
||
* @return count:总数
|
||
*/
|
||
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 '%" . 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` 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 '%" . str_replace("'", "''", trim($data['keyword'])) . "%' THEN 1 ELSE 0 END) desc")
|
||
->limit($limit_start, $data['pageSize'])
|
||
->select();
|
||
$count = $this->article_obj
|
||
->where('journal_id', $data['journal_id'])
|
||
->where('state', 0)
|
||
->where(function($query)use($arts, $data) {
|
||
$query->where('article_id', 'in', $arts)
|
||
->whereOr('title|abstract|keywords', 'like', '%' . str_replace("'", "''", trim($data['keyword'])) . '%');
|
||
})
|
||
->count();
|
||
|
||
$has_list = []; //title含有关键字
|
||
$no_list = []; //title不含关键字
|
||
//补全信息,分期,作者
|
||
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();
|
||
$list[$k]['stage'] = $stage_info;
|
||
//组合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);
|
||
|
||
//斜体变红
|
||
$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);
|
||
}
|
||
$cache_title = str_replace(trim($data['keyword']), '<b style="color:#c00">' . $data['keyword'] . '</b>', $cache_title);
|
||
$list[$k]['title'] = $cache_title;
|
||
$list[$k]['mains'] = getArticleMains($v['article_id']);
|
||
}
|
||
$re['articles'] = $list;
|
||
$re['count'] = $count;
|
||
return jsonSuccess($re);
|
||
}
|
||
|
||
/**
|
||
* @title 查找文章出版集团
|
||
* @description 查找文章出版集团
|
||
* @author wangjinlei
|
||
* @url /api/Journal/searchArticleAll
|
||
* @method POST
|
||
*
|
||
* @param name:keyword type:string require:1 desc:关键词
|
||
* @param name:pageIndex type:int require:1 desc:当前页码数
|
||
* @param name:pageSize type:int require:1 desc:单页数据条数
|
||
*
|
||
* @return articles:文章信息#
|
||
* @return count:总数
|
||
*/
|
||
public function searchArticleAll() {
|
||
$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');
|
||
$list = $this->article_obj
|
||
->where(function($query)use($arts, $data) {
|
||
$query->where('article_id', 'in', $arts)
|
||
->whereOr('title|abstract|keywords', 'like', '%' . trim($data['keyword']) . '%');
|
||
})
|
||
->orderRaw("(CASE WHEN title LIKE '%" . trim($data['keyword']) . "%' THEN 1 ELSE 0 END) desc")
|
||
->limit($limit_start, $data['pageSize'])
|
||
->select();
|
||
$count = $this->article_obj
|
||
->where(function($query)use($arts, $data) {
|
||
$query->where('article_id', 'in', $arts)
|
||
->whereOr('title|abstract|keywords', 'like', '%' . trim($data['keyword']) . '%');
|
||
})
|
||
->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();
|
||
$list[$k]['stage'] = $stage_info;
|
||
$list[$k]['journal'] = $journal_info;
|
||
//组合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);
|
||
//斜体变红
|
||
$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);
|
||
}
|
||
$cache_title = str_replace(trim($data['keyword']), '<b style="color:#c00">' . $data['keyword'] . '</b>', $cache_title);
|
||
$list[$k]['title'] = $cache_title;
|
||
}
|
||
$re['articles'] = $list;
|
||
$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);
|
||
}
|
||
|
||
/**编委国际化
|
||
* @return void
|
||
*/
|
||
public function getBWGJH1(){
|
||
$data = $this->request->post();
|
||
$rule = new Validate([
|
||
"journal_id"=>"require"
|
||
]);
|
||
if(!$rule->check($data)){
|
||
return jsonError($rule->getError());
|
||
}
|
||
$journal_info = $this->journal_obj->where('journal_id',$data['journal_id'])->find();
|
||
$url = "http://api.tmrjournals.com/public/index.php/api/Web/getBWGJHByIssn";
|
||
$program['issn'] = $journal_info['issn'];
|
||
$res = object_to_array(json_decode(myPost($url,$program)));
|
||
$re = $res['data'];
|
||
return jsonSuccess($re);
|
||
}
|
||
|
||
/**
|
||
* @title 查找文章精确查找
|
||
* @description 查找文章精确查找
|
||
* @author wangjinlei
|
||
* @url /api/Journal/searchDetail
|
||
* @method POST
|
||
*
|
||
* @param name:term type:string require:0 desc:关键词
|
||
* @param name:author type:string require:0 desc:作者
|
||
* @param name:title type:string require:0 desc:标题
|
||
* @param name:start_date type:string require:0 desc:开始时间
|
||
* @param name:end_date type:string require:0 desc:结束时间
|
||
* @param name:journal_id type:int require:1 desc:journal_id(如果不限期刊请填0)
|
||
* @param name:pageIndex type:int require:1 desc:当前页码数
|
||
* @param name:pageSize type:int require:1 desc:单页数据条数
|
||
*
|
||
* @return articles:文章信息#
|
||
* @return count:总数
|
||
*/
|
||
public function searchDetail() {
|
||
$data = $this->request->post();
|
||
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
|
||
|
||
//判断时间
|
||
$stages = [];
|
||
if (isset($data['start_date']) && $data['start_date'] != '') {
|
||
$date_where['stage_year'] = [['>=', $data['start_date']], ['<=', $data['end_date']]];
|
||
if ($data['journal_id'] != 0) {
|
||
$date_where['journal_id'] = $data['journal_id'];
|
||
}
|
||
$stages = $this->journal_stage_obj->where($date_where)->column('journal_stage_id');
|
||
|
||
if (count($stages) == 0) {
|
||
$re['articles'] = [];
|
||
$re['count'] = 0;
|
||
return jsonSuccess($re);
|
||
}
|
||
}
|
||
//组装作者
|
||
$arts = [];
|
||
if (isset($data['author']) && $data['author'] != '') {
|
||
$arts = $this->article_author_obj->where('state', 0)->where('author_name', 'like', '%' . trim($data['author']) . '%')->column('article_id');
|
||
if (count($arts) == 0) {
|
||
$re['articles'] = [];
|
||
$re['count'] = 0;
|
||
return jsonSuccess($re);
|
||
}
|
||
}
|
||
|
||
//构造查询语句
|
||
$where_str = '';
|
||
if (isset($data['term']) && $data['term'] != '') {
|
||
$where_str .= 'keywords like "%' . trim($data['term']) . '%" or abstract like "%' . trim($data['term']) . '%"';
|
||
}
|
||
if (isset($data['title']) && $data['title'] != '') {
|
||
$where_str .= $where_str == '' ? 'title like "%' . trim($data['title']) . '%"' : 'or title like "%' . trim($data['title']) . '%"';
|
||
}
|
||
if ($data['journal_id'] != 0) {
|
||
$where_str = $where_str == '' ? 'journal_id = ' . $data['journal_id'] : 'journal_id = ' . $data['journal_id'] . ' and (' . $where_str . ')';
|
||
}
|
||
if (count($stages) > 0) {
|
||
$c_str = '(' . implode(',', $stages) . ')';
|
||
$where_str = $where_str == '' ? 'journal_stage_id in ' . $c_str : 'journal_stage_id in ' . $c_str . ' and ' . $where_str;
|
||
}
|
||
|
||
if (count($arts) > 0) {
|
||
$a_str = '(' . implode(',', $arts) . ')';
|
||
$where_str = $where_str == '' ? 'article_id in ' . $a_str : 'article_id in ' . $a_str . ' and ' . $where_str;
|
||
}
|
||
$where_str = $where_str == '' ? 'state = 0' : 'state = 0 and ' . $where_str;
|
||
|
||
$list = $this->article_obj
|
||
->where($where_str)
|
||
->limit($limit_start, $data['pageSize'])
|
||
->select();
|
||
$count = $this->article_obj
|
||
->where($where_str)
|
||
->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();
|
||
$list[$k]['stage'] = $stage_info;
|
||
$list[$k]['journal'] = $journal_info;
|
||
//组合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'];
|
||
$list[$k]['cite'] = $cite;
|
||
$list[$k]['authortitle'] = $this->getAuthor($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);
|
||
}
|
||
if (isset($data['title'])) {
|
||
$cache_title = str_replace(trim($data['title']), '<b style="color:#c00">' . $data['title'] . '</b>', $cache_title);
|
||
}
|
||
$list[$k]['title'] = $cache_title;
|
||
}
|
||
|
||
$re['articles'] = $list;
|
||
$re['count'] = $count;
|
||
return jsonSuccess($re);
|
||
}
|
||
|
||
/**
|
||
* @title 查找文章精确查找(新)
|
||
* @description 查找文章精确查找(新)
|
||
* @author wangjinlei
|
||
* @url /api/Journal/searchArticleMenu
|
||
* @method POST
|
||
*
|
||
* @param name:key1 type:string require:1 desc:第一个条件(title,abstract,keywords,author)
|
||
* @param name:val1 type:string require:1 desc:第一个值
|
||
* @param name:oper type:string require:0 desc:运算符(and\or)
|
||
* @param name:key2 type:string require:0 desc:第二个条件(title,abstract,keywords,author)
|
||
* @param name:val2 type:string require:0 desc:第二个值
|
||
* @param name:journal_id type:int require:1 desc:journal_id(demo:1,2,3)
|
||
* @param name:pageIndex type:int require:1 desc:当前页码数
|
||
* @param name:pageSize type:int require:1 desc:单页数据条数
|
||
*
|
||
* @return articles:文章信息#
|
||
* @return count:总数
|
||
*/
|
||
public function searchArticleMenu() {
|
||
$data = $this->request->post();
|
||
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
|
||
|
||
//组合where语句
|
||
$where_str = '';
|
||
|
||
if ($data['key1'] == 'author') {
|
||
$arts = $this->article_author_obj->where('state', 0)->where('author_name|email', 'like', '%' . trim($data['val1']) . '%')->column('article_id');
|
||
$a_str = '(' . implode(',', $arts) . ')';
|
||
if($a_str=="()"){
|
||
$cre['articles'] = [];
|
||
$cre['count'] = 0;
|
||
return jsonSuccess($cre);
|
||
}
|
||
$where_str = '(article_id in ' . $a_str;
|
||
} else {
|
||
$where_str = '(' . $data['key1'] . ' like "%' . $data['val1'] . '%"';
|
||
}
|
||
if (isset($data['key2']) && $data['key2'] != '') {
|
||
if ($data['oper'] == 'and') {
|
||
$where_str = $where_str . ' and ';
|
||
} else {
|
||
$where_str = $where_str . ' or ';
|
||
}
|
||
if ($data['key2'] == 'author') {
|
||
$arts = $this->article_author_obj->where('state', 0)->where('author_name', 'like', '%' . trim($data['val2']) . '%')->column('article_id');
|
||
$a_str = '(' . implode(',', $arts) . ')';
|
||
$where_str = $where_str . ' article_id in ' . $a_str;
|
||
} else {
|
||
$where_str = $where_str . ' ' . $data['key2'] . ' like "%' . $data['val2'] . '%"';
|
||
}
|
||
}
|
||
//处理journal_id
|
||
$where_str = $where_str . ') and journal_id in (' . trim($data['journal_id']) . ') and state = 0 ';
|
||
//处理order
|
||
$order_str = '';
|
||
if ($data['key1'] == 'title' && (isset($data['key2']) && $data['key2'] == 'title')) {
|
||
$order_str = "((CASE WHEN title LIKE '%" . trim($data['val1']) . "%' THEN 1 ELSE 0 END) + (CASE WHEN title LIKE '%" . trim($data['val2']) . "%' THEN 1 ELSE 0 END)) desc";
|
||
} elseif ($data['key1'] == 'title' || (isset($data['key2']) && $data['key2'] == 'title')) {
|
||
if ($data['key1'] == 'title') {
|
||
$order_str = "(CASE WHEN title LIKE '%" . trim($data['val1']) . "%' THEN 1 ELSE 0 END) desc";
|
||
} else {
|
||
$order_str = "(CASE WHEN title LIKE '%" . trim($data['val2']) . "%' THEN 1 ELSE 0 END) desc";
|
||
}
|
||
} else {
|
||
$order_str = "article_id desc";
|
||
}
|
||
|
||
$list = $this->article_obj
|
||
->where($where_str)
|
||
->orderRaw($order_str)
|
||
->limit($limit_start, $data['pageSize'])
|
||
->select();
|
||
$count = $this->article_obj
|
||
->where($where_str)
|
||
->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();
|
||
$list[$k]['stage'] = $stage_info;
|
||
$list[$k]['journal'] = $journal_info;
|
||
//组合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);
|
||
//斜体变红
|
||
$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);
|
||
}
|
||
if ($data['key1'] == 'title') {
|
||
$cache_title = str_replace(trim($data['val1']), '<b style="color:#c00">' . $data['val1'] . '</b>', $cache_title);
|
||
}
|
||
if (isset($data['key2']) && $data['key2'] == 'title') {
|
||
$cache_title = str_replace(trim($data['val2']), '<b style="color:#c00">' . $data['val2'] . '</b>', $cache_title);
|
||
}
|
||
$list[$k]['title'] = $cache_title;
|
||
}
|
||
|
||
$re['articles'] = $list;
|
||
$re['count'] = $count;
|
||
return jsonSuccess($re);
|
||
}
|
||
}
|