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: 上传保存飞机飞行数据(从解锁到加锁) */