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 = [