From c5044dc52cba5955bd4a83f4cef727a1d098e0a5 Mon Sep 17 00:00:00 2001 From: air <30444667+sszdot@users.noreply.github.com> Date: Mon, 23 Jun 2025 13:43:58 +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=9A=20=E3=80=90=E5=8E=9F=20=20=E5=9B=A0=E3=80=91=EF=BC=9A?= =?UTF-8?q?=20=E3=80=90=E8=BF=87=20=20=E7=A8=8B=E3=80=91=EF=BC=9A=20?= =?UTF-8?q?=E3=80=90=E5=BD=B1=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 --- .../Controller/PlaneController.class.php | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/FlyCube/MpApi/Controller/PlaneController.class.php b/FlyCube/MpApi/Controller/PlaneController.class.php index 48e5e1c..edc0993 100644 --- a/FlyCube/MpApi/Controller/PlaneController.class.php +++ b/FlyCube/MpApi/Controller/PlaneController.class.php @@ -1022,6 +1022,46 @@ class PlaneController extends PublicController )); } } + /** + * 删除指定的飞行数据记录 + * @param string idArr 以逗号分隔的ID字符串 + * @return json + */ + public function deleteFlyDataByIdArr() + { + if ($this->tokenShop_id != C('powerId')) { //非总管理员 + $where['shop_id'] = $this->tokenShop_id; + } + + // 获取参数 + $idArrStr = I('post.idArr', '', 'trim'); + + if (empty($idArrStr)) { + $this->ajaxReturn(array('status' => 0, 'msg' => '参数错误,idArr 不能为空')); + } + + $idArr = explode(',', $idArrStr); + + // 过滤非法ID + $idArr = array_filter($idArr, function ($id) { + return is_numeric($id); + }); + + if (empty($idArr)) { + $this->ajaxReturn(array('status' => 0, 'msg' => '参数错误,idArr 无有效 ID')); + } + + $where['id'] = array('in', $idArr); + + // 执行删除操作 + $result = M('fly_data')->where($where)->delete(); + + if ($result === false) { + $this->ajaxReturn(array('status' => 0, 'msg' => '删除失败')); + } + + $this->ajaxReturn(array('status' => 1, 'msg' => '删除成功', 'deleted_count' => $result)); + } /** * @description: 上传保存飞机飞行数据(从解锁到加锁) */