20201112
This commit is contained in:
@@ -46,9 +46,7 @@ class Main extends Controller{
|
||||
* @url /api/Main/getScients
|
||||
* @method POST
|
||||
*
|
||||
*
|
||||
* @return scients:array#
|
||||
*
|
||||
*/
|
||||
public function getScients(){
|
||||
$list = $this->sys_scient_obj->where('state',0)->select();
|
||||
@@ -56,6 +54,25 @@ class Main extends Controller{
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取scients详情
|
||||
* @description 获取scients详情
|
||||
* @author wangjinlei
|
||||
* @url /api/Main/getScientDetail
|
||||
* @method POST
|
||||
*
|
||||
* @param name:system_scient_id type:int require:1 desc:主键id
|
||||
*
|
||||
* @return scient:array#
|
||||
*/
|
||||
public function getScientDetail(){
|
||||
$data = $this->request->post();
|
||||
$info = $this->sys_scient_obj->where('system_scient_id',$data['system_scient_id'])->find();
|
||||
|
||||
$re['scient'] = $info;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取books
|
||||
* @description 获取books
|
||||
@@ -63,9 +80,7 @@ class Main extends Controller{
|
||||
* @url /api/Main/getBooks
|
||||
* @method POST
|
||||
*
|
||||
*
|
||||
* @return books:array#
|
||||
*
|
||||
*/
|
||||
public function getBooks(){
|
||||
$list = $this->sys_book_obj->where('state',0)->select();
|
||||
@@ -73,6 +88,25 @@ class Main extends Controller{
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取book详情
|
||||
* @description 获取book详情
|
||||
* @author wangjinlei
|
||||
* @url /api/Main/getBookDetail
|
||||
* @method POST
|
||||
*
|
||||
* @param name:system_book_id type:int require:1 desc:主键id
|
||||
*
|
||||
* @return book:array#
|
||||
*/
|
||||
public function getBookDetail(){
|
||||
$data = $this->request->post();
|
||||
$info = $this->sys_book_obj->where('system_book_id',$data['system_book_id'])->find();
|
||||
|
||||
$re['book'] = $info;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取首页Highlights
|
||||
* @description 获取首页Highlights
|
||||
@@ -99,4 +133,86 @@ class Main extends Controller{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取期刊列表
|
||||
* @description 获取期刊列表
|
||||
* @author wangjinlei
|
||||
* @url /api/Main/getJournals
|
||||
* @method POST
|
||||
*
|
||||
* @return journals:array#
|
||||
*/
|
||||
public function getJournals(){
|
||||
$list = $this->journal_obj->where('state',0)->select();
|
||||
|
||||
$re['journals'] = $list;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取查找文章列表
|
||||
* @description 获取查找文章列表
|
||||
* @author wangjinlei
|
||||
* @url /api/Main/getSearchArt
|
||||
* @method POST
|
||||
*
|
||||
* @param name:journals type:string require:1 desc:期刊id(demo:1,2,3)
|
||||
* @param name:condition1 type:string require:1 desc:条件1(title/keywords/abstract)
|
||||
* @param name:condition1_text type:string require:1 desc:条件1字段
|
||||
* @param name:relation type:string require:2 desc:两条件的链接条件('and/or')
|
||||
* @param name:condition2 type:string require:2 desc:条件2(title/keywords/abstract)
|
||||
* @param name:condition2_text type:string require:2 desc:条件2字段
|
||||
* @param name:pageIndex type:int require:1 desc:当前页码数
|
||||
* @param name:pageSize type:int require:1 desc:单页数据条数
|
||||
*
|
||||
* @return count:总数
|
||||
* @return journals:array#
|
||||
*/
|
||||
public function getSearchArt(){
|
||||
$data = $this->request->post();
|
||||
|
||||
// $data['journals'] = '1,2,3';
|
||||
// $data['condition1'] = 'title';
|
||||
// $data['condition1_text'] = '1';
|
||||
// $data['relation'] = 'or';
|
||||
// $data['condition2'] = 'keywords';
|
||||
// $data['condition2_text'] = '1';
|
||||
// $data['pageIndex'] = 1;
|
||||
// $data['pageSize'] = 12;
|
||||
$where = "j_article.journal_id in (".$data['journals'].")";
|
||||
if($data['condition2_text']!=''){
|
||||
if($data['relation']=='and'){
|
||||
$where .= ' and j_article.'.$data['condition1'] .' like "%'.$data['condition1_text'].'%" and j_article.'.$data['condition2'] .' like "%'.$data['condition2_text'].'%"';
|
||||
}else{
|
||||
$where .= ' and (j_article.'.$data['condition1'] .' like "%'.$data['condition1_text'].'%" or j_article.'.$data['condition2'] .' like "%'.$data['condition2_text'].'%")';
|
||||
}
|
||||
}else{
|
||||
$where .= 'and j_article.'.$data['condition1'] .' like "%'.$data['condition1_text'].'%"';
|
||||
}
|
||||
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
|
||||
$list = $this->article_obj->field('j_article.*,j_journal_stage.*')
|
||||
->join('j_journal_stage','j_article.journal_stage_id=j_journal_stage.journal_stage_id','LEFT')
|
||||
->where($where)
|
||||
->order('j_article.article_id')
|
||||
->limit($limit_start,$data['pageSize'])
|
||||
->select();
|
||||
|
||||
foreach ($list as $k => $v){
|
||||
$list[$k]['authortitle'] = $this->getAuthor($v);
|
||||
}
|
||||
$count = $this->article_obj->where($where)->count();
|
||||
$re['count'] = $count;
|
||||
$re['journals'] = $list;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
private function getAuthor($article){
|
||||
$where['article_id'] = $article['article_id'];
|
||||
$where['state'] = 0;
|
||||
$list = $this->article_author_obj->where($where)->select();
|
||||
$frag = '';
|
||||
foreach ($list as $k=>$v){
|
||||
$frag = $frag==''?''.$v['author_name']:$frag.', '.$v['author_name'];
|
||||
}
|
||||
return $frag;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user