From 0d7fc1169d7b1ebfed6b6b6750177008bc227802 Mon Sep 17 00:00:00 2001 From: chengxl Date: Tue, 15 Jul 2025 13:20:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=AE=A2=E5=BA=A7=E6=9C=9F?= =?UTF-8?q?=E5=88=8A=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/controller/Special.php | 56 +++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 2 deletions(-) diff --git a/application/api/controller/Special.php b/application/api/controller/Special.php index 5ba5e34..6845897 100644 --- a/application/api/controller/Special.php +++ b/application/api/controller/Special.php @@ -184,8 +184,60 @@ class Special extends Controller { $re['specials'] = $f; return jsonSuccess($re); } - - + /** + * @title 获取客座期刊-新 + * @description 获取客座期刊 + * @author wangjinlei + * @url /api/Special/getSpecials + * @method POST + * + * @param name:journal_id type:int require:1 desc:期刊id + * + * @return specials:客座期刊列表array# + */ + public function getSpecialsNew(){ + + //获取参数 + $data = $this->request->post(); + + //期刊ID + $iJournalId = empty($data['journal_id']) ? 0 : $data['journal_id']; + + //定义返回数组 + $re = ['is_show' => 'false','specials' => [],'count' => 0]; + if(empty($iJournalId)){ + return jsonSuccess($re); + } + //参数组装 + $aWhere = ['state' => 2,'journal_id' => $iJournalId]; + //查询数量 + $iCount = $this->journal_special_obj->where($aWhere)->count(); + if(empty($iCount)){ + return jsonSuccess($re); + } + $re['count'] = $iCount; + //查询期刊详情 + $list = $this->journal_special_obj->where($aWhere)->order('journal_special_id desc')->limit(4)->select(); + $f = []; + //获取作者 + foreach ($list as $k => $v){ + $frag = ''; + $caches = $this->journal_special_to_editor_obj + ->field('j_journal_special_editor.*') + ->join('j_journal_special_editor','j_journal_special_editor.journal_special_editor_id = j_journal_special_to_editor.journal_special_editor_id','LEFT') + ->where('j_journal_special_to_editor.journal_special_id',$v['journal_special_id']) + ->where('j_journal_special_to_editor.state',0) + ->select(); + foreach ($caches as $val){ + $frag .= $frag == ''?$val['first_name'].' '.$val['last_name']:', '.$val['first_name'].' '.$val['last_name']; + } + $v['editor'] = $frag; + $f[] = $v; + } + $re['is_show'] = 'true'; + $re['specials'] = $f; + return jsonSuccess($re); + } /** * @title 获取全部客座期刊 * @description 获取全部客座期刊