Compare commits

..

2 Commits

Author SHA1 Message Date
tk
bfadaeeb6e 【类 型】:style
【主	题】:注释 提示信息
【描	述】:
	[原因]:
	[过程]:
	[影响]:
【结	束】

# 类型 包含:
# feat:新功能(feature)
# fix:修补bug
# docs:文档(documentation)
# style: 格式(不影响代码运行的变动)
# refactor:重构(即不是新增功能,也不是修改bug的代码变动)
# test:增加测试
# chore:构建过程或辅助工具的变动
2024-07-11 19:41:53 +08:00
tk
6ed581436a 【类 型】:fix
【主	题】:注销 注册航线接口
【描	述】:
	[原因]:由于注销 注册公用接口 注销时也检测飞机id的话是肯定存在的 所以不用检测
	[过程]:判断 注销调用接口是 飞机传id为空 检测空就跳过不检测
	[影响]:
【结	束】

# 类型 包含:
# feat:新功能(feature)
# fix:修补bug
# docs:文档(documentation)
# style: 格式(不影响代码运行的变动)
# refactor:重构(即不是新增功能,也不是修改bug的代码变动)
# test:增加测试
# chore:构建过程或辅助工具的变动
2024-07-11 19:33:41 +08:00

View File

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