【类 型】:fix

【主	题】:添加站点 更新站点 修改
【描	述】:
	[原因]:添加站点默认添加runing默认值 更新站点如果有飞机在执行人谁则打断,顺利的话跟也更新runing字段默认值
	[过程]:
	[影响]:
【结	束】

# 类型 包含:
# feat:新功能(feature)
# fix:修补bug
# docs:文档(documentation)
# style: 格式(不影响代码运行的变动)
# refactor:重构(即不是新增功能,也不是修改bug的代码变动)
# test:增加测试
# chore:构建过程或辅助工具的变动
This commit is contained in:
tk 2024-07-08 20:09:31 +08:00
parent 518d8350c3
commit 559d6e06ca

View File

@ -197,6 +197,7 @@ class PlaneController extends PublicController
$data['sitename'] = $_REQUEST['sitename'];
if ($_REQUEST['bindroute']) {
$data['bind_route'] = $_REQUEST['bindroute'];
$data['runing'] = str_replace([' ', '\t', '\n', '\r', '\0', '\x0B'], ',', $_REQUEST['bindroute']); //初始化runing字段
} else {
$data['bind_route'] = null;
}
@ -250,6 +251,7 @@ class PlaneController extends PublicController
$data['sitename'] = $_REQUEST['sitename'];
if ($_REQUEST['bindroute']) {
$data['bind_route'] = $_REQUEST['bindroute'];
$data['runing'] = str_replace([' ', '\t', '\n', '\r', '\0', '\x0B'], ',', $_REQUEST['bindroute']); //初始化runing字段
} else {
$data['bind_route'] = null;
}
@ -261,6 +263,20 @@ class PlaneController extends PublicController
$id = $_REQUEST['id'];
$where['id'] = $id;
$where['shop_id'] = $_REQUEST['shop_id'];
//检查当前站点是否有飞机正在执行任务 有则打断 不进行更新
$field = array('runing');
$tempCheck = $rsDb->where($where)->field($field)->find();
if (!empty($tempCheck['runing'])) {
// 将 runing 字段的字符串按逗号分割成数组
$runingArray = explode(',', $tempCheck['runing']);
// 去除空元素和空格
$runingArray = array_map('trim', array_filter($runingArray));
// 检查数组是否有值
if (!empty($runingArray)) {
exit(json_encode(array('status' => 0, 'msg' => '此站点有飞机正在执行任务。待任务结束后再试!')));
}
}
// 更新站点
if ($rsDb->where($where)->save($data) || $_REQUEST['size']) {
//创建二维码
if ($token = $this->getAccessToken()) {