20201112
This commit is contained in:
@@ -160,6 +160,9 @@ class Article extends Controller {
|
||||
//组合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'];
|
||||
$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);
|
||||
}
|
||||
@@ -227,6 +230,9 @@ class Article extends Controller {
|
||||
//组合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'];
|
||||
$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);
|
||||
}
|
||||
@@ -258,6 +264,7 @@ class Article extends Controller {
|
||||
*/
|
||||
public function addArticleNum(){
|
||||
$data = $this->request->post();
|
||||
|
||||
$this->article_obj->where('article_id',$data['article_id'])->setInc($data['type'].'_num');
|
||||
$article_info = $this->article_obj->where('article_id',$data['article_id'])->find();
|
||||
|
||||
@@ -330,6 +337,9 @@ class Article extends Controller {
|
||||
//组合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'];
|
||||
$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);
|
||||
}
|
||||
|
||||
@@ -233,6 +233,9 @@ class Journal extends Controller {
|
||||
//组合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'];
|
||||
$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);
|
||||
}
|
||||
@@ -287,8 +290,9 @@ class Journal extends Controller {
|
||||
} 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'];
|
||||
}
|
||||
$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();
|
||||
|
||||
// $cite = $v['abbr'] . '. ' . $v['title'] . '. <i>' . $journal_info['jabbr'] . '</i>. ' . $stage_info['stage_year'] . ';' . $stage_info['stage_vol'] . $no . $v['npp'] . '. doi:' . $v['doi'];
|
||||
$list[$k]['topic'] = $cache_topic;
|
||||
$list[$k]['cite'] = $cite;
|
||||
$list[$k]['authortitle'] = $this->getAuthor($v);
|
||||
}
|
||||
@@ -355,6 +359,9 @@ class Journal extends Controller {
|
||||
//组合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'];
|
||||
$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);
|
||||
}
|
||||
@@ -392,6 +399,9 @@ class Journal extends Controller {
|
||||
//组合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'];
|
||||
$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);
|
||||
}
|
||||
@@ -448,6 +458,9 @@ class Journal extends Controller {
|
||||
//组合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'];
|
||||
$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);
|
||||
}
|
||||
@@ -531,6 +544,9 @@ class Journal extends Controller {
|
||||
//组合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'];
|
||||
$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);
|
||||
}
|
||||
@@ -703,7 +719,7 @@ class Journal extends Controller {
|
||||
*/
|
||||
public function getTopicForSubscribe() {
|
||||
$data = $this->request->post();
|
||||
$list = $this->journal_topic_obj->where('journal_id', $data['journal_id'])->where('state', 0)->where('level', 2)->select();
|
||||
$list = $this->journal_topic_obj->where('journal_id', $data['journal_id'])->where('state', 0)->where('is_final', 1)->select();
|
||||
|
||||
$re['topics'] = $list;
|
||||
return jsonSuccess($re);
|
||||
@@ -751,6 +767,57 @@ class Journal extends Controller {
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 添加期刊话题订阅(批量)
|
||||
* @description 添加期刊话题订阅(批量)
|
||||
* @author wangjinlei
|
||||
* @url /api/Journal/addSubscribeTopics
|
||||
* @method POST
|
||||
*
|
||||
* @param name:topic_ids type:string require:1 desc:期刊话题id(1,2,3,4)
|
||||
* @param name:email type:string require:1 desc:邮箱地址
|
||||
*/
|
||||
public function addSubscribeTopics() {
|
||||
$data = $this->request->post();
|
||||
// $topics = explode(',', $data['topic_ids']);
|
||||
$topics = $data['topic_ids'];
|
||||
$str = '';
|
||||
foreach ($topics as $k => $v) {
|
||||
//去重
|
||||
$repeat = $this->subscribe_topic_obj
|
||||
->where('topic_id', $v)
|
||||
->where('email', $data['email'])
|
||||
->where('state', 0)
|
||||
->find();
|
||||
if ($repeat) {
|
||||
continue;
|
||||
}
|
||||
$insert['topic_id'] = $v;
|
||||
$insert['email'] = $data['email'];
|
||||
$id = $this->subscribe_topic_obj->insertGetId($insert);
|
||||
$cache_info = $this->journal_topic_obj->where('journal_topic_id',$v)->find();
|
||||
$str .= '<a href="http://journalapi.tmrjournals.com/public/index.php/api/Journal/UnsubscribeTopic/snum/' . $id . '">Unsubscribe topic->'.$cache_info['title'].'</a><br>';
|
||||
}
|
||||
if($str==''){
|
||||
return jsonError('repeat subscribe!');
|
||||
}
|
||||
//发送邮件感谢
|
||||
$tt = 'Dear Researcher,<br><br>';
|
||||
$tt .= 'Welcome you to the email alert for the latest research and more. Thank you for your interest in our publications and topics.<br>';
|
||||
$tt .= $str;
|
||||
$tt .= 'This service is provided by TMR Publishing Group | New Zealand<br>';
|
||||
$tt .= 'Telephone: +64 02108293806';
|
||||
$tt .= 'Email: publisher@tmrjournals.com';
|
||||
$tt .= 'www.tmrjournals.com';
|
||||
$maidata['email'] = $data['email'];
|
||||
$maidata['title'] = 'Thank you for subscribing.';
|
||||
$maidata['content'] = $tt;
|
||||
$maidata['tmail'] = 'publicrelations@tmrjournals.com';
|
||||
$maidata['tpassword'] = 'pRWU999999';
|
||||
Queue::push('app\api\job\mail@fire', $maidata, "mail");
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 添加期刊话题订阅
|
||||
* @description 添加期刊话题订阅
|
||||
@@ -863,6 +930,9 @@ class Journal extends Controller {
|
||||
//组合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'];
|
||||
$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);
|
||||
|
||||
@@ -922,6 +992,9 @@ class Journal extends Controller {
|
||||
//组合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'];
|
||||
$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);
|
||||
//斜体变红
|
||||
@@ -978,7 +1051,7 @@ class Journal extends Controller {
|
||||
}
|
||||
//组装作者
|
||||
$arts = [];
|
||||
if(isset($data['author']) && $data['author'] != ''){
|
||||
if (isset($data['author']) && $data['author'] != '') {
|
||||
$arts = $this->article_author_obj->where('state', 0)->where('author_name', 'like', '%' . trim($data['author']) . '%')->column('article_id');
|
||||
if (count($arts) == 0) {
|
||||
$re['articles'] = [];
|
||||
@@ -986,7 +1059,7 @@ class Journal extends Controller {
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//构造查询语句
|
||||
$where_str = '';
|
||||
if (isset($data['term']) && $data['term'] != '') {
|
||||
@@ -1002,7 +1075,7 @@ class Journal extends Controller {
|
||||
$c_str = '(' . implode(',', $stages) . ')';
|
||||
$where_str = $where_str == '' ? 'journal_stage_id in ' . $c_str : 'journal_stage_id in ' . $c_str . ' and ' . $where_str;
|
||||
}
|
||||
|
||||
|
||||
if (count($arts) > 0) {
|
||||
$a_str = '(' . implode(',', $arts) . ')';
|
||||
$where_str = $where_str == '' ? 'article_id in ' . $a_str : 'article_id in ' . $a_str . ' and ' . $where_str;
|
||||
@@ -1043,7 +1116,7 @@ class Journal extends Controller {
|
||||
$re['count'] = $count;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @title 查找文章精确查找(新)
|
||||
* @description 查找文章精确查找(新)
|
||||
@@ -1063,54 +1136,54 @@ class Journal extends Controller {
|
||||
* @return articles:文章信息#
|
||||
* @return count:总数
|
||||
*/
|
||||
public function searchArticleMenu(){
|
||||
public function searchArticleMenu() {
|
||||
$data = $this->request->post();
|
||||
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
|
||||
|
||||
|
||||
//组合where语句
|
||||
$where_str = '';
|
||||
|
||||
if($data['key1'] == 'author'){
|
||||
|
||||
if ($data['key1'] == 'author') {
|
||||
$arts = $this->article_author_obj->where('state', 0)->where('author_name', 'like', '%' . trim($data['val1']) . '%')->column('article_id');
|
||||
$a_str = '(' . implode(',', $arts) . ')';
|
||||
$where_str = '(article_id in '. $a_str;
|
||||
}else{
|
||||
$where_str = '('.$data['key1'].' like "%'.$data['val1'].'%"';
|
||||
$where_str = '(article_id in ' . $a_str;
|
||||
} else {
|
||||
$where_str = '(' . $data['key1'] . ' like "%' . $data['val1'] . '%"';
|
||||
}
|
||||
if(isset($data['key2'])&&$data['key2']!=''){
|
||||
if($data['oper'] == 'and'){
|
||||
if (isset($data['key2']) && $data['key2'] != '') {
|
||||
if ($data['oper'] == 'and') {
|
||||
$where_str = $where_str . ' and ';
|
||||
}else{
|
||||
} else {
|
||||
$where_str = $where_str . ' or ';
|
||||
}
|
||||
if($data['key2'] == 'author'){
|
||||
if ($data['key2'] == 'author') {
|
||||
$arts = $this->article_author_obj->where('state', 0)->where('author_name', 'like', '%' . trim($data['val2']) . '%')->column('article_id');
|
||||
$a_str = '(' . implode(',', $arts) . ')';
|
||||
$where_str = $where_str.' article_id in '. $a_str;
|
||||
}else{
|
||||
$where_str = $where_str.' '.$data['key2'].' like "%'.$data['val2'].'%"';
|
||||
$where_str = $where_str . ' article_id in ' . $a_str;
|
||||
} else {
|
||||
$where_str = $where_str . ' ' . $data['key2'] . ' like "%' . $data['val2'] . '%"';
|
||||
}
|
||||
}
|
||||
//处理journal_id
|
||||
$where_str = $where_str . ') and journal_id in ('.trim($data['journal_id']).') and state = 0 ';
|
||||
$where_str = $where_str . ') and journal_id in (' . trim($data['journal_id']) . ') and state = 0 ';
|
||||
//处理order
|
||||
$order_str = '';
|
||||
if($data['key1']=='title'&&(isset($data['key2'])&&$data['key2']=='title')){
|
||||
if ($data['key1'] == 'title' && (isset($data['key2']) && $data['key2'] == 'title')) {
|
||||
$order_str = "((CASE WHEN title LIKE '%" . trim($data['val1']) . "%' THEN 1 ELSE 0 END) + (CASE WHEN title LIKE '%" . trim($data['val2']) . "%' THEN 1 ELSE 0 END)) desc";
|
||||
}elseif($data['key1']=='title'||(isset($data['key2'])&&$data['key2']=='title')){
|
||||
if($data['key1']=='title'){
|
||||
} elseif ($data['key1'] == 'title' || (isset($data['key2']) && $data['key2'] == 'title')) {
|
||||
if ($data['key1'] == 'title') {
|
||||
$order_str = "(CASE WHEN title LIKE '%" . trim($data['val1']) . "%' THEN 1 ELSE 0 END) desc";
|
||||
}else{
|
||||
} else {
|
||||
$order_str = "(CASE WHEN title LIKE '%" . trim($data['val2']) . "%' THEN 1 ELSE 0 END) desc";
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
$order_str = "article_id desc";
|
||||
}
|
||||
|
||||
|
||||
$list = $this->article_obj
|
||||
->where($where_str)
|
||||
->orderRaw($order_str)
|
||||
->limit($limit_start,$data['pageSize'])
|
||||
->limit($limit_start, $data['pageSize'])
|
||||
->select();
|
||||
$count = $this->article_obj
|
||||
->where($where_str)
|
||||
@@ -1124,6 +1197,9 @@ class Journal extends Controller {
|
||||
//组合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'];
|
||||
$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);
|
||||
//斜体变红
|
||||
@@ -1132,10 +1208,10 @@ class Journal extends Controller {
|
||||
foreach ($caches as $val) {
|
||||
$cache_title = str_replace($val, '<i>' . $val . '</i>', $cache_title);
|
||||
}
|
||||
if ($data['key1']=='title') {
|
||||
if ($data['key1'] == 'title') {
|
||||
$cache_title = str_replace(trim($data['val1']), '<b style="color:#c00">' . $data['val1'] . '</b>', $cache_title);
|
||||
}
|
||||
if (isset($data['key2'])&&$data['key2']=='title') {
|
||||
if (isset($data['key2']) && $data['key2'] == 'title') {
|
||||
$cache_title = str_replace(trim($data['val2']), '<b style="color:#c00">' . $data['val2'] . '</b>', $cache_title);
|
||||
}
|
||||
$list[$k]['title'] = $cache_title;
|
||||
@@ -1144,7 +1220,6 @@ class Journal extends Controller {
|
||||
$re['articles'] = $list;
|
||||
$re['count'] = $count;
|
||||
return jsonSuccess($re);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -578,5 +578,6 @@ class Main extends Controller {
|
||||
// echo '</pre>';
|
||||
// die;
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user