修复no_dup_code参数判断的代码逻辑处理

This commit is contained in:
wuyanwei
2022-08-12 13:02:54 +08:00
parent a5acd554ab
commit 78ecd669b3
2 changed files with 10 additions and 17 deletions

View File

@@ -32,20 +32,13 @@ class EDataCapture {
$this -> working_subclass = $working_subclass['working_subclass'];
}
if ($this -> no_dup_code) {
$res = pg_fetch_all(pg_query($this -> dbconn,
"SELECT code, type
FROM hf_mes_scada_data_capture_node_configure"
));
} else {
$res = pg_fetch_all(pg_query($this -> dbconn, sprintf(
"SELECT code, type
FROM hf_mes_scada_data_capture_node_configure
WHERE working_subclass = '%s'",
$this -> working_subclass
)));
}
$res = pg_fetch_all(pg_query($this -> dbconn, sprintf(
"SELECT code, type
FROM hf_mes_scada_data_capture_node_configure
WHERE working_subclass = '%s'",
$this -> working_subclass
)));
$code_type = &$this -> code_type;
array_walk($res, function(&$v, $k) use (&$code_type) {
$code_type[$v['code']] = $v['type'];

View File

@@ -16,15 +16,15 @@ class ENodeConfigure {
"SELECT EXISTS(
SELECT 1 FROM hf_mes_scada_data_capture_node_configure
WHERE code = '%s'
)", $this -> post -> code
AND working_subclass = '%s'
)", $this -> post -> code, $this -> post -> working_subclass
));
} else {
$exists = pg_query($this -> dbconn, sprintf(
"SELECT EXISTS(
SELECT 1 FROM hf_mes_scada_data_capture_node_configure
WHERE code = '%s'
AND working_subclass = '%s'
)", $this -> post -> code, $this -> post -> working_subclass
)", $this -> post -> code
));
}