Compare commits
2 Commits
b4c48bbb89
...
bfadaeeb6e
Author | SHA1 | Date | |
---|---|---|---|
![]() |
bfadaeeb6e | ||
![]() |
6ed581436a |
@ -157,34 +157,32 @@ 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['shop_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;
|
||||
$msg = "已注销执行航线";
|
||||
} else {
|
||||
$data['runing'] = $_REQUEST['runing'];
|
||||
$msg = "已注册执行航线";
|
||||
} else {
|
||||
$msg = "已注销执行航线";
|
||||
}
|
||||
$data['runing'] = $_REQUEST['runing'];
|
||||
|
||||
if ($rsDb->where($where)->save($data)) {
|
||||
echo json_encode(array('status' => 1, 'msg' => $msg));
|
||||
|
Loading…
Reference in New Issue
Block a user