This commit is contained in:
Administrator
2022-03-22 16:12:45 +08:00
parent 6c1cda1134
commit 05c0a713ee
2 changed files with 18 additions and 7 deletions

View File

@@ -1236,14 +1236,25 @@ class Journal extends Controller {
*/
public function getMainPageStages() {
$data = $this->request->post();
$show_type = $this->journal_obj->where(['journal_id'=> $data['journal_id'],'state'=>0])->value('topic_show_type');
$frag = [];
$list = $this->journal_stage_obj->where('journal_id', $data['journal_id'])->where('stage_year', date("Y"))->where('is_publish', 1)->where('state', 0)->order("stage_no desc")->select();
if (count($list) == 0) {
$frag = $this->journal_stage_obj->where('journal_id', $data['journal_id'])->where('stage_year', date("Y", strtotime("-1 year")))->where('is_publish', 1)->where('state', 0)->order("stage_no desc")->select();
} else {
$frag = $list;
if($show_type==0){
$list = $this->journal_stage_obj->where('journal_id', $data['journal_id'])->where('stage_year', date("Y"))->where('is_publish', 1)->where('state', 0)->order("stage_no desc")->select();
if (count($list) == 0) {
$frag = $this->journal_stage_obj->where('journal_id', $data['journal_id'])->where('stage_year', date("Y", strtotime("-1 year")))->where('is_publish', 1)->where('state', 0)->order("stage_no desc")->select();
} else {
$frag = $list;
}
}else{
$frag=$this->journal_stage_obj
->where('journal_id', $data['journal_id'])
->where('is_publish', 1)
->where('state', 0)
->order("stage_year desc,stage_no desc")
->limit(1,4)
->select();
}
$re['topic_show_type'] = $this->journal_obj->where(['journal_id'=> $data['journal_id'],'state'=>0])->value('topic_show_type');
$re['topic_show_type'] = $show_type;
$re['stages'] = $frag;
return jsonSuccess($re);
}