20201112
This commit is contained in:
@@ -311,21 +311,31 @@ class Journal extends Controller {
|
|||||||
* @method POST
|
* @method POST
|
||||||
*
|
*
|
||||||
* @param name:journal_id type:int require:1 desc:期刊id
|
* @param name:journal_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:文章列表array#
|
* @return articlelist:文章列表array#
|
||||||
|
* @return count:总数
|
||||||
*/
|
*/
|
||||||
public function getOnlineArticle() {
|
public function getOnlineArticle() {
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
$stages = $this->journal_stage_obj->where('journal_id', $data['journal_id'])->where('is_publish', 0)->where('state', 0)->column('journal_stage_id');
|
$stages = $this->journal_stage_obj->where('journal_id', $data['journal_id'])->where('is_publish', 0)->where('state', 0)->column('journal_stage_id');
|
||||||
$journal_info = $this->journal_obj->where('journal_id', $data['journal_id'])->find();
|
$journal_info = $this->journal_obj->where('journal_id', $data['journal_id'])->find();
|
||||||
|
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
|
||||||
$list = $this->article_obj
|
$list = $this->article_obj
|
||||||
->field('j_article.*,j_journal_stage.*')
|
->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('j_article.journal_stage_id', 'in', $stages)
|
->where('j_article.journal_stage_id', 'in', $stages)
|
||||||
->where('j_article.state', 0)
|
->where('j_article.state', 0)
|
||||||
->order('j_article.sort desc')
|
->order('j_article.sort desc')
|
||||||
|
->limit($limit_start,$data['pageSize'])
|
||||||
->select();
|
->select();
|
||||||
|
|
||||||
|
$count = $this->article_obj
|
||||||
|
->join('j_journal_stage', 'j_article.journal_stage_id = j_journal_stage.journal_stage_id', 'LEFT')
|
||||||
|
->where('j_article.journal_stage_id', 'in', $stages)
|
||||||
|
->where('j_article.state', 0)
|
||||||
|
->count();
|
||||||
//标题斜体
|
//标题斜体
|
||||||
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');
|
||||||
@@ -346,7 +356,7 @@ class Journal extends Controller {
|
|||||||
$list[$k]['authortitle'] = $this->getAuthor($v);
|
$list[$k]['authortitle'] = $this->getAuthor($v);
|
||||||
}
|
}
|
||||||
|
|
||||||
return json(['code' => 0, 'msg' => 'success', 'data' => ['articlelist' => $list]]);
|
return json(['code' => 0, 'msg' => 'success', 'data' => ['articlelist' => $list,'count'=>$count]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user