20201112
This commit is contained in:
@@ -84,9 +84,11 @@ class Article extends Controller {
|
||||
if($journal_info['journal_id']==22){
|
||||
$cite = $article_info['abbr'] . '. ' . $article_info['title'] . '[J]. ' . $journal_info['jabbr'] . ',' . $stage_info['stage_year'] . ',' . $stage_info['stage_vol'] . $no . $article_info['npp'] . '. doi:' . $article_info['doi'];
|
||||
}else{
|
||||
$cite = $article_info['abbr'] . '. ' . $article_info['title'] . '. <i>' . $journal_info['jabbr'] . '</i>. ' . $stage_info['stage_year'] . ';' . $stage_info['stage_vol'] . $no . $article_info['npp'] . '. doi:' . $article_info['doi'];
|
||||
$cite = $article_info['abbr'] . '. ' . $article_info['title'] . '. <i>' . choiseJabbr($article_info['article_id'],$journal_info['jabbr']) . '</i>. ' . $stage_info['stage_year'] . ';' . $stage_info['stage_vol'] . $no . $article_info['npp'] . '. doi:' . $article_info['doi'];
|
||||
}
|
||||
|
||||
// echo ($article_info['article_id']<1799&&$article_info['npp']=='Cancer Adv'?'TMR Cancer':$article_info['npp']);
|
||||
|
||||
if(stripos($article_info['npp'], '-')){
|
||||
$cc = explode('-', $article_info['npp']);
|
||||
$article_info['first_page'] = $cc[0];
|
||||
@@ -107,6 +109,12 @@ class Article extends Controller {
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
|
||||
public function mytest(){
|
||||
$article_info = $this->article_obj->where('article_id',1689)->find();
|
||||
echo ($article_info['article_id']<1799&&$article_info['npp']=='Cancer Adv'?'TMR Cancer':$article_info['npp']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取关键词相关文章
|
||||
* @description 获取关键词相关文章
|
||||
@@ -180,7 +188,9 @@ class Article extends Controller {
|
||||
->join(array(['j_article', 'j_article_to_topic.article_id = j_article.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', $data['topic_id'])
|
||||
->where('j_article_to_topic.state', 0)
|
||||
->order('j_article.journal_stage_id desc , j_article.article_id desc')
|
||||
->where('j_journal_stage.stage_year','>',intval(date('Y'))-3)
|
||||
->orderRaw('(abs_num+pdf_num) desc')
|
||||
// ->order('j_article.journal_stage_id desc , j_article.article_id desc')
|
||||
->limit($limit_start,$data['pageSize'])
|
||||
->select();
|
||||
$count = $this->article_to_topic_obj
|
||||
@@ -192,7 +202,7 @@ class Article 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;
|
||||
@@ -255,7 +265,7 @@ class Article 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;
|
||||
@@ -362,7 +372,7 @@ class Article 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;
|
||||
|
||||
@@ -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;
|
||||
@@ -266,6 +270,219 @@ class Journal extends Controller {
|
||||
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 获取期刊推广文章
|
||||
* @description 获取期刊推广文章
|
||||
@@ -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();
|
||||
|
||||
@@ -331,6 +547,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文章
|
||||
* @description 获取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,6 +1241,47 @@ 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([]);
|
||||
}
|
||||
@@ -983,6 +1291,11 @@ class Journal extends Controller {
|
||||
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!';
|
||||
@@ -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;
|
||||
@@ -1133,6 +1448,35 @@ class Journal extends Controller {
|
||||
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 查找文章精确查找
|
||||
* @description 查找文章精确查找
|
||||
@@ -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;
|
||||
|
||||
@@ -132,12 +132,12 @@ class Main extends Controller {
|
||||
* @return articles:文章信息array#
|
||||
*/
|
||||
public function getMainArticles(){
|
||||
$list_tmr = $this->article_obj->field('j_article.*,j_journal_stage.*,j_journal.title journal_title,j_journal.jabbr journal_short,j_journal.usx usx')->join(array(['j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT'],['j_journal','j_article.journal_id = j_journal.journal_id','LEFT']))->where('j_article.journal_id',1)->where('j_journal_stage.is_publish',1)->where('j_article.state',0)->order('j_article.article_id desc')->limit(3)->select();
|
||||
$list_zh = $this->article_obj->field('j_article.*,j_journal_stage.*,j_journal.title journal_title,j_journal.jabbr journal_short,j_journal.usx usx')->join(array(['j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT'],['j_journal','j_article.journal_id = j_journal.journal_id','LEFT']))->where('j_article.journal_id',17)->where('j_journal_stage.is_publish',1)->where('j_article.state',0)->order('j_article.article_id desc')->limit(1)->select();
|
||||
$list_life = $this->article_obj->field('j_article.*,j_journal_stage.*,j_journal.title journal_title,j_journal.jabbr journal_short,j_journal.usx usx')->join(array(['j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT'],['j_journal','j_article.journal_id = j_journal.journal_id','LEFT']))->where('j_article.journal_id',14)->where('j_journal_stage.is_publish',1)->where('j_article.state',0)->order('j_article.article_id desc')->limit(1)->select();
|
||||
$list_fyw = $this->article_obj->field('j_article.*,j_journal_stage.*,j_journal.title journal_title,j_journal.jabbr journal_short,j_journal.usx usx')->join(array(['j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT'],['j_journal','j_article.journal_id = j_journal.journal_id','LEFT']))->where('j_article.journal_id',20)->where('j_journal_stage.is_publish',1)->where('j_article.state',0)->order('j_article.article_id desc')->limit(1)->select();
|
||||
$list_ywlh = $this->article_obj->field('j_article.*,j_journal_stage.*,j_journal.title journal_title,j_journal.jabbr journal_short,j_journal.usx usx')->join(array(['j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT'],['j_journal','j_article.journal_id = j_journal.journal_id','LEFT']))->where('j_article.journal_id',8)->where('j_journal_stage.is_publish',1)->where('j_article.state',0)->order('j_article.article_id desc')->limit(1)->select();
|
||||
$list_zy = $this->article_obj->field('j_article.*,j_journal_stage.*,j_journal.title journal_title,j_journal.jabbr journal_short,j_journal.usx usx')->join(array(['j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT'],['j_journal','j_article.journal_id = j_journal.journal_id','LEFT']))->where('j_article.journal_id',16)->where('j_journal_stage.is_publish',1)->where('j_article.state',0)->order('j_article.article_id desc')->limit(1)->select();
|
||||
$list_tmr = $this->article_obj->field('j_article.*,j_journal_stage.*,j_journal.title journal_title,j_journal.jabbr journal_short,j_journal.usx usx')->join(array(['j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT'],['j_journal','j_article.journal_id = j_journal.journal_id','LEFT']))->where('j_article.journal_id',1)->where('j_journal_stage.is_publish',1)->where('j_article.state',0)->order('j_article.article_id desc')->limit(1)->select();
|
||||
$list_zh = $this->article_obj->field('j_article.*,j_journal_stage.*,j_journal.title journal_title,j_journal.jabbr journal_short,j_journal.usx usx')->join(array(['j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT'],['j_journal','j_article.journal_id = j_journal.journal_id','LEFT']))->where('j_article.journal_id',15)->where('j_journal_stage.is_publish',1)->where('j_article.state',0)->order('j_article.article_id desc')->limit(1)->select();
|
||||
$list_life = $this->article_obj->field('j_article.*,j_journal_stage.*,j_journal.title journal_title,j_journal.jabbr journal_short,j_journal.usx usx')->join(array(['j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT'],['j_journal','j_article.journal_id = j_journal.journal_id','LEFT']))->where('j_article.journal_id',8)->where('j_journal_stage.is_publish',1)->where('j_article.state',0)->order('j_article.article_id desc')->limit(1)->select();
|
||||
$list_fyw = $this->article_obj->field('j_article.*,j_journal_stage.*,j_journal.title journal_title,j_journal.jabbr journal_short,j_journal.usx usx')->join(array(['j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT'],['j_journal','j_article.journal_id = j_journal.journal_id','LEFT']))->where('j_article.journal_id',9)->where('j_journal_stage.is_publish',1)->where('j_article.state',0)->order('j_article.article_id desc')->limit(1)->select();
|
||||
$list_ywlh = $this->article_obj->field('j_article.*,j_journal_stage.*,j_journal.title journal_title,j_journal.jabbr journal_short,j_journal.usx usx')->join(array(['j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT'],['j_journal','j_article.journal_id = j_journal.journal_id','LEFT']))->where('j_article.journal_id',11)->where('j_journal_stage.is_publish',1)->where('j_article.state',0)->order('j_article.article_id desc')->limit(1)->select();
|
||||
$list_zy = $this->article_obj->field('j_article.*,j_journal_stage.*,j_journal.title journal_title,j_journal.jabbr journal_short,j_journal.usx usx')->join(array(['j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT'],['j_journal','j_article.journal_id = j_journal.journal_id','LEFT']))->where('j_article.journal_id',17)->where('j_journal_stage.is_publish',1)->where('j_article.state',0)->order('j_article.article_id desc')->limit(1)->select();
|
||||
$list = $list_tmr;
|
||||
$list[] = $list_zh[0];
|
||||
$list[] = $list_life[0];
|
||||
@@ -170,7 +170,7 @@ class Main extends Controller {
|
||||
$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>' . $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);
|
||||
$list[$k] = array_merge($list[$k],$stage_info);
|
||||
@@ -215,7 +215,7 @@ class Main extends Controller {
|
||||
->join(array(['j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT'],['j_journal','j_article.journal_id = j_journal.journal_id','LEFT']))
|
||||
->where('j_article.state',0)
|
||||
->where('j_journal_stage.is_publish',0)
|
||||
->where('j_article.journal_id','in','1,10,6,14,11,15,17,20,21,22')
|
||||
->where('j_article.journal_id','in','1,4,7,8,10,6,14,11,15,17,20,21,22')
|
||||
->order('j_article.article_id desc')
|
||||
->limit($limit_start,$data['pageSize'])
|
||||
->select();
|
||||
@@ -223,7 +223,7 @@ class Main extends Controller {
|
||||
->join(array(['j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT'],['j_journal','j_article.journal_id = j_journal.journal_id','LEFT']))
|
||||
->where('j_article.state',0)
|
||||
->where('j_journal_stage.is_publish',0)
|
||||
->where('j_article.journal_id','in','1,10,6,14,11,15,17,20,21,22')
|
||||
->where('j_article.journal_id','in','1,4,7,8,10,6,14,11,15,17,20,21,22')
|
||||
->count();
|
||||
foreach ($list as $k => $v) {
|
||||
$list[$k]['authortitle'] = $this->getAuthor($v);
|
||||
@@ -266,7 +266,7 @@ class Main extends Controller {
|
||||
$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>' . $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);
|
||||
}
|
||||
@@ -324,13 +324,16 @@ class Main extends Controller {
|
||||
->where('j_article.state', 0)
|
||||
->where('j_journal_stage.is_publish',1)
|
||||
->count();
|
||||
if($count>50){
|
||||
$count=50;
|
||||
}
|
||||
//获取作者
|
||||
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>' . $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);
|
||||
}
|
||||
@@ -357,7 +360,7 @@ class Main extends Controller {
|
||||
// $push_url = 'http://www.journal.com/api/Main/getImgFile';
|
||||
|
||||
//定义需要查询同化的数组
|
||||
$list = ['articleCite','articlePDF','articleicon','articleSUB','articleSUB2','journalCfp','journalfooter','journalicon','journalline','rotation','journaltopic','system','articleCDF'];
|
||||
$list = ['articleCite','articlePDF','articleicon','articleSUB','articleSUB2','baseTopic','journalCfp','journalfooter','journalicon','journalline','rotation','journaltopic','system','articleCDF'];
|
||||
|
||||
foreach ($list as $v){
|
||||
$dir = $root_url."public/".$v."/".date('Ymd');
|
||||
@@ -554,6 +557,37 @@ class Main extends Controller {
|
||||
echo "<script>location.href='$frag'</script>";
|
||||
}
|
||||
|
||||
public function manman($type){
|
||||
$frag = '';
|
||||
switch($type){
|
||||
case 2474:
|
||||
$frag = 'https://www.tmrjournals.cn/article.html?J_num=17&a_id=1020';
|
||||
break;
|
||||
case 2486:
|
||||
$frag = 'https://www.tmrjournals.cn/article.html?J_num=17&a_id=1021';
|
||||
break;
|
||||
case 2535:
|
||||
$frag = 'https://www.tmrjournals.cn/article.html?J_num=17&a_id=1022';
|
||||
break;
|
||||
case 2598:
|
||||
$frag = 'https://www.tmrjournals.cn/article.html?J_num=17&a_id=1023';
|
||||
break;
|
||||
case 2635:
|
||||
$frag = 'https://www.tmrjournals.cn/article.html?J_num=17&a_id=1024';
|
||||
break;
|
||||
case 2656:
|
||||
$frag = 'https://www.tmrjournals.cn/article.html?J_num=17&a_id=1025';
|
||||
break;
|
||||
case 2722:
|
||||
$frag = 'https://www.tmrjournals.cn/article.html?J_num=17&a_id=1026';
|
||||
break;
|
||||
case 2744:
|
||||
$frag = 'https://www.tmrjournals.cn/article.html?J_num=17&a_id=1027';
|
||||
break;
|
||||
}
|
||||
echo "<script>location.href='$frag'</script>";
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取ip地址对应详细地址
|
||||
* @description 获取ip地址对应详细地址
|
||||
|
||||
@@ -277,7 +277,7 @@ class Special 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'];
|
||||
$list[$k]['cite'] = $cite;
|
||||
$list[$k]['authortitle'] = $this->getAuthor($v);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace app\api\job;
|
||||
|
||||
use think\Db;
|
||||
use think\queue\Job;
|
||||
|
||||
class mail {
|
||||
@@ -11,18 +12,23 @@ class mail {
|
||||
public function fire(Job $job, $data) {
|
||||
$res = $this->send($data);
|
||||
$job->delete();
|
||||
if($res){
|
||||
$job->delete();
|
||||
}else{
|
||||
if($job->attempts()>3){
|
||||
// 第1种处理方式:重新发布任务,该任务延迟10秒后再执行
|
||||
//$job->release(10);
|
||||
// 第2种处理方式:原任务的基础上1分钟执行一次并增加尝试次数
|
||||
//$job->failed();
|
||||
// 第3种处理方式:删除任务
|
||||
$job->delete();
|
||||
}
|
||||
// if($res){
|
||||
// $job->delete();
|
||||
// }else{
|
||||
// if($job->attempts()>3){
|
||||
// // 第1种处理方式:重新发布任务,该任务延迟10秒后再执行
|
||||
// //$job->release(10);
|
||||
// // 第2种处理方式:原任务的基础上1分钟执行一次并增加尝试次数
|
||||
// //$job->failed();
|
||||
// // 第3种处理方式:删除任务
|
||||
// $job->delete();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
public function propa(Job $job, $data){
|
||||
$res = $this->push($data);
|
||||
$job->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -38,4 +44,15 @@ class mail {
|
||||
}
|
||||
}
|
||||
|
||||
public function push($data){
|
||||
|
||||
$res = aliemail($data['email'], $data['title'], $data['content']);
|
||||
if($res){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -39,6 +39,25 @@ function object_to_array($obj) {
|
||||
return $obj;
|
||||
}
|
||||
|
||||
function choiseJabbr($article_id,$jabbr){
|
||||
if($article_id<1799&&$jabbr=="Cancer Adv"){
|
||||
return "TMR Cancer";
|
||||
}
|
||||
if($article_id<910&&$jabbr=="Microenviron Microecol Res"){
|
||||
return "Tumor Microenviron Res";
|
||||
}
|
||||
if($article_id<1799&&$jabbr=="Med Theor Hypothesis"){
|
||||
return "TMR Theory Hypoth";
|
||||
}
|
||||
if($article_id<1821&&$jabbr=="Clin Res Commun"){
|
||||
return "TMR Clin Res";
|
||||
}
|
||||
if($article_id<1700&&$jabbr=="Aging Commun"){
|
||||
return "TMR Aging";
|
||||
}
|
||||
return $jabbr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @function sendEmail
|
||||
* @intro 发送邮件(带附件)
|
||||
@@ -111,6 +130,94 @@ function sendEmail($email = '', $title = '', $from_name = '', $content = '', $me
|
||||
return ['status' => $status, 'data' => $data]; //返回值(可选)
|
||||
}
|
||||
|
||||
function sendEmail1($email = '', $title = '', $from_name = '', $content = '', $memail = '', $mpassword = '', $attachmentFile = '') {
|
||||
date_default_timezone_set('PRC');
|
||||
//Create a new PHPMailer instance
|
||||
$mail = new PHPMailer;
|
||||
//Tell PHPMailer to use SMTP
|
||||
$mail->isSMTP();
|
||||
//Enable SMTP debugging
|
||||
// 0 = off (for production use)
|
||||
// 1 = client messages
|
||||
// 2 = client and server messages
|
||||
$mail->SMTPDebug = 0;
|
||||
//Ask for HTML-friendly debug output
|
||||
$mail->Debugoutput = 'html';
|
||||
//charset
|
||||
$mail->CharSet = 'UTF-8';
|
||||
//Set the hostname of the mail server
|
||||
$mail->Host = "smtp.yeah.net"; //请填写你的邮箱服务器
|
||||
// $mail->Host = "smtp.126.com";
|
||||
//Set the SMTP port number - likely to be 25, 465 or 587
|
||||
$mail->Port = 25; //端口号
|
||||
//Whether to use SMTP authentication
|
||||
$mail->SMTPAuth = true;
|
||||
//Username to use for SMTP authentication
|
||||
$mail->Username = $memail == '' ? "tmrweb@tmrjournals.com" : $memail; //发件邮箱用户名
|
||||
//Password to use for SMTP authentication
|
||||
$mail->Password = 'OBRTWMJCTWRKRMRP';//$mpassword == '' ? "Wu999999tmrwe" : $mpassword; //发件邮箱密码
|
||||
//Set who the message is to be sent from
|
||||
$mail->setFrom($memail == '' ? "tmrweb@tmrjournals.com" : $memail, $from_name);
|
||||
//Set an alternative reply-to address(用户直接回复邮件的地址)
|
||||
$mail->addReplyTo($memail == '' ? "tmrweb@tmrjournals.com" : $memail, $from_name);
|
||||
//Set who the message is to be sent to
|
||||
$mail->addAddress($email);
|
||||
//Set the subject line
|
||||
$mail->Subject = $title;
|
||||
//Read an HTML message body from an external file, convert referenced images to embedded,
|
||||
//convert HTML into a basic plain-text alternative body
|
||||
$mail->msgHTML($content);
|
||||
//Replace the plain text body with one created manually
|
||||
$mail->AltBody = '';
|
||||
if (is_array($attachmentFile)) {
|
||||
for ($i = 0; $i < count($attachmentFile); $i++) {
|
||||
$mail->addAttachment($attachmentFile[$i], 'thanks.pdf' . $i); //这里可以是多维数组,然后循环附件的文件和名称
|
||||
}
|
||||
} else {
|
||||
if ($attachmentFile != '') {
|
||||
//Attach an image file
|
||||
$mail->addAttachment($attachmentFile, 'thanks.pdf');
|
||||
}
|
||||
}
|
||||
//send the message, check for errors
|
||||
if (!$mail->send()) {
|
||||
$status = 0;
|
||||
$data = "邮件发送失败" . $mail->ErrorInfo;
|
||||
} else {
|
||||
$status = 1;
|
||||
$data = "邮件发送成功";
|
||||
}
|
||||
return ['status' => $status, 'data' => $data]; //返回值(可选)
|
||||
}
|
||||
|
||||
function aliemail($email,$title,$content){
|
||||
file_put_contents('/usr/a.txt', $email,FILE_APPEND);
|
||||
vendor('aliemail.email');
|
||||
$mailto=$email;
|
||||
$mailsubject=$title;
|
||||
$mailbody=$content;
|
||||
$smtpserver = "smtpdm-ap-southeast-1.aliyun.com";
|
||||
$smtpserverport = 80;
|
||||
$smtpusermail = "propa@hellotmr.top";
|
||||
// 发件人的账号,填写控制台配置的发信地址,比如xxx@xxx.com
|
||||
$smtpuser = "propa@hellotmr.top";
|
||||
// 访问SMTP服务时需要提供的密码(在控制台选择发信地址进行设置)
|
||||
$smtppass = "Wu751019Pnx";
|
||||
$mailsubject = "=?UTF-8?B?" . base64_encode($mailsubject) . "?=";
|
||||
$mailtype = "HTML";
|
||||
//可选,设置回信地址
|
||||
$smtpreplyto = "13662001490@126.com";
|
||||
$smtp = new \smtp($smtpserver, $smtpserverport, true, $smtpuser, $smtppass);
|
||||
$smtp->debug = false;
|
||||
$cc ="";
|
||||
$bcc = "";
|
||||
$additional_headers = "";
|
||||
//设置发件人名称,名称用户可以自定义填写。
|
||||
$sender = $title;
|
||||
$res = $smtp->sendmail($mailto,$smtpusermail, $mailsubject, $mailbody, $mailtype, $cc, $bcc, $additional_headers, $sender, $smtpreplyto);
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成文章sn号
|
||||
* @return type
|
||||
|
||||
@@ -15,6 +15,7 @@ return [
|
||||
'app\master\controller\Article',
|
||||
'app\master\controller\Special',
|
||||
'app\master\controller\Datebase',
|
||||
'app\master\controller\Propa',
|
||||
'app\api\controller\Journal',
|
||||
'app\api\controller\Article',
|
||||
'app\api\controller\Special',
|
||||
|
||||
@@ -29,6 +29,8 @@ class Article extends Controller {
|
||||
protected $country_obj = '';
|
||||
protected $subscribe_journal_obj = '';
|
||||
protected $subscribe_topic_obj = '';
|
||||
protected $base_topic_obj = '';
|
||||
protected $subscribe_base_topic_obj = '';
|
||||
|
||||
public function __construct(\think\Request $request = null) {
|
||||
parent::__construct($request);
|
||||
@@ -47,6 +49,8 @@ class Article extends Controller {
|
||||
$this->country_obj = Db::name('country');
|
||||
$this->subscribe_journal_obj = Db::name('subscribe_journal');
|
||||
$this->subscribe_topic_obj = Db::name('subscribe_topic');
|
||||
$this->base_topic_obj = Db::name('base_topic');
|
||||
$this->subscribe_base_topic_obj = Db::name('subscribe_base_topic');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -377,9 +381,7 @@ class Article extends Controller {
|
||||
* @articleInfo sort:权重
|
||||
* @articleInfo pub_date:发表日期
|
||||
*
|
||||
*
|
||||
* @return files:文件列表#
|
||||
*
|
||||
*/
|
||||
public function getArticleBase() {
|
||||
$data = $this->request->post();
|
||||
@@ -650,6 +652,7 @@ class Article extends Controller {
|
||||
$insert['topic_id'] = $data['topic_id'];
|
||||
$res = $this->article_to_topic_obj->insert($insert);
|
||||
$this->msg_subscript_topic($data['topic_id'], $data['article_id']);
|
||||
$this->msg_subscribe_base_topic($data['topic_id'], $data['article_id']);
|
||||
if ($res) {
|
||||
return json(['code' => 0, 'msg' => 'success']);
|
||||
} else {
|
||||
@@ -657,6 +660,40 @@ class Article extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function msg_subscribe_base_topic($topic_id,$article_id){
|
||||
$article_info = $this->article_obj->where('article_id',$article_id)->find();
|
||||
$topic_info = $this->journal_topic_obj->where('journal_topic_id',$topic_id)->find();
|
||||
$base_topic_info = $this->base_topic_obj->where('title',$topic_info['title'])->find();
|
||||
$journal_info = $this->journal_obj->where('journal_id',$article_info['journal_id'])->find();
|
||||
if($base_topic_info==null){
|
||||
return ;
|
||||
}
|
||||
$list = $this->subscribe_base_topic_obj->where('base_topic_id',$base_topic_info['base_topic_id'])->where('state',0)->select();
|
||||
|
||||
$title = 'These new articles included in TMRDE database are available online.';
|
||||
$tt = 'Dear Researcher,<br>';
|
||||
$tt .= 'It is our great honor to present you the articles included in TMRDE.The following new articles have just been included.<br>';
|
||||
$tt .= '<a href="https://www.tmrjournals.com/article.html?J_num='.$article_info['journal_id'].'&a_id='.$article_id.'">'.$article_info['title'].'</a><br>';
|
||||
foreach ($list as $v){
|
||||
$tt1='';
|
||||
$tt1 .= $tt;
|
||||
$tt1 .= '<a href="http://journalapi.tmrjournals.com/public/index.php/api/Journal/UnsubscribeBaseTopic/snum/' . $v['subscribe_base_topic_id'] . '">Unsubscribe</a><br><br>';
|
||||
$tt1 .= 'Email:'.$journal_info['email'].'<br>';
|
||||
$tt1 .= 'Website:'.$journal_info['website'].'<br><br>';
|
||||
$tt1 .= 'TMR Publishing Group Ltd.<br>';
|
||||
$tt1 .= '11 Cockle Bay Rd, Cockle Bay, Auckland, New Zealand<br>';
|
||||
$tt1 .= 'Tel: +64 02108293806.';
|
||||
$maidata['email'] = $v['email'];
|
||||
$maidata['title'] = $title;
|
||||
$maidata['content'] = $tt1;
|
||||
$maidata['tmail'] = 'publicrelations@tmrjournals.com';
|
||||
$maidata['tpassword'] = 'pRWU999999';
|
||||
Queue::push('app\api\job\mail@fire', $maidata, "mail");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function msg_subscript_topic($topic_id, $article_id) {
|
||||
$article_info = $this->article_obj->where('article_id', $article_id)->find();
|
||||
$stage_info = $this->journal_stage_obj->where('journal_stage_id', $article_info['journal_stage_id'])->find();
|
||||
@@ -704,7 +741,7 @@ class Article extends Controller {
|
||||
$maidata['title'] = $journal_info['title'];
|
||||
$maidata['content'] = $cache;
|
||||
$maidata['tmail'] = 'publicrelations@tmrjournals.com';
|
||||
$maidata['tpassword'] = '999999Wu';
|
||||
$maidata['tpassword'] = 'pRWU999999';
|
||||
Queue::push('app\api\job\mail@fire', $maidata, "mail");
|
||||
}
|
||||
}
|
||||
@@ -740,22 +777,22 @@ class Article extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function mycc() {
|
||||
$list = $this->article_author_obj->where('article_author_id', '>', 5126)->select();
|
||||
foreach ($list as $v) {
|
||||
$ca = explode(' ', $v['author_name']);
|
||||
$caf = '';
|
||||
$cal = '';
|
||||
if (isset($ca[0])) {
|
||||
$caf = str_replace('-', '', $ca[0]);
|
||||
}
|
||||
if (isset($ca[1])) {
|
||||
$cal = $ca[1];
|
||||
}
|
||||
$this->article_author_obj->where('article_author_id', $v['article_author_id'])->update(['first_name' => $caf, 'last_name' => $cal]);
|
||||
}
|
||||
echo 'over';
|
||||
}
|
||||
// public function mycc() {
|
||||
// $list = $this->article_author_obj->where('article_author_id', '>', 5126)->select();
|
||||
// foreach ($list as $v) {
|
||||
// $ca = explode(' ', $v['author_name']);
|
||||
// $caf = '';
|
||||
// $cal = '';
|
||||
// if (isset($ca[0])) {
|
||||
// $caf = str_replace('-', '', $ca[0]);
|
||||
// }
|
||||
// if (isset($ca[1])) {
|
||||
// $cal = $ca[1];
|
||||
// }
|
||||
// $this->article_author_obj->where('article_author_id', $v['article_author_id'])->update(['first_name' => $caf, 'last_name' => $cal]);
|
||||
// }
|
||||
// echo 'over';
|
||||
// }
|
||||
|
||||
/**
|
||||
* @title 图片上传
|
||||
@@ -849,6 +886,29 @@ class Article extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title imgCome文件上传
|
||||
* @description imgCome文件上传
|
||||
* @author wangjinlei
|
||||
* @url /master/Article/up_imgCome_file
|
||||
* @method POST
|
||||
*
|
||||
* @param name:name type:string require:1 default:imgCome desc:文件域名称
|
||||
*
|
||||
* @return upurl:图片地址
|
||||
*/
|
||||
public function up_imgCome_file(){
|
||||
$file = request()->file('imgCome');
|
||||
if ($file) {
|
||||
$info = $file->move(ROOT_PATH . 'public' . DS . 'imgCome');
|
||||
if ($info) {
|
||||
return json(['code' => 0, 'msg' => 'success', 'upurl' => str_replace("\\", "/", $info->getSaveName())]);
|
||||
} else {
|
||||
return json(['code' => 1, 'msg' => $file->getError()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 文章文件上传
|
||||
* @description 文章文件上传
|
||||
@@ -1177,8 +1237,8 @@ http://www.crossref.org/schemas/crossref4.3.7.xsd">' . PHP_EOL . PHP_EOL;
|
||||
$xml .= '<body>' . PHP_EOL;
|
||||
$xml .= '<journal>' . PHP_EOL;
|
||||
$xml .= '<journal_metadata language="en">' . PHP_EOL;
|
||||
$xml .= '<full_title>' . $journal_info['title'] . '</full_title>' . PHP_EOL;
|
||||
$xml .= '<abbrev_title>' . $journal_info['jabbr'] . '</abbrev_title>' . PHP_EOL;
|
||||
$xml .= '<full_title>' . str_replace("&", "and", $journal_info['title']) . '</full_title>' . PHP_EOL;
|
||||
$xml .= '<abbrev_title>' . str_replace('&', 'and', $journal_info['jabbr']) . '</abbrev_title>' . PHP_EOL;
|
||||
$xml .= '<issn media_type="print">' . $journal_info['issn'] . '</issn>' . PHP_EOL;
|
||||
$xml .= '<coden>' . $journal_info['usx'] . '</coden>' . PHP_EOL;
|
||||
$xml .= '</journal_metadata>' . PHP_EOL;
|
||||
@@ -1193,7 +1253,7 @@ http://www.crossref.org/schemas/crossref4.3.7.xsd">' . PHP_EOL . PHP_EOL;
|
||||
$xml .= '</journal_issue>' . PHP_EOL;
|
||||
$xml .= '<journal_article publication_type="full_text">' . PHP_EOL;
|
||||
$xml .= '<titles>' . PHP_EOL;
|
||||
$xml .= '<title>' . $article_info['title'] . '</title>' . PHP_EOL;
|
||||
$xml .= '<title>' . str_replace("&", "and", $article_info['title']) . '</title>' . PHP_EOL;
|
||||
$xml .= '</titles>' . PHP_EOL;
|
||||
$xml .= '<contributors>' . PHP_EOL;
|
||||
$authors = $this->article_author_obj->where('article_id', $data['article_id'])->where('state', 0)->select();
|
||||
@@ -1347,8 +1407,8 @@ http://www.crossref.org/schemas/crossref4.3.7.xsd">' . PHP_EOL . PHP_EOL;
|
||||
*/
|
||||
public function agentDOI() {
|
||||
$data = $this->request->post();
|
||||
$data['doi'] = '10.12032/TMR20210301222';
|
||||
$data['article_id'] = 1333;
|
||||
// $data['doi'] = '10.12032/TMR20210301222';
|
||||
// $data['article_id'] = 1333;
|
||||
|
||||
|
||||
$xml = '';
|
||||
|
||||
@@ -31,6 +31,8 @@ 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);
|
||||
@@ -52,6 +54,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');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -171,6 +175,9 @@ class Journal extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @title 修改期刊详情
|
||||
* @description 修改期刊详情
|
||||
@@ -449,6 +456,7 @@ class Journal extends Controller {
|
||||
* @param name:title type:string require:1 desc:标题
|
||||
* @param name:icon type:string require:1 desc:缩略图
|
||||
* @param name:intro type:string require:1 desc:介绍
|
||||
* @param name:come type:string require:1 desc:图片证书
|
||||
* @param name:position type:string require:1 desc:摆放位置
|
||||
* @param name:is_final type:int require:1 desc:是否终结点(0no1yes)
|
||||
* @param name:sort type:int require:1 default:0 desc:权重
|
||||
@@ -467,6 +475,7 @@ class Journal extends Controller {
|
||||
$insert['title'] = $data['title'];
|
||||
$insert['icon'] = $data['icon'];
|
||||
$insert['intro'] = $data['intro'];
|
||||
$insert['come'] = isset($data['come'])?$data['come']:'';
|
||||
if($data['parent_id']==0){
|
||||
$insert['position'] = $data['position'];
|
||||
}
|
||||
@@ -492,6 +501,7 @@ class Journal extends Controller {
|
||||
* @param name:title type:string require:1 desc:标题
|
||||
* @param name:icon type:string require:1 desc:缩略图
|
||||
* @param name:intro type:string require:1 desc:介绍
|
||||
* @param name:come type:string require:1 desc:图片证书
|
||||
* @param name:position type:string require:1 desc:摆放位置
|
||||
* @param name:is_final type:int require:1 desc:是否终结点(0no1yes)
|
||||
* @param name:sort type:int require:1 default:0 desc:权重
|
||||
@@ -502,15 +512,12 @@ class Journal extends Controller {
|
||||
$update['title'] = $data['title'];
|
||||
$update['icon'] = $data['icon'];
|
||||
$update['intro'] = $data['intro'];
|
||||
$update['come'] = $data['come'];
|
||||
$update['position'] = isset($data['position'])?$data['position']:'';
|
||||
$update['is_final'] = $data['is_final'];
|
||||
$update['sort'] = $data['sort'];
|
||||
$res = $this->journal_topic_obj->update($update);
|
||||
if($res){
|
||||
return json(['code'=>0,'msg'=>'success']);
|
||||
}else{
|
||||
return json(['code'=>1,'msg'=>'system error']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -653,6 +660,7 @@ class Journal extends Controller {
|
||||
$insert['topic_id'] = $data['topic_id'];
|
||||
$res = $this->article_to_topic_obj->insert($insert);
|
||||
$this->msg_subscript_topic($data['topic_id'], $data['article_id']);
|
||||
$this->msg_subscribe_base_topic($data['topic_id'], $data['article_id']);
|
||||
if($res){
|
||||
return json(['code'=>0,'msg'=>'success']);
|
||||
}else{
|
||||
@@ -660,6 +668,45 @@ class Journal extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function mmm(){
|
||||
$this->msg_subscribe_base_topic(14, 5);
|
||||
}
|
||||
|
||||
|
||||
private function msg_subscribe_base_topic($topic_id,$article_id){
|
||||
$article_info = $this->article_obj->where('article_id',$article_id)->find();
|
||||
$topic_info = $this->journal_topic_obj->where('journal_topic_id',$topic_id)->find();
|
||||
$base_topic_info = $this->base_topic_obj->where('title',$topic_info['title'])->find();
|
||||
$journal_info = $this->journal_obj->where('journal_id',$article_info['journal_id'])->find();
|
||||
if($base_topic_info==null){
|
||||
return ;
|
||||
}
|
||||
$list = $this->subscribe_base_topic_obj->where('base_topic_id',$base_topic_info['base_topic_id'])->where('state',0)->select();
|
||||
|
||||
$title = 'These new articles included in TMRDE database are available online.';
|
||||
$tt = 'Dear Researcher,<br>';
|
||||
$tt .= 'It is our great honor to present you the articles included in TMRDE.The following new articles have just been included.<br>';
|
||||
$tt .= '<a href="https://www.tmrjournals.com/article.html?J_num='.$article_info['journal_id'].'&a_id='.$article_id.'">'.$article_info['title'].'</a><br>';
|
||||
foreach ($list as $v){
|
||||
$tt1='';
|
||||
$tt1 .= $tt;
|
||||
$tt1 .= '<a href="http://journalapi.tmrjournals.com/public/index.php/api/Journal/UnsubscribeBaseTopic/snum/' . $v['subscribe_base_topic_id'] . '">Unsubscribe</a><br><br>';
|
||||
$tt1 .= 'Email:'.$journal_info['email'].'<br>';
|
||||
$tt1 .= 'Website:'.$journal_info['website'].'<br><br>';
|
||||
$tt1 .= 'TMR Publishing Group Ltd.<br>';
|
||||
$tt1 .= '11 Cockle Bay Rd, Cockle Bay, Auckland, New Zealand<br>';
|
||||
$tt1 .= 'Tel: +64 02108293806.';
|
||||
$maidata['email'] = $v['email'];
|
||||
$maidata['title'] = $title;
|
||||
$maidata['content'] = $tt1;
|
||||
$maidata['tmail'] = 'publicrelations@tmrjournals.com';
|
||||
$maidata['tpassword'] = 'pRWU999999';
|
||||
Queue::push('app\api\job\mail@fire', $maidata, "mail");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function msg_subscript_topic($topic_id,$article_id){
|
||||
$article_info = $this->article_obj->where('article_id',$article_id)->find();
|
||||
$stage_info = $this->journal_stage_obj->where('journal_stage_id', $article_info['journal_stage_id'])->find();
|
||||
@@ -707,7 +754,7 @@ class Journal extends Controller {
|
||||
$maidata['title'] = $journal_info['title'];
|
||||
$maidata['content'] = $cache;
|
||||
$maidata['tmail'] = 'publicrelations@tmrjournals.com';
|
||||
$maidata['tpassword'] = '999999Wu';
|
||||
$maidata['tpassword'] = 'pRWU999999';
|
||||
Queue::push('app\api\job\mail@fire', $maidata, "mail");
|
||||
}
|
||||
}
|
||||
@@ -1040,7 +1087,6 @@ class Journal extends Controller {
|
||||
$stage_info = $this->journal_stage_obj->where('journal_stage_id', $journal_stage_id)->find();
|
||||
$journal_info = $this->journal_obj->where('journal_id',$journal_id)->find();
|
||||
$list = $this->subscribe_journal_obj->where('journal_id',$journal_id)->where('state',0)->select();
|
||||
|
||||
//组成文章信息
|
||||
$tt1 = '<div style="background-color: #ededed;margin: 0;">
|
||||
<div class="con_content" style="font-family: Arial;
|
||||
@@ -1072,7 +1118,6 @@ class Journal extends Controller {
|
||||
$tt2 .= 'Tel: +64 02108293806.';
|
||||
$tt2 .= '</div>
|
||||
</div>';
|
||||
|
||||
foreach ($list as $v){
|
||||
$cache = $tt1.'<a href="http://journalapi.tmrjournals.com/public/index.php/api/Journal/UnsubscribeJournal/snum/'.$v['subscribe_journal_id'].'">Unsubscribe</a><br><br>'.$tt2;
|
||||
$maidata['email'] = $v['email'];
|
||||
@@ -1130,7 +1175,6 @@ class Journal extends Controller {
|
||||
* @method POST
|
||||
*
|
||||
* @param name:journal_notices_id type:int require:1 desc:期刊id
|
||||
*
|
||||
*/
|
||||
public function delNotices(){
|
||||
$data = $this->request->post();
|
||||
@@ -1149,7 +1193,6 @@ class Journal extends Controller {
|
||||
* @param name:title type:string require:1 desc:消息标题
|
||||
* @param name:content type:string require:1 desc:内容
|
||||
* @param name:ctime type:string require:1 desc:时间
|
||||
*
|
||||
*/
|
||||
public function changeNotices(){
|
||||
$data = $this->request->post();
|
||||
@@ -1347,6 +1390,134 @@ class Journal extends Controller {
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取期刊缩略图
|
||||
* @description 获取期刊缩略图
|
||||
* @author wangjinlei
|
||||
* @url /master/Journal/getJournalIcon
|
||||
* @method POST
|
||||
*
|
||||
* @param name:issn type:int require:1 desc:issn号
|
||||
*
|
||||
* @return icon:图片地址#
|
||||
*/
|
||||
public function getJournalIcon(){
|
||||
$data = $this->request->post();
|
||||
$journal_info = $this->journal_obj->where('issn',$data['issn'])->find();
|
||||
|
||||
$re['icon'] = $journal_info['licon'];
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 通用话题--获取通用话题列表
|
||||
* @description 通用话题--获取通用话题列表
|
||||
* @author wangjinlei
|
||||
* @url /master/Journal/getBaseTopicList
|
||||
* @method POST
|
||||
*
|
||||
* @return topics:通用话题#
|
||||
*/
|
||||
public function getBaseTopicList(){
|
||||
$father = $this->base_topic_obj->where('parent_id',0)->where('state',0)->order('sort desc')->select();
|
||||
foreach ($father as $k => $v){
|
||||
$cache = $this->base_topic_obj->where('parent_id',$v['base_topic_id'])->where('state',0)->order('sort desc')->select();
|
||||
$father[$k]['children'] = $cache;
|
||||
}
|
||||
$re['topics'] = $father;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 通用话题--增加通用话题
|
||||
* @description 通用话题--增加通用话题
|
||||
* @author wangjinlei
|
||||
* @url /master/Journal/addBaseTopic
|
||||
* @method POST
|
||||
*
|
||||
* @param name:title type:string require:1 desc:话题名称标题
|
||||
* @param name:parent_id type:int require:1 desc:父级话题id
|
||||
* @param name:sort type:int require:1 desc:权重值
|
||||
* @param name:icon type:string require:1 desc:图标
|
||||
*
|
||||
*/
|
||||
public function addBaseTopic(){
|
||||
$data = $this->request->post();
|
||||
$check = $this->base_topic_obj->where('title',$data['title'])->where('state',0)->find();
|
||||
if($check != null){
|
||||
return jsonError('此话题已存在,话题名不能重复!!');
|
||||
}
|
||||
|
||||
$insert['title'] = trim($data['title']);
|
||||
$insert['parent_id'] = $data['parent_id'];
|
||||
$insert['sort'] = $data['sort'];
|
||||
$insert['icon'] = $data['icon'];
|
||||
|
||||
$this->base_topic_obj->insert($insert);
|
||||
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 通用话题--编辑通用话题
|
||||
* @description 通用话题--编辑通用话题
|
||||
* @author wangjinlei
|
||||
* @url /master/Journal/editBaseTopic
|
||||
* @method POST
|
||||
*
|
||||
* @param name:base_topic_id type:int require:1 desc:通用话题id
|
||||
* @param name:title type:string require:1 desc:话题名称标题
|
||||
* @param name:sort type:int require:1 desc:权重值
|
||||
*/
|
||||
public function editBaseTopic(){
|
||||
$data = $this->request->post();
|
||||
$update['title'] = trim($data['title']);
|
||||
$update['sort'] = $data['sort'];
|
||||
if(isset($data['icon'])){
|
||||
$update['icon'] = $data['icon'];
|
||||
}
|
||||
$this->base_topic_obj->where('base_topic_id',$data['base_topic_id'])->update($update);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 通用话题--删除通用话题
|
||||
* @description 通用话题--删除通用话题
|
||||
* @author wangjinlei
|
||||
* @url /master/Journal/delBaseTopic
|
||||
* @method POST
|
||||
*
|
||||
* @param name:base_topic_id type:int require:1 desc:通用话题id
|
||||
*/
|
||||
public function delBaseTopic(){
|
||||
$data = $this->request->post();
|
||||
$this->base_topic_obj->where('base_topic_id',$data['base_topic_id'])->update(['state'=>1]);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 通用话题--图片上传
|
||||
* @description 通用话题--图片上传
|
||||
* @author wangjinlei
|
||||
* @url /master/Journal/baseTopic_up_file
|
||||
* @method POST
|
||||
*
|
||||
* @param name:name type:string require:1 default:baseTopic desc:文件域名称
|
||||
*
|
||||
* @return upurl:图片地址
|
||||
*/
|
||||
public function baseTopic_up_file() {
|
||||
$file = request()->file('baseTopic');
|
||||
if ($file) {
|
||||
$info = $file->move(ROOT_PATH . 'public' . DS . 'baseTopic');
|
||||
if ($info) {
|
||||
return json(['code'=>0 , 'msg'=>'success', 'upurl' => str_replace("\\", "/", $info->getSaveName())]);
|
||||
} else {
|
||||
return json(['code' => 1, 'msg' => $file->getError()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 增加期刊paper文章
|
||||
* @description 增加期刊paper文章
|
||||
@@ -1406,6 +1577,7 @@ class Journal extends Controller {
|
||||
$data = $this->request->post();
|
||||
$update['title'] = $data['title'];
|
||||
$update['content'] = $data['content'];
|
||||
$update['sort']=$data['sort'];
|
||||
$this->journal_paper_art_obj->where('journal_paper_art_id',$data['journal_paper_art_id'])->update($update);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
@@ -395,12 +395,14 @@ class Mysystem extends Controller {
|
||||
*
|
||||
* @param name:title type:string require:1 desc:消息标题
|
||||
* @param name:content type:string require:1 desc:内容
|
||||
* @param name:icon type:string require:1 desc:图标
|
||||
* @param name:ctime type:string require:1 desc:时间
|
||||
*/
|
||||
public function addNotices(){
|
||||
$data = $this->request->post();
|
||||
$insert['title'] = $data['title'];
|
||||
$insert['content'] = $data['content'];
|
||||
$insert['icon'] = $data['icon'];
|
||||
$insert['ctime'] = $data['ctime']==''?time():strtotime($data['ctime']);
|
||||
$this->sys_not_obj->insert($insert);
|
||||
return jsonSuccess([]);
|
||||
@@ -430,11 +432,13 @@ class Mysystem extends Controller {
|
||||
*
|
||||
* @param name:system_notices_id type:int require:1 desc:消息标题
|
||||
* @param name:title type:string require:1 desc:消息标题
|
||||
* @param name:icon type:string require:1 desc:图标
|
||||
* @param name:content type:string require:1 desc:内容
|
||||
*/
|
||||
public function editNotices(){
|
||||
$data = $this->request->post();
|
||||
$update['title'] = $data['title'];
|
||||
$update['icon'] = $data['icon'];
|
||||
$update['content'] = $data['content'];
|
||||
$this->sys_not_obj->where('system_notices_id',$data['system_notices_id'])->update($update);
|
||||
return jsonSuccess([]);
|
||||
|
||||
502
application/master/controller/Propa.php
Normal file
502
application/master/controller/Propa.php
Normal file
@@ -0,0 +1,502 @@
|
||||
<?php
|
||||
|
||||
namespace app\master\controller;
|
||||
|
||||
use think\Controller;
|
||||
use think\Db;
|
||||
use think\Queue;
|
||||
use PHPMailer\PHPMailer\PHPMailer;
|
||||
|
||||
/**
|
||||
* @title 推广邮件功能
|
||||
* @description 推广邮件功能
|
||||
*/
|
||||
class Propa extends Controller {
|
||||
|
||||
//put your code here
|
||||
protected $admin_obj = '';
|
||||
protected $journal_obj = '';
|
||||
protected $article_obj = '';
|
||||
protected $article_author_obj = '';
|
||||
protected $journal_topic_obj = '';
|
||||
protected $journal_stage_obj = '';
|
||||
protected $journal_notices_obj = '';
|
||||
protected $journal_abs_obj = '';
|
||||
protected $journal_special_obj = '';
|
||||
protected $journal_special_editor_obj = '';
|
||||
protected $journal_special_to_editor_obj = '';
|
||||
protected $journal_special_alert_obj = '';
|
||||
protected $article_to_topic_obj = '';
|
||||
protected $sys_scient_obj = '';
|
||||
protected $sys_book_obj = '';
|
||||
protected $propa_email_model_obj = '';
|
||||
protected $propa_email_obj = '';
|
||||
protected $propa_email_type_obj = '';
|
||||
protected $propa_email_log_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->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_special_obj = Db::name('journal_special');
|
||||
$this->journal_special_editor_obj = Db::name('journal_special_editor');
|
||||
$this->journal_special_to_editor_obj = Db::name('journal_special_to_editor');
|
||||
$this->journal_special_alert_obj = Db::name('journal_special_alert');
|
||||
$this->article_to_topic_obj = Db::name('article_to_topic');
|
||||
$this->sys_scient_obj = Db::name('system_scient');
|
||||
$this->sys_book_obj = Db::name('system_books');
|
||||
$this->propa_email_model_obj = Db::name('propa_email_model');
|
||||
$this->propa_email_obj = Db::name('propa_email');
|
||||
$this->propa_email_type_obj = Db::name('propa_email_type');
|
||||
$this->propa_email_log_obj = Db::name('propa_email_log');
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取编辑名下期刊列表
|
||||
* @description 获取编辑名下期刊列表
|
||||
* @author wangjinlei
|
||||
* @url /master/Propa/getEditorJournals
|
||||
* @method POST
|
||||
*
|
||||
* @param name:editor_id type:int require:1 desc:编辑id
|
||||
*
|
||||
* @return journals:期刊列表#
|
||||
*/
|
||||
public function getEditorJournals(){
|
||||
$data = $this->request->post();
|
||||
$journals = $this->journal_obj->where('editor_id',$data['editor_id'])->where('state',0)->select();
|
||||
|
||||
$re['journals'] = $journals;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取期刊详情
|
||||
* @description 获取期刊详情
|
||||
* @author wangjinlei
|
||||
* @url /master/Propa/getJournalDetail
|
||||
* @method POST
|
||||
*
|
||||
* @param name:journal_id type:int require:1 desc:期刊id
|
||||
*
|
||||
* @return journal:期刊信息#
|
||||
*/
|
||||
public function getJournalDetail(){
|
||||
$data = $this->request->post();
|
||||
$info = $this->journal_obj->where('journal_id',$data['journal_id'])->where('state',0)->find();
|
||||
$re['journal'] = $info;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @title 添加推广邮箱(单个邮箱)
|
||||
* @description 添加推广邮箱(单个邮箱)
|
||||
* @author wangjinlei
|
||||
* @url /master/Propa/addPropaEmail
|
||||
* @method POST
|
||||
*
|
||||
* @param name:journal_id type:int require:1 desc:期刊id
|
||||
* @param name:pet_id type:int require:1 desc:分类id
|
||||
* @param name:email type:string require:1 desc:邮箱地址
|
||||
*
|
||||
*/
|
||||
public function addPropaEmail(){
|
||||
$data = $this->request->post();
|
||||
$count = $this->propa_email_obj->where('journal_id',$data['journal_id'])->where('pet_id',$data['pet_id'])->where('state',0)->count();
|
||||
if($count>=200){
|
||||
return jsonError("超过最大上限数量,最大上限200");
|
||||
}
|
||||
$check = $this->propa_email_obj
|
||||
->where('email',trim($data['email']))
|
||||
->where('pet_id',$data['pet_id'])
|
||||
->where('journal_id',$data['journal_id'])
|
||||
->where('state',0)
|
||||
->find();
|
||||
if($check!=null){
|
||||
return jsonError('has add');
|
||||
}
|
||||
$insert['journal_id'] = $data['journal_id'];
|
||||
$insert['pet_id'] = $data['pet_id'];
|
||||
$insert['email'] = trim($data['email']);
|
||||
$this->propa_email_obj->insert($insert);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 添加推广邮箱(txt)
|
||||
* @description 添加推广邮箱(txt)
|
||||
* @author wangjinlei
|
||||
* @url /master/Propa/addPropaEmailByTxt
|
||||
* @method POST
|
||||
*
|
||||
* @param name:fileDir type:string require:1 desc:上传文件的返回地址
|
||||
* @param name:journal_id type:int require:1 desc:期刊id
|
||||
* @param name:pet_id type:int require:1 desc:分类id
|
||||
*
|
||||
*/
|
||||
public function addPropaEmailByTxt(){
|
||||
$data = $this->request->post();
|
||||
// $data['journal_id'] = 1;
|
||||
// $data['fileDir'] = '20210915/9754ea4775f85a167140d0e33610b4e5.txt';
|
||||
|
||||
$txt = ROOT_PATH.'public'.DS.'txtfile'.DS.$data['fileDir'];
|
||||
$handle = fopen($txt, "r");//读取二进制文件时,需要将第二个参数设置成'rb'
|
||||
//通过filesize获得文件大小,将整个文件一下子读到一个字符串中
|
||||
$contents = fread($handle, filesize ($txt));
|
||||
fclose($handle);
|
||||
$emails = $this->extract_emails_from($contents);
|
||||
$count = $this->propa_email_obj->where('journal_id',$data['journal_id'])->where('pet_id',$data['pet_id'])->where('state',0)->count();
|
||||
if(($count+count($emails))>=200){
|
||||
return jsonError('超过最大上限数量,最大上限为200');
|
||||
}
|
||||
foreach ($emails as $v){
|
||||
$cache_check = $this->propa_email_obj->where('email',$v)->where('pet_id',$data['pet_id'])->where('state',0)->find();
|
||||
if($cache_check!=null){
|
||||
continue;
|
||||
}
|
||||
$cache_insert['journal_id'] = $data['journal_id'];
|
||||
$cache_insert['pet_id'] = $data['pet_id'];
|
||||
$cache_insert['email'] = $v;
|
||||
$this->propa_email_obj->insert($cache_insert);
|
||||
}
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 删除推广邮箱
|
||||
* @description 删除推广邮箱
|
||||
* @author wangjinlei
|
||||
* @url /master/Propa/delPropaEmail
|
||||
* @method POST
|
||||
*
|
||||
* @param name:propa_email_id type:int require:1 desc:推广邮箱id
|
||||
*
|
||||
*/
|
||||
public function delPropaEmail(){
|
||||
$data = $this->request->post();
|
||||
$this->propa_email_obj->where('propa_email_id',$data['propa_email_id'])->update(['state'=>1]);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取推广邮箱列表(分页)
|
||||
* @description 获取推广邮箱列表(分页)
|
||||
* @author wangjinlei
|
||||
* @url /master/Propa/getPropaEmails
|
||||
* @method POST
|
||||
*
|
||||
* @param name:journal_id type:int require:1 desc:期刊id
|
||||
* @param name:pet_id type:int require:1 desc:分类id
|
||||
* @param name:pageIndex type:int require:1 desc:当前页码数
|
||||
* @param name:pageSize type:int require:1 desc:单页数据条数
|
||||
*
|
||||
* @return emails:邮箱列表#
|
||||
* @return count:总数
|
||||
*/
|
||||
public function getPropaEmails(){
|
||||
$data = $this->request->post();
|
||||
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
|
||||
$list = $this->propa_email_obj
|
||||
->where('journal_id',$data['journal_id'])
|
||||
->where('pet_id',$data['pet_id'])
|
||||
->where('state',0)
|
||||
->limit($limit_start,$data['pageSize'])
|
||||
->select();
|
||||
$count = $this->propa_email_obj->where('journal_id',$data['journal_id'])->where('pet_id',$data['pet_id'])->where('state',0)->count();
|
||||
|
||||
$re['emails'] = $list;
|
||||
$re['count'] = $count;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取推广邮箱当天已发送数量
|
||||
* @description 获取推广邮箱当天已发送数量
|
||||
* @author wangjinlei
|
||||
* @url /master/Propa/getPropaEmailLog
|
||||
* @method POST
|
||||
*
|
||||
* @param name:journal_id type:int require:1 desc:期刊id
|
||||
*
|
||||
* @return count:总数
|
||||
*/
|
||||
public function getPropaEmailLog(){
|
||||
$data = $this->request->post();
|
||||
$log = $this->propa_email_log_obj->where('journal_id',$data['journal_id'])->where('date', date('Ymd'))->find();
|
||||
|
||||
$re['count'] = $log['num'];
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取推广邮箱分类
|
||||
* @description 获取推广邮箱分类
|
||||
* @author wangjinlei
|
||||
* @url /master/Propa/getPropaType
|
||||
* @method POST
|
||||
*
|
||||
* @param name:journal_id type:int require:1 desc:期刊id
|
||||
*
|
||||
* @return types:分类列表#
|
||||
*/
|
||||
public function getPropaType(){
|
||||
$data = $this->request->post();
|
||||
$types = $this->propa_email_type_obj->where('journal_id',$data['journal_id'])->where('state',0)->select();
|
||||
if($types==null){//当一个分类没有时新建一个默认分类
|
||||
$insert['journal_id'] = $data['journal_id'];
|
||||
$insert['title'] = 'default';
|
||||
$this->propa_email_type_obj->insert($insert);
|
||||
$types = $this->propa_email_type_obj->where('journal_id',$data['journal_id'])->where('state',0)->select();
|
||||
}
|
||||
|
||||
$re['types'] = $types;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 添加邮件模板
|
||||
* @description 添加邮件模板
|
||||
* @author wangjinlei
|
||||
* @url /master/Propa/addPropaEmailModel
|
||||
* @method POST
|
||||
*
|
||||
* @param name:journal_id type:int require:1 desc:期刊id
|
||||
* @param name:title type:string require:1 desc:标题
|
||||
* @param name:content type:string require:1 desc:内容
|
||||
*/
|
||||
public function addPropaEmailModel(){
|
||||
$data = $this->request->post();
|
||||
$insert['journal_id'] = $data['journal_id'];
|
||||
$insert['title'] = trim($data['title']);
|
||||
$insert['content'] = $data['content'];
|
||||
$this->propa_email_model_obj->insert($insert);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 添加推广邮件类型
|
||||
* @description 添加推广邮件类型
|
||||
* @author wangjinlei
|
||||
* @url /master/Propa/addPropaEmailType
|
||||
* @method POST
|
||||
*
|
||||
* @param name:journal_id type:int require:1 desc:期刊id
|
||||
* @param name:title_content type:string require:1 desc:分类名称
|
||||
*/
|
||||
public function addPropaEmailType(){
|
||||
$data = $this->request->post();
|
||||
$insert['journal_id'] = $data['journal_id'];
|
||||
$insert['title'] = trim($data['title_content']);
|
||||
$this->propa_email_type_obj->insert($insert);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 删除邮件模板
|
||||
* @description 删除邮件模板
|
||||
* @author wangjinlei
|
||||
* @url /master/Propa/delPropaEmailModel
|
||||
* @method POST
|
||||
*
|
||||
* @param name:pem_id type:int require:1 desc:邮件模板id
|
||||
*/
|
||||
public function delPropaEmailModel(){
|
||||
$data = $this->request->post();
|
||||
$this->propa_email_model_obj->where('pem_id',$data['pem_id'])->update(['state'=>1]);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 编辑邮件模板
|
||||
* @description 编辑邮件模板
|
||||
* @author wangjinlei
|
||||
* @url /master/Propa/editPropaEmailModel
|
||||
* @method POST
|
||||
*
|
||||
* @param name:pem_id type:int require:1 desc:邮件模板id
|
||||
* @param name:title type:string require:1 desc:标题
|
||||
* @param name:content type:string require:1 desc:内容
|
||||
*/
|
||||
public function editPropaEmailModel(){
|
||||
$data = $this->request->post();
|
||||
$update['title'] = trim($data['title']);
|
||||
$update['content'] = $data['content'];
|
||||
$this->propa_email_model_obj->where('pem_id',$data['pem_id'])->update($update);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取邮件模板列表
|
||||
* @description 获取邮件模板列表
|
||||
* @author wangjinlei
|
||||
* @url /master/Propa/getPropaEmailModel
|
||||
* @method POST
|
||||
*
|
||||
* @param name:journal_id type:int require:1 desc:期刊id
|
||||
*
|
||||
* @return models:模板列表#
|
||||
*/
|
||||
public function getPropaEmailModel(){
|
||||
$data = $this->request->post();
|
||||
$models = $this->propa_email_model_obj->where('journal_id',$data['journal_id'])->where('state',0)->select();
|
||||
$re['models'] = $models;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取单个邮件模板
|
||||
* @description 获取单个邮件模板
|
||||
* @author wangjinlei
|
||||
* @url /master/Propa/getOneEmailModel
|
||||
* @method POST
|
||||
*
|
||||
* @param name:pem_id type:int require:1 desc:邮件模板id
|
||||
*
|
||||
* @return models:模板信息#
|
||||
*/
|
||||
public function getOneEmailModel(){
|
||||
$data = $this->request->post();
|
||||
$model = $this->propa_email_model_obj->where('pem_id',$data['pem_id'])->find();
|
||||
$re['model'] = $model;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 发送邮件
|
||||
* @description 发送邮件
|
||||
* @author wangjinlei
|
||||
* @url /master/Propa/sendEmail
|
||||
* @method POST
|
||||
*
|
||||
* @param name:content type:string require:1 desc:内容
|
||||
* @param name:pet_id type:int require:1 desc:分类id
|
||||
* @param name:journal_id type:int require:1 desc:期刊id
|
||||
*/
|
||||
public function sendEmail(){
|
||||
$data = $this->request->post();
|
||||
$journal_info = $this->journal_obj->where('journal_id',$data['journal_id'])->find();
|
||||
$emails = $this->propa_email_obj->where('journal_id',$data['journal_id'])->where('pet_id',$data['pet_id'])->where('state',0)->select();
|
||||
$time = date('Ymd');
|
||||
$log = $this->propa_email_log_obj->where('journal_id',$data['journal_id'])->where('date',$time)->find();
|
||||
$num = 0;
|
||||
if($log==null){
|
||||
$in['journal_id'] = $data['journal_id'];
|
||||
$in['date'] = $time;
|
||||
$this->propa_email_log_obj->insert($in);
|
||||
}else{
|
||||
$num = $log['num'];
|
||||
}
|
||||
|
||||
foreach ($emails as $k => $v){
|
||||
if($num>=200){
|
||||
continue;
|
||||
}
|
||||
$maidata['email'] = $v['email'];
|
||||
$maidata['title'] = $journal_info['title'];
|
||||
$maidata['content'] = $data['content'];
|
||||
Queue::push('app\api\job\mail@propa', $maidata, "mail");
|
||||
$num++;
|
||||
}
|
||||
$this->propa_email_log_obj->where('journal_id',$data['journal_id'])->where('date',$time)->update(['num'=>$num]);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
private function aliemail(){
|
||||
vendor('aliemail.email');
|
||||
$mailto='751475802@qq.com';
|
||||
$mailsubject="测试邮件";
|
||||
$mailbody='这里是邮件内容';
|
||||
$smtpserver = "smtpdm-ap-southeast-1.aliyun.com";
|
||||
$smtpserverport = 80;
|
||||
$smtpusermail = "propa@hellotmr.top";
|
||||
// 发件人的账号,填写控制台配置的发信地址,比如xxx@xxx.com
|
||||
$smtpuser = "propa@hellotmr.top";
|
||||
// 访问SMTP服务时需要提供的密码(在控制台选择发信地址进行设置)
|
||||
$smtppass = "Wu751019Pnx";
|
||||
$mailsubject = "=?UTF-8?B?" . base64_encode($mailsubject) . "?=";
|
||||
$mailtype = "HTML";
|
||||
//可选,设置回信地址
|
||||
$smtpreplyto = "13662001490@126.com";
|
||||
$smtp = new \smtp($smtpserver, $smtpserverport, true, $smtpuser, $smtppass);
|
||||
$smtp->debug = false;
|
||||
$cc ="";
|
||||
$bcc = "";
|
||||
$additional_headers = "";
|
||||
//设置发件人名称,名称用户可以自定义填写。
|
||||
$sender = "wangjinlei test";
|
||||
$res = $smtp->sendmail($mailto,$smtpusermail, $mailsubject, $mailbody, $mailtype, $cc, $bcc, $additional_headers, $sender, $smtpreplyto);
|
||||
|
||||
echo '<pre>';
|
||||
var_dump($res);
|
||||
echo '</pre>';
|
||||
die;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @title txt文件上传
|
||||
* @description txt文件上传
|
||||
* @author wangjinlei
|
||||
* @url /master/Propa/up_file
|
||||
* @method POST
|
||||
*
|
||||
* @param name:name type:string require:1 default:txtfile desc:文件域名称
|
||||
*
|
||||
* @return upurl:图片地址
|
||||
*/
|
||||
public function up_file(){
|
||||
$file = request()->file('txtfile');
|
||||
if ($file) {
|
||||
$info = $file->move(ROOT_PATH . 'public' . DS . 'txtfile');
|
||||
if ($info) {
|
||||
return json(['code' => 0, 'msg' => 'success', 'upurl' => str_replace("\\", "/", $info->getSaveName())]);
|
||||
} else {
|
||||
return json(['code' => 1, 'msg' => $file->getError()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取txt文件包含邮箱地址
|
||||
* @description 获取txt文件包含邮箱地址
|
||||
* @author wangjinlei
|
||||
* @url /master/Propa/readTxt
|
||||
* @method POST
|
||||
*
|
||||
* @param name:txtdir type:string require:1 desc:txt文件上传后返回地址
|
||||
*
|
||||
* @return emails:邮箱列表#
|
||||
*/
|
||||
public function readTxt(){
|
||||
$data = $this->request->post();
|
||||
$txt = ROOT_PATH.'public'.DS.'txtfile'.DS.$data['txtdir'];
|
||||
$handle = fopen($txt, "r");//读取二进制文件时,需要将第二个参数设置成'rb'
|
||||
//通过filesize获得文件大小,将整个文件一下子读到一个字符串中
|
||||
$contents = fread($handle, filesize ($txt));
|
||||
fclose($handle);
|
||||
$emails = $this->extract_emails_from($contents);
|
||||
$re['emails'] = $emails;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
private function extract_emails_from($string) {
|
||||
preg_match_all("/[\._a-zA-Z0-9-]+(@|#)[\._a-zA-Z0-9-]+/i", $string, $matches);
|
||||
$emails = $matches[0];
|
||||
//去掉邮件最后的.
|
||||
foreach ($emails as $k => $email){
|
||||
if(substr($email,strlen($email)-1,1)=='.'){
|
||||
$emails[$k] = substr($email,0, strlen($email)-1);
|
||||
}
|
||||
}
|
||||
return $emails;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace app\super\controller;
|
||||
|
||||
use think\Controller;
|
||||
@@ -9,7 +10,7 @@ use think\Db;
|
||||
* @description 总监Main接口
|
||||
* @group 总监Main接口
|
||||
*/
|
||||
class Publish extends Controller{
|
||||
class Publish extends Controller {
|
||||
|
||||
// const JURL = 'http://www.tougao.com/api/Article/getArticleForJournal';
|
||||
const JURL = 'http://api.tmrjournals.com/public/index.php/api/Article/getArticleForJournal';
|
||||
@@ -75,32 +76,32 @@ class Publish extends Controller{
|
||||
*
|
||||
* @return journals:期刊信息array#
|
||||
*/
|
||||
public function getMain(){
|
||||
$journals = $this->journal_obj->where('journal_id','<>',17)->where('state',0)->select();
|
||||
foreach ($journals as $k => $v){
|
||||
public function getMain() {
|
||||
$journals = $this->journal_obj->where('journal_id', '<>', 17)->where('state', 0)->select();
|
||||
foreach ($journals as $k => $v) {
|
||||
$journals[$k]['mark'] = $this->calMark($v['journal_id']);
|
||||
$last_stage = $this->journal_stage_obj
|
||||
->where('journal_id',$v['journal_id'])
|
||||
->where('is_publish',1)
|
||||
->where('state',0)
|
||||
->where('journal_id', $v['journal_id'])
|
||||
->where('is_publish', 1)
|
||||
->where('state', 0)
|
||||
->order('journal_stage_id desc')
|
||||
->limit(1)
|
||||
->select();
|
||||
$stage_now = $last_stage?$last_stage[0]:['issue_date'=>'2020-05-15'];
|
||||
$stage_now = $last_stage ? $last_stage[0] : ['issue_date' => '2020-05-15'];
|
||||
$ctime = strtotime($stage_now['issue_date']);
|
||||
$cs = [];
|
||||
$cs['issn'] = $v['issn'];
|
||||
$cs['ctime'] = $ctime;
|
||||
$journals[$k]['last_time'] = $ctime;
|
||||
$cache_arts = $this->object_to_array(json_decode(myPost(self::JURL,$cs)));
|
||||
$count = is_array($cache_arts['data']['articles'])?count($cache_arts['data']['articles']):0;
|
||||
$cache_arts = $this->object_to_array(json_decode(myPost(self::JURL, $cs)));
|
||||
$count = is_array($cache_arts['data']['articles']) ? count($cache_arts['data']['articles']) : 0;
|
||||
$journals[$k]['artCount'] = $count;
|
||||
}
|
||||
|
||||
//按照危险值排序
|
||||
for($i=0;$i<count($journals);$i++){
|
||||
for($j=$i+1;$j<count($journals);$j++){
|
||||
if($journals[$i]['mark']['mk']<$journals[$j]['mark']['mk']){
|
||||
for ($i = 0; $i < count($journals); $i++) {
|
||||
for ($j = $i + 1; $j < count($journals); $j++) {
|
||||
if ($journals[$i]['mark']['mk'] < $journals[$j]['mark']['mk']) {
|
||||
$cac = $journals[$i];
|
||||
$journals[$i] = $journals[$j];
|
||||
$journals[$j] = $cac;
|
||||
@@ -112,12 +113,93 @@ class Publish extends Controller{
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取单个期刊的统计数据
|
||||
* @description 获取单个期刊的统计数据
|
||||
* @author wangjinlei
|
||||
* @url /super/Publish/getAllDateForJournal
|
||||
* @method POST
|
||||
*
|
||||
* @param name:issn type:string require:1 desc:期刊issn号
|
||||
* @param name:start type:string require:1 desc:开始时间
|
||||
* @param name:end type:string require:1 desc:结束时间
|
||||
*
|
||||
*/
|
||||
public function getAllDateForJournal() {
|
||||
$data = $this->request->post();
|
||||
|
||||
// $data['issn'] = '2703-4631';
|
||||
// $data['start'] = '2021-01-01';
|
||||
// $data['end'] = '2021-09-08';
|
||||
|
||||
$info = $this->journal_obj->where('issn', $data['issn'])->find();
|
||||
|
||||
//出刊时间
|
||||
$info['CK'] = [];
|
||||
$info['CK']['mark'] = $this->calMark($info['journal_id']);
|
||||
$last_stage = $this->journal_stage_obj
|
||||
->where('journal_id', $info['journal_id'])
|
||||
->where('is_publish', 1)
|
||||
->where('state', 0)
|
||||
->order('journal_stage_id desc')
|
||||
->limit(1)
|
||||
->select();
|
||||
$stage_now = $last_stage ? $last_stage[0] : ['issue_date' => '2020-05-15'];
|
||||
$ctime = strtotime($stage_now['issue_date']);
|
||||
$cs = [];
|
||||
$cs['issn'] = $data['issn'];
|
||||
$cs['ctime'] = $ctime;
|
||||
$info['CK']['last_time'] = $ctime;
|
||||
$cache_arts = $this->object_to_array(json_decode(myPost(self::JURL, $cs)));
|
||||
$count = is_array($cache_arts['data']['articles']) ? count($cache_arts['data']['articles']) : 0;
|
||||
$info['CK']['artCount'] = $count;
|
||||
|
||||
//合规检测
|
||||
$pa['start'] = $data['start'];
|
||||
$pa['end'] = $data['end'];
|
||||
$res = $this->object_to_array(json_decode(myPost(self::TJ_URL, $pa)));
|
||||
foreach ($res as $k => $v) {
|
||||
if($v['issn'] == $data['issn']){
|
||||
$info['HG'] = $v;
|
||||
$info['HG']['SUBJOURNAL'] = $this->subscribe_journal_obj->where('journal_id', $info['journal_id'])->where('state', 0)->count();
|
||||
$topics = $this->journal_topic_obj->where('journal_id', $info['journal_id'])->where('state', 0)->column('journal_topic_id');
|
||||
$info['HG']['SUBTOPIC'] = $this->subscribe_topic_obj->where('topic_id', 'in', $topics)->where('state', 0)->count();
|
||||
}
|
||||
}
|
||||
|
||||
//质量评估
|
||||
$start = strtotime($data['start']);
|
||||
$end = strtotime($data['end'] . ' 23:59:59');
|
||||
$pag['start'] = $start;
|
||||
$pag['end'] = $end;
|
||||
$result = $this->object_to_array(json_decode(myPost(self::AL_URL, $pag)));
|
||||
$r = $result['data'];
|
||||
$tg = '';
|
||||
foreach ($r as $val) {
|
||||
if($val['issn']==$data['issn']){
|
||||
$tg = $val['SJ'];
|
||||
}
|
||||
}
|
||||
$info['ZL']['YY'] = $this->article_obj->where('journal_id', $info['journal_id'])->where('ctime', '>', $start)->where('ctime', '<=', $end)->where('state', 0)->sum('cited');
|
||||
$info['ZL']['TGL'] = $tg;
|
||||
$info['ZL']['FWL'] = $this->getFWL($info['journal_id'], $start, $end);
|
||||
$info['ZL']['LX'] = $this->getLX($info['journal_id'], $start, $end);
|
||||
$info['ZL']['GJH'] = $this->getGJH($info['journal_id'], $start, $end);
|
||||
$info['ZL']['GNW'] = $this->getGNW($info['journal_id'], $start, $end);
|
||||
$info['ZL']['CK'] = $this->getCK($info['journal_id']);
|
||||
$info['ZL']['BW'] = $this->getBW($info['journal_id']);
|
||||
$info['ZL']['DY'] = $this->subscribe_journal_obj->where('journal_id', $info['journal_id'])->where('state', 0)->count();
|
||||
|
||||
return jsonSuccess($info);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动任务存储危险值
|
||||
*/
|
||||
public function autoDanger(){
|
||||
$journals = $this->journal_obj->where('state',0)->select();
|
||||
foreach ($journals as $k => $v){
|
||||
public function autoDanger() {
|
||||
$journals = $this->journal_obj->where('state', 0)->select();
|
||||
foreach ($journals as $k => $v) {
|
||||
$cah_res = $this->calMark($v['journal_id']);
|
||||
$insert['journal_id'] = $v['journal_id'];
|
||||
$insert['date'] = date('Ymd');
|
||||
@@ -137,9 +219,9 @@ class Publish extends Controller{
|
||||
* @param name:password type:string require:1 desc:密码
|
||||
*
|
||||
*/
|
||||
public function check_login(){
|
||||
public function check_login() {
|
||||
$data = $this->request->post();
|
||||
if($data['account'] == 'supervise'&&$data['password']=='wu751019'){
|
||||
if ($data['account'] == 'supervise' && $data['password'] == 'wu751019') {
|
||||
return jsonSuccess([]);
|
||||
} else {
|
||||
return jsonError('check error!');
|
||||
@@ -165,18 +247,18 @@ class Publish extends Controller{
|
||||
* @dates WS:外审
|
||||
* @dates SJ:时间
|
||||
*/
|
||||
public function getTjJournal(){
|
||||
public function getTjJournal() {
|
||||
$data = $this->request->post();
|
||||
$pa['start'] = $data['start'];
|
||||
$pa['end'] = $data['end'];
|
||||
$res = $this->object_to_array(json_decode(myPost(self::TJ_URL,$pa)));
|
||||
foreach ($res as $k =>$v){
|
||||
$cache_info = $this->journal_obj->where('issn',$v['issn'])->find();
|
||||
$res[$k]['SUBJOURNAL'] = $this->subscribe_journal_obj->where('journal_id',$cache_info['journal_id'])->where('state',0)->count();
|
||||
$topics = $this->journal_topic_obj->where('journal_id',$cache_info['journal_id'])->where('state',0)->column('journal_topic_id');
|
||||
$res[$k]['SUBTOPIC'] = $this->subscribe_topic_obj->where('topic_id','in',$topics)->where('state',0)->count();
|
||||
$res = $this->object_to_array(json_decode(myPost(self::TJ_URL, $pa)));
|
||||
foreach ($res as $k => $v) {
|
||||
$cache_info = $this->journal_obj->where('issn', $v['issn'])->find();
|
||||
$res[$k]['SUBJOURNAL'] = $this->subscribe_journal_obj->where('journal_id', $cache_info['journal_id'])->where('state', 0)->count();
|
||||
$topics = $this->journal_topic_obj->where('journal_id', $cache_info['journal_id'])->where('state', 0)->column('journal_topic_id');
|
||||
$res[$k]['SUBTOPIC'] = $this->subscribe_topic_obj->where('topic_id', 'in', $topics)->where('state', 0)->count();
|
||||
}
|
||||
return jsonSuccess($res) ;
|
||||
return jsonSuccess($res);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -192,13 +274,13 @@ class Publish extends Controller{
|
||||
* @param name:end type:string require:1 desc:结束时间
|
||||
*
|
||||
*/
|
||||
public function getCCArticle(){
|
||||
public function getCCArticle() {
|
||||
$data = $this->request->post();
|
||||
$pa['issn'] = $data['issn'];
|
||||
$pa['type'] = $data['type'];
|
||||
$pa['start'] = $data['start'];
|
||||
$pa['end'] = $data['end'];
|
||||
$res = myPost(self::CCA_URL,$pa);
|
||||
$res = myPost(self::CCA_URL, $pa);
|
||||
return $res;
|
||||
}
|
||||
|
||||
@@ -221,29 +303,29 @@ class Publish extends Controller{
|
||||
* @return BW:编委
|
||||
* @return DY:订阅
|
||||
*/
|
||||
public function getQuality(){
|
||||
public function getQuality() {
|
||||
$data = $this->request->post();
|
||||
$journals = $this->journal_obj->where('state',0)->select();
|
||||
$journals = $this->journal_obj->where('state', 0)->select();
|
||||
$start = strtotime($data['start']);
|
||||
$end = strtotime($data['end'].' 23:59:59');
|
||||
$end = strtotime($data['end'] . ' 23:59:59');
|
||||
$pag['start'] = $start;
|
||||
$pag['end'] = $end;
|
||||
$res = $this->object_to_array(json_decode(myPost(self::AL_URL,$pag)));
|
||||
$res = $this->object_to_array(json_decode(myPost(self::AL_URL, $pag)));
|
||||
$r = $res['data'];
|
||||
$tg = [];
|
||||
foreach ($r as $val){
|
||||
foreach ($r as $val) {
|
||||
$tg[$val['issn']] = $val['SJ'];
|
||||
}
|
||||
foreach ($journals as $k => $v){
|
||||
$journals[$k]['YY'] = $this->article_obj->where('journal_id',$v['journal_id'])->where('ctime','>',$start)->where('ctime','<=',$end)->where('state',0)->sum('cited');
|
||||
$journals[$k]['TGL'] = isset($tg[$v['issn']])?$tg[$v['issn']]:[];
|
||||
$journals[$k]['FWL'] = $this->getFWL($v['journal_id'],$start,$end);
|
||||
$journals[$k]['LX'] = $this->getLX($v['journal_id'],$start,$end);
|
||||
$journals[$k]['GJH'] = $this->getGJH($v['journal_id'],$start,$end);
|
||||
$journals[$k]['GNW'] = $this->getGNW($v['journal_id'],$start,$end);
|
||||
foreach ($journals as $k => $v) {
|
||||
$journals[$k]['YY'] = $this->article_obj->where('journal_id', $v['journal_id'])->where('ctime', '>', $start)->where('ctime', '<=', $end)->where('state', 0)->sum('cited');
|
||||
$journals[$k]['TGL'] = isset($tg[$v['issn']]) ? $tg[$v['issn']] : [];
|
||||
$journals[$k]['FWL'] = $this->getFWL($v['journal_id'], $start, $end);
|
||||
$journals[$k]['LX'] = $this->getLX($v['journal_id'], $start, $end);
|
||||
$journals[$k]['GJH'] = $this->getGJH($v['journal_id'], $start, $end);
|
||||
$journals[$k]['GNW'] = $this->getGNW($v['journal_id'], $start, $end);
|
||||
$journals[$k]['CK'] = $this->getCK($v['journal_id']);
|
||||
$journals[$k]['BW'] = $this->getBW($v['journal_id']);
|
||||
$journals[$k]['DY'] = $this->subscribe_journal_obj->where('journal_id',$v['journal_id'])->where('state',0)->count();
|
||||
$journals[$k]['DY'] = $this->subscribe_journal_obj->where('journal_id', $v['journal_id'])->where('state', 0)->count();
|
||||
}
|
||||
return jsonSuccess($journals);
|
||||
}
|
||||
@@ -258,42 +340,41 @@ class Publish extends Controller{
|
||||
* @param name:type type:string require:1 desc:类型(1.de2.journal_id)
|
||||
* @param name:is_detail type:int require:0 desc:是否是详情(0否1是)
|
||||
*/
|
||||
public function addVisitNum(){
|
||||
public function addVisitNum() {
|
||||
$data = $this->request->post();
|
||||
// $data['type'] = 1;
|
||||
$data['is_detail'] = isset($data['is_detail'])?$data['is_detail']:0;
|
||||
$data['is_detail'] = isset($data['is_detail']) ? $data['is_detail'] : 0;
|
||||
$up_id = 0;
|
||||
if($data['type']=='de'){//数据库访问
|
||||
$res = $this->visit_log_obj->where('type','de')->where('stime',date('Ym'))->find();
|
||||
if($res==null){
|
||||
if ($data['type'] == 'de') {//数据库访问
|
||||
$res = $this->visit_log_obj->where('type', 'de')->where('stime', date('Ym'))->find();
|
||||
if ($res == null) {
|
||||
$insert['type'] = 'de';
|
||||
$insert['stime'] = date('Ym');
|
||||
$up_id = $this->visit_log_obj->insertGetId($insert);
|
||||
}else{
|
||||
} else {
|
||||
$up_id = $res['vlid'];
|
||||
}
|
||||
}else if(is_numeric($data['type']) && $data['is_detail']==1){
|
||||
$res = $this->visit_log_obj->where('type',$data['type'])->where('is_detail',1)->where('stime',date('Ym'))->find();
|
||||
if($res==null){
|
||||
$insert['type']= $data['type'];
|
||||
} else if (is_numeric($data['type']) && $data['is_detail'] == 1) {
|
||||
$res = $this->visit_log_obj->where('type', $data['type'])->where('is_detail', 1)->where('stime', date('Ym'))->find();
|
||||
if ($res == null) {
|
||||
$insert['type'] = $data['type'];
|
||||
$insert['is_detail'] = 1;
|
||||
$insert['stime'] = date('Ym');
|
||||
$up_id = $this->visit_log_obj->insertGetId($insert);
|
||||
}else{
|
||||
} else {
|
||||
$up_id = $res['vlid'];
|
||||
}
|
||||
}
|
||||
else{//期刊访问
|
||||
$res = $this->visit_log_obj->where('type',$data['type'])->where('is_detail',0)->where('stime',date('Ym'))->find();
|
||||
if($res==null){
|
||||
$insert['type']= $data['type'];
|
||||
} else {//期刊访问
|
||||
$res = $this->visit_log_obj->where('type', $data['type'])->where('is_detail', 0)->where('stime', date('Ym'))->find();
|
||||
if ($res == null) {
|
||||
$insert['type'] = $data['type'];
|
||||
$insert['stime'] = date('Ym');
|
||||
$up_id = $this->visit_log_obj->insertGetId($insert);
|
||||
}else{
|
||||
} else {
|
||||
$up_id = $res['vlid'];
|
||||
}
|
||||
}
|
||||
$this->visit_log_obj->where('vlid',$up_id)->setInc('num');
|
||||
$this->visit_log_obj->where('vlid', $up_id)->setInc('num');
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
@@ -304,147 +385,193 @@ class Publish extends Controller{
|
||||
* @url /super/Publish/getVisit
|
||||
* @method POST
|
||||
*/
|
||||
public function getVisit(){
|
||||
public function getVisit() {
|
||||
$t = strtotime("-4 month");
|
||||
$stime = date('Ym',$t);
|
||||
$visits = $this->visit_log_obj->where('stime','>=',$stime)->where('state',0)->select();
|
||||
$stime = date('Ym', $t);
|
||||
$visits = $this->visit_log_obj->where('stime', '>=', $stime)->where('state', 0)->select();
|
||||
$frag = [];
|
||||
for($i=4;$i>=0;$i--){
|
||||
for ($i = 0; $i <= 4; $i++) {
|
||||
$ntime = date('Ym', strtotime("-$i month"));
|
||||
$frag[$ntime] = [];
|
||||
foreach ($visits as $v) {
|
||||
if ($v['stime'] == $ntime) {
|
||||
if ($v['is_detail'] == 0) {
|
||||
$frag[$ntime][$v['type']] = $v['num'];
|
||||
} else {
|
||||
$frag[$ntime][$v['type'] . '_detail'] = $v['num'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$pjarr = [];
|
||||
//算最近三个月平均值
|
||||
for($i=2;$i>=0;$i--){
|
||||
$ntime = date('Ym', strtotime("-$i month"));
|
||||
foreach ($visits as $v){
|
||||
if($v['stime']==$ntime){
|
||||
if($v['is_detail']==0){
|
||||
$frag[$ntime][$v['type']]=$v['num'];
|
||||
if(isset($pjarr[$v['type']]['tou'])){
|
||||
$pjarr[$v['type']]['tou'] += $v['num'];
|
||||
}else{
|
||||
$frag[$ntime][$v['type'].'_detail'] = $v['num'];
|
||||
$pjarr[$v['type']]['tou'] = $v['num'];
|
||||
}
|
||||
}else{
|
||||
if(isset($pjarr[$v['type']]['wei'])){
|
||||
$pjarr[$v['type']]['wei'] += $v['num'];
|
||||
}else{
|
||||
$pjarr[$v['type']]['wei'] = $v['num'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$journals = $this->journal_obj->where('state',0)->select();
|
||||
}
|
||||
|
||||
$journals = $this->journal_obj->where('state', 0)->select();
|
||||
$frag1 = [];
|
||||
foreach ($frag as $k => $v){
|
||||
$frag1['de'][$k] = isset($frag[$k]['de'])?$frag[$k]['de']:0;
|
||||
foreach ($journals as $val){
|
||||
$ca_tou = isset($frag[$k][$val['journal_id']])?$frag[$k][$val['journal_id']]:0;
|
||||
$ca_wei = isset($frag[$k][$val['journal_id'].'_detail'])?$frag[$k][$val['journal_id'].'_detail']:0;
|
||||
$frag1[$val['title']][$k] = $ca_tou.'/'.$ca_wei;
|
||||
foreach ($frag as $k => $v) {
|
||||
$frag1['de'][$k] = isset($frag[$k]['de']) ? $frag[$k]['de'] : 0;
|
||||
foreach ($journals as $val) {
|
||||
$ca_tou = isset($frag[$k][$val['journal_id']]) ? $frag[$k][$val['journal_id']] : 0;
|
||||
$ca_wei = isset($frag[$k][$val['journal_id'] . '_detail']) ? $frag[$k][$val['journal_id'] . '_detail'] : 0;
|
||||
$frag1[$val['title']][$k] = $ca_tou . '/' . $ca_wei;
|
||||
}
|
||||
}
|
||||
foreach ($journals as $k => $v){
|
||||
$pjarr[$v['title']] = $pjarr[$v['journal_id']];
|
||||
}
|
||||
foreach ($frag1 as $k => $v){
|
||||
if($k=='de'){
|
||||
$num = 0;
|
||||
foreach ($v as $vv){
|
||||
$num += $vv;
|
||||
$frag1[$k]['pj_tou'] = intval($pjarr[$k]['tou']/3);
|
||||
if($k!='de'){
|
||||
$frag1[$k]['pj_wei'] = intval($pjarr[$k]['wei']/3);
|
||||
}
|
||||
$frag1[$k]['all'] = $num;
|
||||
}else{
|
||||
$tou_num = 0;
|
||||
$wei_num = 0;
|
||||
foreach ($v as $vv){
|
||||
$ca_n = explode('/', $vv);
|
||||
$tou_num += $ca_n[0];
|
||||
$wei_num += $ca_n[1];
|
||||
}
|
||||
$frag1[$k]['all'] = $tou_num.'/'.$wei_num;
|
||||
}
|
||||
|
||||
foreach ($frag1 as $k => $v) {
|
||||
// if ($k == 'de') {
|
||||
// $num = 0;
|
||||
// foreach ($v as $vv) {
|
||||
// $num += $vv;
|
||||
// }
|
||||
// $frag1[$k]['all'] = $num;
|
||||
// } else {
|
||||
// $tou_num = 0;
|
||||
// $wei_num = 0;
|
||||
// foreach ($v as $vv) {
|
||||
// $ca_n = explode('/', $vv);
|
||||
// $tou_num += $ca_n[0];
|
||||
// $wei_num += $ca_n[1];
|
||||
// }
|
||||
// $frag1[$k]['all'] = $tou_num . '/' . $wei_num;
|
||||
// }
|
||||
if($k!='de'&&$k!='经典中医研究'){
|
||||
$frag1[$k]['title'] = $k;
|
||||
}else{
|
||||
unset($frag1[$k]);
|
||||
}
|
||||
return jsonSuccess(array_values($frag1));
|
||||
}
|
||||
$f = array_values($frag1);
|
||||
for ($i=0;$i<count($f);$i++){
|
||||
for($j=$i+1;$j<count($f);$j++){
|
||||
if($f[$i]['pj_tou']<$f[$j]['pj_tou']){
|
||||
$temp = $f[$i];
|
||||
$f[$i] = $f[$j];
|
||||
$f[$j] = $temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
return jsonSuccess($f);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取创刊时间
|
||||
*/
|
||||
private function getCK($journal_id){
|
||||
$stage = $this->journal_stage_obj->where('journal_id',$journal_id)->where('state',0)->order('journal_stage_id')->limit(1)->select();
|
||||
return $stage?$stage[0]['issue_date']:'';
|
||||
private function getCK($journal_id) {
|
||||
$stage = $this->journal_stage_obj->where('journal_id', $journal_id)->where('state', 0)->order('journal_stage_id')->limit(1)->select();
|
||||
return $stage ? $stage[0]['issue_date'] : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取期刊的发文量
|
||||
*/
|
||||
private function getFWL($journal_id){
|
||||
private function getFWL($journal_id) {
|
||||
$frag = [];
|
||||
$frag['all'] = 0;
|
||||
for($i=2016;$i<= intval(date('Y'));$i++){
|
||||
for ($i = 2016; $i <= intval(date('Y')); $i++) {
|
||||
$cstages = $this->journal_stage_obj
|
||||
->where('journal_id',$journal_id)
|
||||
->where('stage_year',$i)
|
||||
->where('is_publish',1)
|
||||
->where('state',0)
|
||||
->where('journal_id', $journal_id)
|
||||
->where('stage_year', $i)
|
||||
->where('is_publish', 1)
|
||||
->where('state', 0)
|
||||
->column('journal_stage_id');
|
||||
$frag[$i] = $this->article_obj->where('journal_stage_id','in',$cstages)->where('state',0)->count();
|
||||
$frag[$i] = $this->article_obj->where('journal_stage_id', 'in', $cstages)->where('state', 0)->count();
|
||||
$frag['all'] += $frag[$i];
|
||||
}
|
||||
return $frag;
|
||||
}
|
||||
|
||||
|
||||
private function getLX($journal_id,$start,$end){
|
||||
private function getLX($journal_id, $start, $end) {
|
||||
$stages = $this->journal_stage_obj
|
||||
->where('journal_id',$journal_id)
|
||||
->where('is_publish',1)
|
||||
->where('state',0)
|
||||
->where('journal_id', $journal_id)
|
||||
->where('is_publish', 1)
|
||||
->where('state', 0)
|
||||
->column('journal_stage_id');
|
||||
$arts = $this->article_obj->where('journal_id',$journal_id)->where('ctime','>',$start)->where('ctime','<=',$end)->where('journal_stage_id','in',$stages)->where('state',0)->select();
|
||||
$arts = $this->article_obj->where('journal_id', $journal_id)->where('ctime', '>', $start)->where('ctime', '<=', $end)->where('journal_stage_id', 'in', $stages)->where('state', 0)->select();
|
||||
$frag = [];
|
||||
foreach ($arts as $v){
|
||||
if(isset($frag[$v['type']])){
|
||||
$kk = $v['type']==''?'Other':$v['type'];
|
||||
foreach ($arts as $v) {
|
||||
if (isset($frag[$v['type']])) {
|
||||
$kk = $v['type'] == '' ? 'Other' : $v['type'];
|
||||
$frag[$kk]++;
|
||||
}else{
|
||||
$kk = $v['type']==''?'Other':$v['type'];
|
||||
$frag[$kk]=1;
|
||||
} else {
|
||||
$kk = $v['type'] == '' ? 'Other' : $v['type'];
|
||||
$frag[$kk] = 1;
|
||||
}
|
||||
}
|
||||
return $frag;
|
||||
}
|
||||
|
||||
private function getGNW($journal_id,$start,$end){
|
||||
private function getGNW($journal_id, $start, $end) {
|
||||
$stages = $this->journal_stage_obj
|
||||
->where('journal_id',$journal_id)
|
||||
->where('is_publish',1)
|
||||
->where('state',0)
|
||||
->where('journal_id', $journal_id)
|
||||
->where('is_publish', 1)
|
||||
->where('state', 0)
|
||||
->column('journal_stage_id');
|
||||
$arts = $this->article_obj->where('journal_id',$journal_id)->where('journal_stage_id','in',$stages)->where('ctime','>',$start)->where('ctime','<=',$end)->where('state',0)->select();
|
||||
$arts = $this->article_obj->where('journal_id', $journal_id)->where('journal_stage_id', 'in', $stages)->where('ctime', '>', $start)->where('ctime', '<=', $end)->where('state', 0)->select();
|
||||
$frag = [];
|
||||
foreach ($arts as $k => $v){
|
||||
$ca_aus = $this->article_author_obj->where('article_id',$v['article_id'])->where('state',0)->where('author_country','<>','China')->find();
|
||||
if($ca_aus==null){
|
||||
if(isset($frag['n'])){
|
||||
foreach ($arts as $k => $v) {
|
||||
$ca_aus = $this->article_author_obj->where('article_id', $v['article_id'])->where('state', 0)->where('author_country', '<>', 'China')->find();
|
||||
if ($ca_aus == null) {
|
||||
if (isset($frag['n'])) {
|
||||
$frag['n'] += 1;
|
||||
}else{
|
||||
} else {
|
||||
$frag['n'] = 1;
|
||||
}
|
||||
} else{
|
||||
if(isset($frag['w'])){
|
||||
} else {
|
||||
if (isset($frag['w'])) {
|
||||
$frag['w'] += 1;
|
||||
}else{
|
||||
} else {
|
||||
$frag['w'] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $frag;
|
||||
|
||||
}
|
||||
|
||||
private function getGJH($journal_id,$start,$end){
|
||||
private function getGJH($journal_id, $start, $end) {
|
||||
$stages = $this->journal_stage_obj
|
||||
->where('journal_id',$journal_id)
|
||||
->where('is_publish',1)
|
||||
->where('state',0)
|
||||
->where('journal_id', $journal_id)
|
||||
->where('is_publish', 1)
|
||||
->where('state', 0)
|
||||
->column('journal_stage_id');
|
||||
$arts = $this->article_obj->where('journal_id',$journal_id)->where('journal_stage_id','in',$stages)->where('ctime','>',$start)->where('ctime','<=',$end)->where('state',0)->column('article_id');
|
||||
$auts = $this->article_author_obj->where('article_id','in',$arts)->where('state',0)->select();
|
||||
$arts = $this->article_obj->where('journal_id', $journal_id)->where('journal_stage_id', 'in', $stages)->where('ctime', '>', $start)->where('ctime', '<=', $end)->where('state', 0)->column('article_id');
|
||||
$auts = $this->article_author_obj->where('article_id', 'in', $arts)->where('state', 0)->select();
|
||||
$frag = [];
|
||||
$frag['list'] = [];
|
||||
$frag['countrys'] = 0;
|
||||
foreach($auts as $v){
|
||||
if(isset($frag['list'][$v['author_country']])){
|
||||
foreach ($auts as $v) {
|
||||
if (isset($frag['list'][$v['author_country']])) {
|
||||
$frag['list'][$v['author_country']]++;
|
||||
}else{
|
||||
} else {
|
||||
$frag['list'][$v['author_country']] = 1;
|
||||
$frag['countrys']++;
|
||||
}
|
||||
@@ -455,13 +582,13 @@ class Publish extends Controller{
|
||||
/**
|
||||
* 获取编委信息
|
||||
*/
|
||||
private function getBW($journal_id){
|
||||
$list = $this->board_obj->where('journal_id',$journal_id)->where('state',0)->select();
|
||||
private function getBW($journal_id) {
|
||||
$list = $this->board_obj->where('journal_id', $journal_id)->where('state', 0)->select();
|
||||
$frag = [];
|
||||
foreach ($list as $v){
|
||||
if(isset($frag[$v['country']])){
|
||||
foreach ($list as $v) {
|
||||
if (isset($frag[$v['country']])) {
|
||||
$frag[$v['country']]++;
|
||||
}else{
|
||||
} else {
|
||||
$frag[$v['country']] = 1;
|
||||
}
|
||||
}
|
||||
@@ -480,25 +607,25 @@ class Publish extends Controller{
|
||||
* @return dates:日期数组#
|
||||
* @return journals:期刊信息array#
|
||||
*/
|
||||
public function getDangerHistory(){
|
||||
public function getDangerHistory() {
|
||||
$dates = [];
|
||||
for ($index = 8; $index > 0; $index--) {
|
||||
$dates[] = date("Ymd",strtotime("-$index week Sunday"));
|
||||
$dates[] = date("Ymd", strtotime("-$index week Sunday"));
|
||||
}
|
||||
$re['dates'] = $dates;
|
||||
$journals = $this->journal_obj->where('state',0)->select();
|
||||
foreach ($journals as $k => $v){
|
||||
$journals = $this->journal_obj->where('state', 0)->select();
|
||||
foreach ($journals as $k => $v) {
|
||||
$fr = [];
|
||||
$cache = $this->super_danger_obj
|
||||
->where('journal_id',$v['journal_id'])
|
||||
->where('state',0)
|
||||
->where('journal_id', $v['journal_id'])
|
||||
->where('state', 0)
|
||||
->order('super_danger_id desc')
|
||||
->limit(8)
|
||||
->column('danger');
|
||||
for($in=0;$in<8-count($cache);$in++){
|
||||
for ($in = 0; $in < 8 - count($cache); $in++) {
|
||||
$fr[] = 0;
|
||||
}
|
||||
foreach ($cache as $val){
|
||||
foreach ($cache as $val) {
|
||||
$fr[] = $val;
|
||||
}
|
||||
$journals[$k]['ma'] = $fr;
|
||||
@@ -510,53 +637,70 @@ class Publish extends Controller{
|
||||
/**
|
||||
* 计算危险指数
|
||||
*/
|
||||
private function calMark($journal_id){
|
||||
$journal_info = $this->journal_obj->where('journal_id',$journal_id)->find();
|
||||
$stages = $this->journal_stage_obj->where('journal_id',$journal_id)->where('is_publish',0)->where('state',0)->column('journal_stage_id');
|
||||
$count = $this->article_obj->where('journal_stage_id','in',$stages)
|
||||
->where('state',0)
|
||||
private function calMark($journal_id) {
|
||||
$journal_info = $this->journal_obj->where('journal_id', $journal_id)->find();
|
||||
$stages = $this->journal_stage_obj->where('journal_id', $journal_id)->where('is_publish', 0)->where('state', 0)->column('journal_stage_id');
|
||||
$count = $this->article_obj->where('journal_stage_id', 'in', $stages)
|
||||
->where('state', 0)
|
||||
->count();
|
||||
$last_stage = $this->journal_stage_obj
|
||||
->where('journal_id',$journal_id)
|
||||
->where('is_publish',1)
|
||||
->where('state',0)
|
||||
->where('journal_id', $journal_id)
|
||||
->where('is_publish', 1)
|
||||
->where('state', 0)
|
||||
->order('journal_stage_id desc')
|
||||
->limit(1)
|
||||
->select();
|
||||
$stage_now = $last_stage?$last_stage[0]:['issue_date'=>'2020-05-15'];
|
||||
$cday = intval((time()-strtotime($stage_now['issue_date']))/(3600*24));//过去了多少天
|
||||
$cycle = $journal_info['cycle']==0?2:$journal_info['cycle'];//出刊期限
|
||||
$art_num = $journal_info['art_num']==0?5:$journal_info['art_num'];//期刊文章数量
|
||||
$next_time = strtotime("+$cycle month",strtotime($stage_now['issue_date']));//下次出刊时间
|
||||
$all_days = intval(($next_time-strtotime($stage_now['issue_date']))/(3600*24));//这两次出刊时间差,天数
|
||||
$stage_now = $last_stage ? $last_stage[0] : ['issue_date' => '2020-05-15'];
|
||||
$cday = intval((time() - strtotime($stage_now['issue_date'])) / (3600 * 24)); //过去了多少天
|
||||
$cycle = $journal_info['cycle'] == 0 ? 2 : $journal_info['cycle']; //出刊期限
|
||||
$art_num = $journal_info['art_num'] == 0 ? 5 : $journal_info['art_num']; //期刊文章数量
|
||||
$next_time = strtotime("+$cycle month", strtotime($stage_now['issue_date'])); //下次出刊时间
|
||||
$all_days = intval(($next_time - strtotime($stage_now['issue_date'])) / (3600 * 24)); //这两次出刊时间差,天数
|
||||
$frag = [];
|
||||
$frag['count'] = $count;
|
||||
$frag['sy'] = intval(($next_time- time())/(3600*24));//$cycle*30 - $cday;
|
||||
$frag['ntime'] = $next_time;//strtotime($stage_now['issue_date'])+($cycle*30*3600*24);
|
||||
if(time()>$next_time){
|
||||
$frag['sy'] = intval(($next_time - time()) / (3600 * 24)); //$cycle*30 - $cday;
|
||||
$frag['ntime'] = $next_time; //strtotime($stage_now['issue_date'])+($cycle*30*3600*24);
|
||||
if (time() > $next_time) {
|
||||
$frag['mk'] = 100;
|
||||
return $frag;
|
||||
}
|
||||
$lart = intval($cday*$art_num/$all_days);
|
||||
if($count>=$lart){
|
||||
$lart = intval($cday * $art_num / $all_days);
|
||||
if ($count >= $lart) {
|
||||
$frag['mk'] = 0;
|
||||
}else{
|
||||
$frag['mk'] = intval(($lart - $count)*100/$art_num);
|
||||
} else {
|
||||
$frag['mk'] = intval(($lart - $count) * 100 / $art_num);
|
||||
}
|
||||
return $frag;
|
||||
}
|
||||
|
||||
|
||||
public function object_to_array($obj){
|
||||
$_arr=is_object($obj)?get_object_vars($obj):$obj;
|
||||
public function object_to_array($obj) {
|
||||
$_arr = is_object($obj) ? get_object_vars($obj) : $obj;
|
||||
$arr = null;
|
||||
foreach($_arr as $key=>$val){
|
||||
$val=(is_array($val))||is_object($val)?$this->object_to_array($val):$val;
|
||||
$arr[$key]=$val;
|
||||
foreach ($_arr as $key => $val) {
|
||||
$val = (is_array($val)) || is_object($val) ? $this->object_to_array($val) : $val;
|
||||
$arr[$key] = $val;
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取全部期刊
|
||||
* @description 获取全部期刊
|
||||
* @author wangjinlei
|
||||
* @url /super/Publish/bossLogin
|
||||
* @method POST
|
||||
*
|
||||
* @param name:code type:int require:1 desc:链接特殊码
|
||||
*/
|
||||
public function bossLogin(){
|
||||
$data = $this->request->post();
|
||||
if($data['code']=='eff9be46e027e2094baf29a9c1195129'){
|
||||
return jsonSuccess([]);
|
||||
}else{
|
||||
return jsonError([]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取全部期刊
|
||||
* @description 获取全部期刊
|
||||
@@ -566,8 +710,8 @@ class Publish extends Controller{
|
||||
*
|
||||
* @return journals:期刊列表#
|
||||
*/
|
||||
public function getAllJournals(){
|
||||
$list = $this->journal_obj->where('state',0)->select();
|
||||
public function getAllJournals() {
|
||||
$list = $this->journal_obj->where('state', 0)->select();
|
||||
|
||||
$re['journals'] = $list;
|
||||
return jsonSuccess($re);
|
||||
@@ -583,41 +727,41 @@ class Publish extends Controller{
|
||||
* @param name:journal_id type:int require:1 desc:期刊id
|
||||
*
|
||||
*/
|
||||
public function getCiteDate(){
|
||||
public function getCiteDate() {
|
||||
$data = $this->request->post();
|
||||
// $data['journal_id'] = 1;
|
||||
$list = $this->article_cite_obj->where('journal_id',$data['journal_id'])->select();
|
||||
$list = $this->article_cite_obj->where('journal_id', $data['journal_id'])->select();
|
||||
$frag = [];
|
||||
$frag['country'] = [];
|
||||
$frag['topic'] = [];
|
||||
$frag['time'] = [];
|
||||
$frag['type'] = [];
|
||||
$frag['articles'] = [];
|
||||
foreach ($list as $v){
|
||||
$cache_article = $this->article_obj->where('article_id',$v['article_id'])->find();
|
||||
foreach ($list as $v) {
|
||||
$cache_article = $this->article_obj->where('article_id', $v['article_id'])->find();
|
||||
//判断国家
|
||||
$cou_res = $this->checkCountry($cache_article);
|
||||
if($cou_res=='n'){
|
||||
isset($frag['country']['n'])?$frag['country']['n']++:$frag['country']['n']=1;
|
||||
}else{
|
||||
isset($frag['country']['w'])?$frag['country']['w']++:$frag['country']['w']=1;
|
||||
if ($cou_res == 'n') {
|
||||
isset($frag['country']['n']) ? $frag['country']['n']++ : $frag['country']['n'] = 1;
|
||||
} else {
|
||||
isset($frag['country']['w']) ? $frag['country']['w']++ : $frag['country']['w'] = 1;
|
||||
}
|
||||
//判断领域
|
||||
$topic_res = $this->checkTopic($cache_article);
|
||||
foreach ($topic_res as $key=>$val){
|
||||
if(isset($frag['topic'][$val['title']])){
|
||||
foreach ($topic_res as $key => $val) {
|
||||
if (isset($frag['topic'][$val['title']])) {
|
||||
$frag['topic'][$val['title']] += 1;
|
||||
}else{
|
||||
} else {
|
||||
$frag['topic'][$val['title']] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
//关键词
|
||||
$gjz = explode(',', $cache_article['keywords']);
|
||||
foreach ($gjz as $key => $val){
|
||||
if(isset($frag['gjz'][$val])){
|
||||
$frag['gjz'][$val] +=1;
|
||||
}else{
|
||||
foreach ($gjz as $key => $val) {
|
||||
if (isset($frag['gjz'][$val])) {
|
||||
$frag['gjz'][$val] += 1;
|
||||
} else {
|
||||
$frag['gjz'][$val] = 1;
|
||||
}
|
||||
}
|
||||
@@ -626,100 +770,100 @@ class Publish extends Controller{
|
||||
|
||||
|
||||
//时间
|
||||
$ca_time = $this->journal_stage_obj->where('journal_stage_id',$cache_article['journal_stage_id'])->find();
|
||||
if(isset($frag['time'][$ca_time['stage_year']])){
|
||||
$ca_time = $this->journal_stage_obj->where('journal_stage_id', $cache_article['journal_stage_id'])->find();
|
||||
if (isset($frag['time'][$ca_time['stage_year']])) {
|
||||
$frag['time'][$ca_time['stage_year']] += 1;
|
||||
}else{
|
||||
} else {
|
||||
$frag['time'][$ca_time['stage_year']] = 1;
|
||||
}
|
||||
//文章类型
|
||||
if(isset($frag['type'][$cache_article['type']])){
|
||||
if (isset($frag['type'][$cache_article['type']])) {
|
||||
$frag['type'][$cache_article['type']] += 1;
|
||||
}else{
|
||||
} else {
|
||||
$frag['type'][$cache_article['type']] = 1;
|
||||
}
|
||||
//组成文章数组构建
|
||||
if(isset($frag['articles'][$cache_article['article_id']])){
|
||||
if (isset($frag['articles'][$cache_article['article_id']])) {
|
||||
$frag['articles'][$cache_article['article_id']] += 1;
|
||||
}else{
|
||||
$frag['articles'][$cache_article['article_id']] =1;
|
||||
} else {
|
||||
$frag['articles'][$cache_article['article_id']] = 1;
|
||||
}
|
||||
}
|
||||
//阅读和下载量
|
||||
$articles = $this->article_obj->field('j_article.*,(abs_num+pdf_num+html_num) num')
|
||||
->where('journal_id',$data['journal_id'])
|
||||
->where('state',0)
|
||||
->where('journal_id', $data['journal_id'])
|
||||
->where('state', 0)
|
||||
->order('num desc')->select();
|
||||
|
||||
foreach ($frag['articles'] as $k => $v){
|
||||
$art = $this->article_obj->where('article_id',$k)->find();
|
||||
foreach ($frag['articles'] as $k => $v) {
|
||||
$art = $this->article_obj->where('article_id', $k)->find();
|
||||
$cnum = $v;
|
||||
$frag['articles'][$k] = $art;
|
||||
$frag['articles'][$k]['cite_num'] = $cnum;
|
||||
//阅读和下载数
|
||||
foreach ($articles as $key => $val){
|
||||
if($val['article_id']==$k){
|
||||
$frag['articles'][$k]['read_pm'] = $key+1;//阅读量排名
|
||||
$frag['articles'][$k]['read_num'] = $val["num"];//阅读数
|
||||
foreach ($articles as $key => $val) {
|
||||
if ($val['article_id'] == $k) {
|
||||
$frag['articles'][$k]['read_pm'] = $key + 1; //阅读量排名
|
||||
$frag['articles'][$k]['read_num'] = $val["num"]; //阅读数
|
||||
}
|
||||
}
|
||||
}
|
||||
$frag['read'] = $this->sort_art($frag['articles']);
|
||||
//标题吸引力
|
||||
$bty_articles = $this->article_obj->where('journal_id',$data['journal_id'])->where('state',0)->orderRaw('LENGTH(title) desc')->limit(10)->select();
|
||||
$bty_articles = $this->article_obj->where('journal_id', $data['journal_id'])->where('state', 0)->orderRaw('LENGTH(title) desc')->limit(10)->select();
|
||||
|
||||
|
||||
foreach ($bty_articles as $k => $v){
|
||||
foreach ($frag['articles'] as $key => $val){
|
||||
if($v['article_id'] == $val['article_id']){
|
||||
foreach ($bty_articles as $k => $v) {
|
||||
foreach ($frag['articles'] as $key => $val) {
|
||||
if ($v['article_id'] == $val['article_id']) {
|
||||
$bty_articles[$k]['cite_num'] = $val['cite_num'];
|
||||
break;
|
||||
}else{
|
||||
} else {
|
||||
$bty_articles[$k]['cite_num'] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
$frag['zs_title'] = $bty_articles;//标题字数
|
||||
$frag['zs_title'] = $bty_articles; //标题字数
|
||||
$btzf_articles = $this->article_obj
|
||||
->where('journal_id',$data['journal_id'])
|
||||
->where('state',0)
|
||||
->where('title',['like','%?%'],['like','%!%'],'or')
|
||||
->where('journal_id', $data['journal_id'])
|
||||
->where('state', 0)
|
||||
->where('title', ['like', '%?%'], ['like', '%!%'], 'or')
|
||||
->select();
|
||||
foreach ($btzf_articles as $k => $v){
|
||||
foreach ($frag['articles'] as $key => $val){
|
||||
if($v['article_id'] == $val['article_id']){
|
||||
foreach ($btzf_articles as $k => $v) {
|
||||
foreach ($frag['articles'] as $key => $val) {
|
||||
if ($v['article_id'] == $val['article_id']) {
|
||||
$btzf_articles[$k]['cite_num'] = $val['cite_num'];
|
||||
break;
|
||||
}else{
|
||||
} else {
|
||||
$btzf_articles[$k]['cite_num'] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
$frag['zf_title'] = $btzf_articles;
|
||||
//摘要吸引力
|
||||
$ab_articles = $this->article_obj->where('journal_id',$data['journal_id'])->where('state',0)->orderRaw('LENGTH(abstract) desc')->limit(10)->select();
|
||||
foreach ($ab_articles as $k => $v){
|
||||
foreach ($frag['articles'] as $key => $val){
|
||||
if($v['article_id'] == $key){
|
||||
$ab_articles = $this->article_obj->where('journal_id', $data['journal_id'])->where('state', 0)->orderRaw('LENGTH(abstract) desc')->limit(10)->select();
|
||||
foreach ($ab_articles as $k => $v) {
|
||||
foreach ($frag['articles'] as $key => $val) {
|
||||
if ($v['article_id'] == $key) {
|
||||
$ab_articles[$k]['cite_num'] = $val['cite_num'];
|
||||
break;
|
||||
}else{
|
||||
} else {
|
||||
$ab_articles[$k]['cite_num'] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
$frag['zs_abstract'] = $ab_articles;//摘要字数
|
||||
$frag['zs_abstract'] = $ab_articles; //摘要字数
|
||||
$abzf_articles = $this->article_obj
|
||||
->where('journal_id',$data['journal_id'])
|
||||
->where('state',0)
|
||||
->where('abstract',['like','%?%'],['like','%!%'],'or')
|
||||
->where('journal_id', $data['journal_id'])
|
||||
->where('state', 0)
|
||||
->where('abstract', ['like', '%?%'], ['like', '%!%'], 'or')
|
||||
->select();
|
||||
foreach ($abzf_articles as $k => $v){
|
||||
foreach ($frag['articles'] as $key => $val){
|
||||
if($v['article_id'] == $key){
|
||||
foreach ($abzf_articles as $k => $v) {
|
||||
foreach ($frag['articles'] as $key => $val) {
|
||||
if ($v['article_id'] == $key) {
|
||||
$abzf_articles[$k]['cite_num'] = $val['cite_num'];
|
||||
break;
|
||||
}else{
|
||||
} else {
|
||||
$abzf_articles[$k]['cite_num'] = 0;
|
||||
}
|
||||
}
|
||||
@@ -729,38 +873,37 @@ class Publish extends Controller{
|
||||
return jsonSuccess($frag);
|
||||
}
|
||||
|
||||
private function sort_art($articles){
|
||||
private function sort_art($articles) {
|
||||
$arr = array_values($articles);
|
||||
for($i = 0;$i<count($arr);$i++){
|
||||
for($j= $i;$j<count($arr)-1;$j++){
|
||||
if($arr[$i]['read_num']<$arr[$j+1]['read_num']){
|
||||
for ($i = 0; $i < count($arr); $i++) {
|
||||
for ($j = $i; $j < count($arr) - 1; $j++) {
|
||||
if ($arr[$i]['read_num'] < $arr[$j + 1]['read_num']) {
|
||||
$data = $arr[$i];
|
||||
$arr[$i] = $arr[$j+1];
|
||||
$arr[$j+1] = $data;
|
||||
$arr[$i] = $arr[$j + 1];
|
||||
$arr[$j + 1] = $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
|
||||
|
||||
private function checkTopic($article){
|
||||
$tops = $this->article_to_topic_obj->where('article_id',$article['article_id'])->where('state',0)->select();
|
||||
private function checkTopic($article) {
|
||||
$tops = $this->article_to_topic_obj->where('article_id', $article['article_id'])->where('state', 0)->select();
|
||||
$frag = [];
|
||||
foreach ($tops as $v){
|
||||
$ca = $this->journal_topic_obj->where('journal_topic_id',$v['topic_id'])->find();
|
||||
if($ca['level']==3){
|
||||
$cac = $this->journal_topic_obj->where('journal_topic_id',$ca['parent_id'])->find();
|
||||
if(isset($frag[$cac['journal_topic_id']])){
|
||||
foreach ($tops as $v) {
|
||||
$ca = $this->journal_topic_obj->where('journal_topic_id', $v['topic_id'])->find();
|
||||
if ($ca['level'] == 3) {
|
||||
$cac = $this->journal_topic_obj->where('journal_topic_id', $ca['parent_id'])->find();
|
||||
if (isset($frag[$cac['journal_topic_id']])) {
|
||||
$frag[$cac['journal_topic_id']]['num'] += 1;
|
||||
}else{
|
||||
} else {
|
||||
$frag[$cac['journal_topic_id']] = $cac;
|
||||
$frag[$cac['journal_topic_id']]['num'] = 1;
|
||||
}
|
||||
}else{
|
||||
if(isset($frag[$ca['journal_topic_id']])){
|
||||
} else {
|
||||
if (isset($frag[$ca['journal_topic_id']])) {
|
||||
$frag[$ca['journal_topic_id']]['num'] += 1;
|
||||
}else{
|
||||
} else {
|
||||
$frag[$ca['journal_topic_id']] = $ca;
|
||||
$frag[$ca['journal_topic_id']]['num'] = 1;
|
||||
}
|
||||
@@ -769,9 +912,9 @@ class Publish extends Controller{
|
||||
return $frag;
|
||||
}
|
||||
|
||||
private function checkCountry($article){
|
||||
$res = $this->article_author_obj->where('article_id',$article['article_id'])->where('state',0)->where('author_country','<>','China')->find();
|
||||
return $res==null?'n':'w';
|
||||
private function checkCountry($article) {
|
||||
$res = $this->article_author_obj->where('article_id', $article['article_id'])->where('state', 0)->where('author_country', '<>', 'China')->find();
|
||||
return $res == null ? 'n' : 'w';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user