20201112
This commit is contained in:
@@ -122,20 +122,28 @@ class Article extends Controller {
|
|||||||
* @method POST
|
* @method POST
|
||||||
*
|
*
|
||||||
* @param name:topic_id type:int require:1 desc:文章id
|
* @param name: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 topicInfo:话题信息#
|
* @return topicInfo:话题信息#
|
||||||
* @return articleList:文章信息#
|
* @return articleList:文章信息#
|
||||||
*
|
* @return count:总数
|
||||||
*/
|
*/
|
||||||
public function getTopicArticles() {
|
public function getTopicArticles() {
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
$topic_info = $this->journal_topic_obj->where('journal_topic_id', $data['topic_id'])->find();
|
$topic_info = $this->journal_topic_obj->where('journal_topic_id', $data['topic_id'])->find();
|
||||||
$journal_info = $this->journal_obj->where('journal_id',$topic_info['journal_id'])->find();
|
$journal_info = $this->journal_obj->where('journal_id',$topic_info['journal_id'])->find();
|
||||||
|
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
|
||||||
$list = $this->article_to_topic_obj->field('j_article.*,j_journal_stage.*')
|
$list = $this->article_to_topic_obj->field('j_article.*,j_journal_stage.*')
|
||||||
->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']))
|
->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.topic_id', $data['topic_id'])
|
||||||
->where('j_article_to_topic.state', 0)
|
->where('j_article_to_topic.state', 0)
|
||||||
|
->limit($limit_start,$data['pageSize'])
|
||||||
->select();
|
->select();
|
||||||
|
$count = $this->article_to_topic_obj
|
||||||
|
->where('j_article_to_topic.topic_id', $data['topic_id'])
|
||||||
|
->where('j_article_to_topic.state', 0)
|
||||||
|
->count();
|
||||||
//获取作者
|
//获取作者
|
||||||
foreach ($list as $k => $v) {
|
foreach ($list as $k => $v) {
|
||||||
$stage_info = $this->journal_stage_obj->where('journal_stage_id',$v['journal_stage_id'])->find();
|
$stage_info = $this->journal_stage_obj->where('journal_stage_id',$v['journal_stage_id'])->find();
|
||||||
@@ -156,6 +164,7 @@ class Article extends Controller {
|
|||||||
}
|
}
|
||||||
$re['topicInfo'] = $topic_info;
|
$re['topicInfo'] = $topic_info;
|
||||||
$re['articleList'] = $list;
|
$re['articleList'] = $list;
|
||||||
|
$re['count'] = $count;
|
||||||
return jsonSuccess($re);
|
return jsonSuccess($re);
|
||||||
}
|
}
|
||||||
private function getAuthor($article) {
|
private function getAuthor($article) {
|
||||||
@@ -261,6 +270,7 @@ class Article extends Controller {
|
|||||||
*/
|
*/
|
||||||
public function getTopArt() {
|
public function getTopArt() {
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
|
$journal_info = $this->journal_obj->where('journal_id',$data['journal_id'])->find();
|
||||||
$list = [];
|
$list = [];
|
||||||
if ($data['type'] == 'cited') {
|
if ($data['type'] == 'cited') {
|
||||||
$list = $this->article_obj->field('j_article.*,j_journal_stage.*')
|
$list = $this->article_obj->field('j_article.*,j_journal_stage.*')
|
||||||
@@ -284,6 +294,16 @@ class Article extends Controller {
|
|||||||
->orderRaw('j_article.html_num+j_article.pdf_num desc')
|
->orderRaw('j_article.html_num+j_article.pdf_num desc')
|
||||||
->select();
|
->select();
|
||||||
}
|
}
|
||||||
|
//获取作者
|
||||||
|
foreach ($list as $k => $v) {
|
||||||
|
$stage_info = $this->journal_stage_obj->where('journal_stage_id',$v['journal_stage_id'])->find();
|
||||||
|
//组合cite信息
|
||||||
|
$no = $stage_info['stage_no'] == 0 ? ':' : '(' . $stage_info['stage_no'] . '):';
|
||||||
|
$cite = $v['abbr'] . '. ' . $v['title'] . '. <i>' . $journal_info['jabbr'] . '</i>. ' . $stage_info['stage_year'] . ';' . $stage_info['stage_vol'] . $no . $v['npp'] . '. doi:' . $v['doi'];
|
||||||
|
$list[$k]['cite'] = $cite;
|
||||||
|
$list[$k]['authortitle'] = $this->getAuthor($v);
|
||||||
|
}
|
||||||
|
|
||||||
//标题斜体
|
//标题斜体
|
||||||
foreach ($list as $k => $v) {
|
foreach ($list as $k => $v) {
|
||||||
$caches = $this->article_ltai_obj->where('article_id', $v['article_id'])->where('state', 0)->column('content');
|
$caches = $this->article_ltai_obj->where('article_id', $v['article_id'])->where('state', 0)->column('content');
|
||||||
@@ -394,7 +414,6 @@ class Article extends Controller {
|
|||||||
$ris .= 'JF - '.$journal['title']."\n";
|
$ris .= 'JF - '.$journal['title']."\n";
|
||||||
$kws = explode(', ', $article_info['keywords']);
|
$kws = explode(', ', $article_info['keywords']);
|
||||||
foreach ($kws as $vvv){
|
foreach ($kws as $vvv){
|
||||||
|
|
||||||
$ris .= 'KW - '.str_replace('</i>','',str_replace('<i>','',$vvv))."\n";
|
$ris .= 'KW - '.str_replace('</i>','',str_replace('<i>','',$vvv))."\n";
|
||||||
}
|
}
|
||||||
$abs = str_replace('Abstract','',strip_tags(str_replace(" ","",htmlspecialchars_decode($article_info['abstract']))));
|
$abs = str_replace('Abstract','',strip_tags(str_replace(" ","",htmlspecialchars_decode($article_info['abstract']))));
|
||||||
|
|||||||
@@ -134,17 +134,26 @@ class Journal extends Controller {
|
|||||||
*/
|
*/
|
||||||
public function getJournalTopic() {
|
public function getJournalTopic() {
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
|
$p_res = $this->journal_topic_obj
|
||||||
|
->where('journal_id', $data['journal_id'])
|
||||||
|
->where('state', 0)
|
||||||
|
->where('parent_id',0)
|
||||||
|
->order('sort')
|
||||||
|
->select();
|
||||||
|
|
||||||
$res = $this->journal_topic_obj
|
$res = $this->journal_topic_obj
|
||||||
->where('journal_id', $data['journal_id'])
|
->where('journal_id', $data['journal_id'])
|
||||||
->where('state', 0)
|
->where('state', 0)
|
||||||
|
->where('parent_id','>',0)
|
||||||
|
->order('sort asc,journal_topic_id asc')
|
||||||
->select();
|
->select();
|
||||||
//处理数组
|
//处理数组
|
||||||
$frag = [];
|
$frag = $p_res;
|
||||||
foreach ($res as $v) {
|
// foreach ($res as $v) {
|
||||||
if ($v['parent_id'] == 0) {
|
// if ($v['parent_id'] == 0) {
|
||||||
$frag[] = $v;
|
// $frag[] = $v;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
foreach ($frag as $kk => $vv) {
|
foreach ($frag as $kk => $vv) {
|
||||||
$frag[$kk] = $this->getChieldarr($vv, $res);
|
$frag[$kk] = $this->getChieldarr($vv, $res);
|
||||||
}
|
}
|
||||||
@@ -650,6 +659,7 @@ class Journal extends Controller {
|
|||||||
$repeat = $this->subscribe_journal_obj
|
$repeat = $this->subscribe_journal_obj
|
||||||
->where('journal_id', $data['journal_id'])
|
->where('journal_id', $data['journal_id'])
|
||||||
->where('email', $data['email'])
|
->where('email', $data['email'])
|
||||||
|
->where('state',0)
|
||||||
->find();
|
->find();
|
||||||
if ($repeat) {
|
if ($repeat) {
|
||||||
return jsonError('repeat subscribe!');
|
return jsonError('repeat subscribe!');
|
||||||
@@ -691,6 +701,7 @@ class Journal extends Controller {
|
|||||||
$repeat = $this->subscribe_topic_obj
|
$repeat = $this->subscribe_topic_obj
|
||||||
->where('topic_id', $data['topic_id'])
|
->where('topic_id', $data['topic_id'])
|
||||||
->where('email', $data['email'])
|
->where('email', $data['email'])
|
||||||
|
->where('state',0)
|
||||||
->find();
|
->find();
|
||||||
if ($repeat) {
|
if ($repeat) {
|
||||||
return jsonError('repeat subscribe!');
|
return jsonError('repeat subscribe!');
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user