20201112
This commit is contained in:
@@ -350,7 +350,6 @@ class Journal extends Controller {
|
|||||||
->where('j_article.type', ['like', 'News'], ['like', 'Comment'], 'or')
|
->where('j_article.type', ['like', 'News'], ['like', 'Comment'], 'or')
|
||||||
->order('j_article.article_id')
|
->order('j_article.article_id')
|
||||||
->select();
|
->select();
|
||||||
|
|
||||||
//获取作者
|
//获取作者
|
||||||
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();
|
||||||
|
|||||||
@@ -10,7 +10,8 @@ use think\Db;
|
|||||||
* @description 前段web接口
|
* @description 前段web接口
|
||||||
* @group 前段web接口
|
* @group 前段web接口
|
||||||
*/
|
*/
|
||||||
class Main extends Controller{
|
class Main extends Controller {
|
||||||
|
|
||||||
//put your code here
|
//put your code here
|
||||||
protected $admin_obj = '';
|
protected $admin_obj = '';
|
||||||
protected $journal_obj = '';
|
protected $journal_obj = '';
|
||||||
@@ -38,7 +39,7 @@ class Main extends Controller{
|
|||||||
$this->sys_scient_obj = Db::name('system_scient');
|
$this->sys_scient_obj = Db::name('system_scient');
|
||||||
$this->sys_book_obj = Db::name('system_books');
|
$this->sys_book_obj = Db::name('system_books');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 获取scients
|
* @title 获取scients
|
||||||
* @description 获取scients
|
* @description 获取scients
|
||||||
@@ -48,12 +49,12 @@ class Main extends Controller{
|
|||||||
*
|
*
|
||||||
* @return scients:array#
|
* @return scients:array#
|
||||||
*/
|
*/
|
||||||
public function getScients(){
|
public function getScients() {
|
||||||
$list = $this->sys_scient_obj->where('state',0)->select();
|
$list = $this->sys_scient_obj->where('state', 0)->select();
|
||||||
$re['scients'] = $list;
|
$re['scients'] = $list;
|
||||||
return jsonSuccess($re);
|
return jsonSuccess($re);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 获取scients详情
|
* @title 获取scients详情
|
||||||
* @description 获取scients详情
|
* @description 获取scients详情
|
||||||
@@ -65,14 +66,14 @@ class Main extends Controller{
|
|||||||
*
|
*
|
||||||
* @return scient:array#
|
* @return scient:array#
|
||||||
*/
|
*/
|
||||||
public function getScientDetail(){
|
public function getScientDetail() {
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
$info = $this->sys_scient_obj->where('system_scient_id',$data['system_scient_id'])->find();
|
$info = $this->sys_scient_obj->where('system_scient_id', $data['system_scient_id'])->find();
|
||||||
|
|
||||||
$re['scient'] = $info;
|
$re['scient'] = $info;
|
||||||
return jsonSuccess($re);
|
return jsonSuccess($re);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 获取books
|
* @title 获取books
|
||||||
* @description 获取books
|
* @description 获取books
|
||||||
@@ -82,12 +83,12 @@ class Main extends Controller{
|
|||||||
*
|
*
|
||||||
* @return books:array#
|
* @return books:array#
|
||||||
*/
|
*/
|
||||||
public function getBooks(){
|
public function getBooks() {
|
||||||
$list = $this->sys_book_obj->where('state',0)->select();
|
$list = $this->sys_book_obj->where('state', 0)->select();
|
||||||
$re['books'] = $list;
|
$re['books'] = $list;
|
||||||
return jsonSuccess($re);
|
return jsonSuccess($re);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 获取book详情
|
* @title 获取book详情
|
||||||
* @description 获取book详情
|
* @description 获取book详情
|
||||||
@@ -99,14 +100,14 @@ class Main extends Controller{
|
|||||||
*
|
*
|
||||||
* @return book:array#
|
* @return book:array#
|
||||||
*/
|
*/
|
||||||
public function getBookDetail(){
|
public function getBookDetail() {
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
$info = $this->sys_book_obj->where('system_book_id',$data['system_book_id'])->find();
|
$info = $this->sys_book_obj->where('system_book_id', $data['system_book_id'])->find();
|
||||||
|
|
||||||
$re['book'] = $info;
|
$re['book'] = $info;
|
||||||
return jsonSuccess($re);
|
return jsonSuccess($re);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 获取首页Highlights
|
* @title 获取首页Highlights
|
||||||
* @description 获取首页Highlights
|
* @description 获取首页Highlights
|
||||||
@@ -118,21 +119,21 @@ class Main extends Controller{
|
|||||||
*
|
*
|
||||||
* @return Highlights:array#
|
* @return Highlights:array#
|
||||||
*/
|
*/
|
||||||
public function getMainhl(){
|
public function getMainhl() {
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
$topic_info = $this->journal_topic_obj->where('journal_id',$data['journal_id'])->where('position','highlights')->where('state',0)->find();
|
$topic_info = $this->journal_topic_obj->where('journal_id', $data['journal_id'])->where('position', 'highlights')->where('state', 0)->find();
|
||||||
if($topic_info){
|
if ($topic_info) {
|
||||||
$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.article_id = j_article_to_topic.article_id','LEFT'],['j_journal_stage','j_journal_stage.journal_stage_id = j_article.journal_stage_id','LEFT']))
|
->join(array(['j_article', 'j_article.article_id = j_article_to_topic.article_id', 'LEFT'], ['j_journal_stage', 'j_journal_stage.journal_stage_id = j_article.journal_stage_id', 'LEFT']))
|
||||||
->where('j_article_to_topic.topic_id',$topic_info['journal_topic_id'])
|
->where('j_article_to_topic.topic_id', $topic_info['journal_topic_id'])
|
||||||
->where('j_article_to_topic.state',0)
|
->where('j_article_to_topic.state', 0)
|
||||||
->select();
|
->select();
|
||||||
return jsonSuccess(['topic_info'=>$topic_info,'articlelist'=>$list]);
|
return jsonSuccess(['topic_info' => $topic_info, 'articlelist' => $list]);
|
||||||
}else{
|
} else {
|
||||||
return jsonError('no highlights');
|
return jsonError('no highlights');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 获取期刊列表
|
* @title 获取期刊列表
|
||||||
* @description 获取期刊列表
|
* @description 获取期刊列表
|
||||||
@@ -142,19 +143,13 @@ class Main extends Controller{
|
|||||||
*
|
*
|
||||||
* @return journals:array#
|
* @return journals:array#
|
||||||
*/
|
*/
|
||||||
public function getJournals(){
|
public function getJournals() {
|
||||||
$list = $this->journal_obj->where('state',0)->select();
|
$list = $this->journal_obj->where('state', 0)->select();
|
||||||
|
|
||||||
$re['journals'] = $list;
|
$re['journals'] = $list;
|
||||||
return jsonSuccess($re);
|
return jsonSuccess($re);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function test(){
|
|
||||||
echo 'ookkjjhhgg';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 获取查找文章列表
|
* @title 获取查找文章列表
|
||||||
* @description 获取查找文章列表
|
* @description 获取查找文章列表
|
||||||
@@ -174,36 +169,27 @@ class Main extends Controller{
|
|||||||
* @return count:总数
|
* @return count:总数
|
||||||
* @return journals:array#
|
* @return journals:array#
|
||||||
*/
|
*/
|
||||||
public function getSearchArt(){
|
public function getSearchArt() {
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
|
$where = "j_article.journal_id in (" . $data['journals'] . ")";
|
||||||
// $data['journals'] = '1,2,3';
|
if ($data['condition2_text'] != '') {
|
||||||
// $data['condition1'] = 'title';
|
if ($data['relation'] == 'and') {
|
||||||
// $data['condition1_text'] = '1';
|
$where .= ' and j_article.' . $data['condition1'] . ' like "%' . $data['condition1_text'] . '%" and j_article.' . $data['condition2'] . ' like "%' . $data['condition2_text'] . '%"';
|
||||||
// $data['relation'] = 'or';
|
} else {
|
||||||
// $data['condition2'] = 'keywords';
|
$where .= ' and (j_article.' . $data['condition1'] . ' like "%' . $data['condition1_text'] . '%" or j_article.' . $data['condition2'] . ' like "%' . $data['condition2_text'] . '%")';
|
||||||
// $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{
|
} else {
|
||||||
$where .= 'and j_article.'.$data['condition1'] .' like "%'.$data['condition1_text'].'%"';
|
$where .= 'and j_article.' . $data['condition1'] . ' like "%' . $data['condition1_text'] . '%"';
|
||||||
}
|
}
|
||||||
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
|
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
|
||||||
$list = $this->article_obj->field('j_article.*,j_journal_stage.*')
|
$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')
|
->join('j_journal_stage', 'j_article.journal_stage_id=j_journal_stage.journal_stage_id', 'LEFT')
|
||||||
->where($where)
|
->where($where)
|
||||||
->order('j_article.article_id')
|
->order('j_article.article_id')
|
||||||
->limit($limit_start,$data['pageSize'])
|
->limit($limit_start, $data['pageSize'])
|
||||||
->select();
|
->select();
|
||||||
|
|
||||||
foreach ($list as $k => $v){
|
foreach ($list as $k => $v) {
|
||||||
$list[$k]['authortitle'] = $this->getAuthor($v);
|
$list[$k]['authortitle'] = $this->getAuthor($v);
|
||||||
}
|
}
|
||||||
$count = $this->article_obj->where($where)->count();
|
$count = $this->article_obj->where($where)->count();
|
||||||
@@ -211,15 +197,20 @@ class Main extends Controller{
|
|||||||
$re['journals'] = $list;
|
$re['journals'] = $list;
|
||||||
return jsonSuccess($re);
|
return jsonSuccess($re);
|
||||||
}
|
}
|
||||||
private function getAuthor($article){
|
|
||||||
|
private function getAuthor($article) {
|
||||||
$where['article_id'] = $article['article_id'];
|
$where['article_id'] = $article['article_id'];
|
||||||
$where['state'] = 0;
|
$where['state'] = 0;
|
||||||
$list = $this->article_author_obj->where($where)->select();
|
$list = $this->article_author_obj->where($where)->select();
|
||||||
$frag = '';
|
$frag = '';
|
||||||
foreach ($list as $k=>$v){
|
foreach ($list as $k => $v) {
|
||||||
$frag = $frag==''?''.$v['author_name']:$frag.', '.$v['author_name'];
|
$frag = $frag == '' ? '' . $v['author_name'] : $frag . ', ' . $v['author_name'];
|
||||||
}
|
}
|
||||||
return $frag;
|
return $frag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test() {
|
||||||
|
echo md5('123456');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user