From ac484e8d625542de083306c1d7271c5988dca149 Mon Sep 17 00:00:00 2001 From: lccsw <805383944@qq.com> Date: Fri, 21 Nov 2025 14:46:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=90=8E=E5=8F=B0=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/controllers/Common.php | 14 +++ admin/controllers/Welcome.php | 1 + admin/controllers/sys/Notice.php | 62 +++++++++++- admin/controllers/sys/utils/Wss.php | 1 + admin/views/index.php | 53 ++++++++++- admin/views/sys/notice/lists.php | 95 +++++++++++++++++++ admin/views/sys/utils/wss/index.php | 20 ++++ agent/admin/controllers/auto/Login.php | 2 +- agent/admin/controllers/auto/car/Coupon.php | 2 +- .../admin/controllers/pingan/user/Notice.php | 2 +- common/models/sys/Sys_notice_model.php | 4 + 11 files changed, 247 insertions(+), 9 deletions(-) create mode 100644 admin/views/sys/notice/lists.php diff --git a/admin/controllers/Common.php b/admin/controllers/Common.php index f6727a1c..36fa5599 100644 --- a/admin/controllers/Common.php +++ b/admin/controllers/Common.php @@ -1249,4 +1249,18 @@ class Common extends CI_Controller $this->data = $rows; return $this->show_json(SYS_CODE_SUCCESS); } + + public function set_notice() + { + $id = $this->input->post('id'); + $this->load->model('sys/sys_notice_model'); + if ($this->uid) { + $where = ['uid' => $this->uid, 'platform' => Sys_notice_model::PLAT_FORM_ADMIN]; + if ($id) { + $where['id'] = $id; + } + $this->sys_notice_model->update(['read' => Sys_notice_model::STATUS_READ], $where); + } + return $this->show_json(SYS_CODE_SUCCESS, '操作成功'); + } } diff --git a/admin/controllers/Welcome.php b/admin/controllers/Welcome.php index 5b52d486..63fbef8d 100644 --- a/admin/controllers/Welcome.php +++ b/admin/controllers/Welcome.php @@ -39,6 +39,7 @@ class Welcome extends CI_Controller $where = [ 'platform' => Sys_notice_model::PLAT_FORM_ADMIN, 'uid' => $this->uid, + 'read' => Sys_notice_model::STATUS_UNREAD ]; $_noticeCount = $this->sys_notice_model->count($where); if ($_noticeCount) { diff --git a/admin/controllers/sys/Notice.php b/admin/controllers/sys/Notice.php index e3e0770c..ca234622 100644 --- a/admin/controllers/sys/Notice.php +++ b/admin/controllers/sys/Notice.php @@ -6,15 +6,48 @@ class Notice extends HD_Controller public function __construct() { parent::__construct(); + $this->load->model('sys/sys_notice_model'); } public function index() { + $this->lists(); } public function lists() { - $this->load->view('sys/notice/lists'); + $params = $this->input->get(); + + $page = $this->input->get('page') ?: 1; + $pageSize = 20; + $where = [ + 'platform' => Sys_notice_model::PLAT_FORM_ADMIN, + 'uid' => $this->uid + ]; + strlen($params['read']) && $where['read'] = intval($params['read']); + $count = $this->sys_notice_model->count($where); + $list = []; + if ($count) { + $rows = $this->sys_notice_model->select($where, 'id desc', $page, $pageSize); + foreach ($rows as $item) { + $list[] = [ + 'id' => $item['id'], + 'icon' => Sys_notice_model::ICON_TYPE[$item['icon']] ?: Sys_notice_model::ICON_DEFAULT, + 'content' => $item['content'], + 'url' => $item['url'], + 'read' => intval($item['read']), + 'readCn' => $item['read'] ? '已读' : '未读', + 'type' => $item['type'], + 'c_time' => date('Y-m-d H:i:s', $item['c_time']) + ]; + } + } + $this->data['params'] = $params; + $this->data['readList'] = Sys_notice_model::READ_STATUS; + $this->data['lists'] = $list; + $this->data['_title'] = '系统消息'; + $this->data['pager'] = array('count' => ceil($count / $pageSize), 'curr' => $page, 'totle' => $count); + $this->show_view('sys/notice/lists', true); } public function add() @@ -44,4 +77,31 @@ class Notice extends HD_Controller { } + + public function edit_read() + { + $id = $this->input->post('id'); + $field = $this->input->post('field'); + $value = $this->input->post('value'); + $read = $this->input->post('read'); + + if ('read' == $field) { + $read = $value; + } + + $upd = array('read' => $read); + $where = ['uid' => $this->uid, 'platform' => Sys_notice_model::PLAT_FORM_ADMIN]; + if (is_numeric($id)) { + $where['id'] = $id; + } else { + $where["id in ({$id})"] = null; + } + + $ret = $this->sys_notice_model->update($upd, $where); + if (!$ret) { + return $this->show_json(SYS_CODE_FAIL, '保存失败'); + } + + return $this->show_json(SYS_CODE_SUCCESS, '保存成功'); + } } diff --git a/admin/controllers/sys/utils/Wss.php b/admin/controllers/sys/utils/Wss.php index c08aa3e0..c2c0263d 100644 --- a/admin/controllers/sys/utils/Wss.php +++ b/admin/controllers/sys/utils/Wss.php @@ -32,6 +32,7 @@ class Wss extends HD_Controller 'uid' => $info['uid'], 'content' => $info['content'], ]; + $params['url'] = $info['url'] ?: ''; $endPlatform = Ws_conn_model::PLAT_FORM_SYS_ADMIN; /** @var MyResponse $req */ $req = $this->sys_notice_model->addNotice($params, $endPlatform, 8888888, true); diff --git a/admin/views/index.php b/admin/views/index.php index b7e0eb78..955f810b 100644 --- a/admin/views/index.php +++ b/admin/views/index.php @@ -75,8 +75,8 @@ 通知{{ countNotice }}