diff --git a/FlyCube/MpApi/Controller/PlaneController.class.php b/FlyCube/MpApi/Controller/PlaneController.class.php index 63d9640..baf2b5a 100644 --- a/FlyCube/MpApi/Controller/PlaneController.class.php +++ b/FlyCube/MpApi/Controller/PlaneController.class.php @@ -157,26 +157,29 @@ class PlaneController extends PublicController } } /** - * @description: 飞机在站点上注册航线 + * @description: 飞机在站点上注册航线 或 注销航线 */ public function lockSite() { //总管理员 可接收任何shop_id 非总管理员 只可以调用自身shop_id 否则会中断 $this->isPower(); - if ($_REQUEST['id'] && $_REQUEST['plane_id'] && $_REQUEST['runing']) { + if ($_REQUEST['id'] && $_REQUEST['runing']) { $rsDb = D('receive_site'); $where['id'] = $_REQUEST['id']; $where['shop_id'] = $_REQUEST['shop_id']; - //合法检查 - $rsCheck = $rsDb->where($where)->select(); - foreach ($rsCheck as $key => $value) { - $runingPlanes = explode(',', $value['runing']); - if (in_array($_REQUEST['plane_id'], $runingPlanes)) { - echo json_encode(array('status' => 0, 'msg' => '此飞机已经组测过航线了')); - exit; + //航线注册 合法检查 ps:注销跳过此步骤 + if ($_REQUEST['plane_id'] != "") { //注册航线调用接口时会传飞机id过来 + $rsCheck = $rsDb->where($where)->select(); + foreach ($rsCheck as $key => $value) { + $runingPlanes = explode(',', $value['runing']); + if (in_array($_REQUEST['plane_id'], $runingPlanes)) { + echo json_encode(array('status' => 0, 'msg' => '此飞机已经注册过航线了!')); + exit; + } } } + //注册航线 if ($_REQUEST['runing'] == "null") { $data['runing'] = null;