From 7e3851f7cbef0765775c0180460652aae7e6cc1b Mon Sep 17 00:00:00 2001 From: yaooo <272523191@qq.com> Date: Wed, 1 Nov 2023 15:38:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/MessageIndex.php | 25 +++++++++++++++++++++++++ app/common.php | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/app/api/controller/MessageIndex.php b/app/api/controller/MessageIndex.php index f7cbb0f..5c41fde 100644 --- a/app/api/controller/MessageIndex.php +++ b/app/api/controller/MessageIndex.php @@ -111,4 +111,29 @@ class MessageIndex extends ApiController $this->apiSuccess('查看成功', $detail); } + //消息删除 + public function delete() + { + $param = get_params(); + $this->uid = JWT_UID; + $param = get_params(); + $type = 4; + $ids = empty($param['ids']) ? 0 : $param['ids']; + $idArray = explode(',', $ids); + $list = []; + foreach ($idArray as $key => $val) { + $list[] = [ + 'status' => -1, + 'id' => $val, + 'update_time' => time(), + ]; + } + foreach ($list as $key => $v) { + if (MessageList::update($v) !== false) { + add_log('delete', $v['id'],[],'消息'); + } + } + $this->apiSuccess('操作成功'); + } + } diff --git a/app/common.php b/app/common.php index a790164..91e9339 100644 --- a/app/common.php +++ b/app/common.php @@ -693,7 +693,7 @@ function add_log($type, $param_id = '', $param = [] ,$subject='') $uid = JWT_UID; } $type_action = get_config('log.type_action'); - if($type_action[$type]){ + if(!empty($type_action[$type])){ $title = $type_action[$type]; } $data = [