完成除数据查询前端功能的EDataCapture开发
This commit is contained in:
@@ -2,7 +2,31 @@
|
||||
namespace EdgeManager\EDataCapture;
|
||||
|
||||
class EDataCapture {
|
||||
// 我不主张在构造函数内实现类型检查,因为在请求过于密集、记录较多时会严重影响性能
|
||||
// 请使用SCADA系统的开发人员自觉遵守文档内规范
|
||||
function __construct(
|
||||
protected $dbconn,
|
||||
protected $post = NULL,
|
||||
protected $get = NULL
|
||||
) {}
|
||||
|
||||
private function set_data() {
|
||||
|
||||
foreach (array_chunk($this -> post -> param, 6507524, true) as $chunk) {
|
||||
$sql_cmd[] = [sprintf(
|
||||
"INSERT INTO hf_mes_scada_data_capture_node_data_%s",
|
||||
$chunk[0] -> working_subclass
|
||||
)];
|
||||
foreach ($chunk as $row) {
|
||||
$sql_cmd[] = sprintf(
|
||||
"(code, v_%s, device_code, batch) VALUES('%s', %s, %s, %s)",
|
||||
$row -> type,
|
||||
$row -> code,
|
||||
$row -> value,
|
||||
$row -> device_code ?? NULL,
|
||||
$row -> batch ?? NULL
|
||||
);
|
||||
}
|
||||
return pg_query($this -> dbconn, implode(' ', $sql_cmd));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user