From 70748438bcc863e7302d20eb2ee0b8ade517ce5b Mon Sep 17 00:00:00 2001 From: air <30444667+sszdot@users.noreply.github.com> Date: Thu, 12 Jun 2025 18:50:03 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E7=B1=BB=20=20=E5=9E=8B=E3=80=91?= =?UTF-8?q?=EF=BC=9Afeat=20=E3=80=90=E5=8E=9F=20=20=E5=9B=A0=E3=80=91?= =?UTF-8?q?=EF=BC=9A=E8=8E=B7=E5=8F=96=E7=AE=A1=E7=90=86=E5=91=98=E5=85=AC?= =?UTF-8?q?=E5=91=8A=E5=88=97=E8=A1=A8=20=E6=8E=A5=E5=8F=A3=20=E3=80=90?= =?UTF-8?q?=E8=BF=87=20=20=E7=A8=8B=E3=80=91=EF=BC=9A=20=E3=80=90=E5=BD=B1?= =?UTF-8?q?=20=20=E5=93=8D=E3=80=91=EF=BC=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # 类型 包含: # feat:新功能(feature) # fix:修补bug # docs:文档(documentation) # style: 格式(不影响代码运行的变动) # refactor:重构(即不是新增功能,也不是修改bug的代码变动) # test:增加测试 # chore:构建过程或辅助工具的变动 --- .../Controller/AdminController.class.php | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/FlyCube/MpApi/Controller/AdminController.class.php b/FlyCube/MpApi/Controller/AdminController.class.php index f6c1804..1d5d5f9 100644 --- a/FlyCube/MpApi/Controller/AdminController.class.php +++ b/FlyCube/MpApi/Controller/AdminController.class.php @@ -304,6 +304,40 @@ class AdminController extends PublicController echo json_encode(array('status' => 0, 'msg' => '公告发布失败')); } } + /** + * @description 获取公告列表(当前管理员 + 未过期) + */ + public function getMessageList() + { + $adminId = $this->admin_id; + $now = time(); + + // 构造查询条件 + $where = array( + 'admin_id' => $adminId, + 'end_time' => array('gt', $now) // 未过期 + ); + + // 查询字段 + $fields = array('id', 'tit', 'message', 'end_time', 'add_time'); + + // 数据库查询 + $messageDb = D('message'); + $messageList = $messageDb->where($where)->field($fields)->order('add_time DESC')->select(); + + if ($messageList !== false) { + echo json_encode(array( + 'status' => 1, + 'msg' => '获取成功', + 'messageList' => $messageList + )); + } else { + echo json_encode(array( + 'status' => 0, + 'msg' => '获取失败' + )); + } + } /** * @description: 分类列表 */