Compare commits

..

No commits in common. "17db93bd7df209f64d6ceb22f6cd51770c1559cb" and "d116630a240fc3b73f0d0965a8304f4e20b61ed4" have entirely different histories.

View File

@ -1023,7 +1023,9 @@ class PlaneController extends PublicController
} }
} }
/** /**
* @description: 删除指定的飞行数据记录 * 删除指定的飞行数据记录
* @param string idArr 以逗号分隔的ID字符串
* @return json
*/ */
public function deleteFlyDataByIdArr() public function deleteFlyDataByIdArr()
{ {
@ -1035,8 +1037,7 @@ class PlaneController extends PublicController
$idArrStr = I('post.idArr', '', 'trim'); $idArrStr = I('post.idArr', '', 'trim');
if (empty($idArrStr)) { if (empty($idArrStr)) {
echo json_encode(array('status' => 0, 'msg' => '参数错误idArr 不能为空')); $this->ajaxReturn(array('status' => 0, 'msg' => '参数错误idArr 不能为空'));
exit;
} }
$idArr = explode(',', $idArrStr); $idArr = explode(',', $idArrStr);
@ -1047,19 +1048,19 @@ class PlaneController extends PublicController
}); });
if (empty($idArr)) { if (empty($idArr)) {
echo json_encode(array('status' => 0, 'msg' => '参数错误idArr 无有效 ID')); $this->ajaxReturn(array('status' => 0, 'msg' => '参数错误idArr 无有效 ID'));
exit;
} }
$where['id'] = array('in', $idArr); $where['id'] = array('in', $idArr);
// 执行删除操作 // 执行删除操作
$flight_logDb = D('flight_log'); $result = M('flight_log')->where($where)->delete();
if ($total = $flight_logDb->where($where)->delete()) {
echo json_encode(array('status' => 1, 'msg' => '删除成功', 'total' => $total)); if ($result === false) {
} else { $this->ajaxReturn(array('status' => 0, 'msg' => '删除失败'));
echo json_encode(array('status' => 0, 'msg' => '删除失败'));
} }
$this->ajaxReturn(array('status' => 1, 'msg' => '删除成功', 'deleted_count' => $result));
} }
/** /**
* @description: 上传保存飞机飞行数据(从解锁到加锁) * @description: 上传保存飞机飞行数据(从解锁到加锁)