Browse Source

no message

wzh 4 years ago
parent
commit
e476dea743

+ 1 - 7
sendCmd/cache.php

@@ -3,13 +3,7 @@
 require_once './DB.php';
 date_default_timezone_set('Asia/Shanghai');
 
-$config = [
-    'hostname' => 'rm-wz98r5cn33zq4ou980o.mysql.rds.aliyuncs.com',
-	'username' => 'lampmanager',
-	'password' => 'lampmanager@2019',
-	'dbname' => 'lampmanager',
-];
-
+$config = json_decode(file_get_contents('./db_config.php'),true);
 while (1) {
 	$db = new Db($config);
 	$sql = 'SELECT id FROM project';

+ 6 - 0
sendCmd/db_config.php

@@ -0,0 +1,6 @@
+{
+    "hostname":"rm-wz98r5cn33zq4ou980o.mysql.rds.aliyuncs.com",
+	"username":"idcol20",
+	"password":"idcol@1234",
+	"dbname":"idcol"
+}

+ 1 - 6
sendCmd/idcol_alarm_info_send.php

@@ -4,12 +4,7 @@ ini_set('display_errors', 1);
 require_once './DB.php';
 date_default_timezone_set('Asia/Shanghai');
 
-$config = [
-    'hostname' => 'rm-wz98r5cn33zq4ou980o.mysql.rds.aliyuncs.com',
-	'username' => 'idcol20',
-	'password' => 'idcol@1234',
-	'dbname' => 'idcol',
-];
+$config = json_decode(file_get_contents('./db_config.php'),true);
 
 // 发送邮件
 function send_email($to,$msg,$title = '维修通知'){

+ 1 - 6
sendCmd/idcol_online_alarm.php

@@ -4,12 +4,7 @@ ini_set('display_errors', 1);
 require_once './DB.php';
 date_default_timezone_set('Asia/Shanghai');
 
-$config = [
-    'hostname' => 'rm-wz98r5cn33zq4ou980o.mysql.rds.aliyuncs.com',
-	'username' => 'idcol20',
-	'password' => 'idcol@1234',
-	'dbname' => 'idcol',
-];
+$config = json_decode(file_get_contents('./db_config.php'),true);
 
 $begin = date('H:i',time());
 while (1) {

+ 2 - 6
sendCmd/idcol_sumData.php

@@ -3,12 +3,8 @@
 require_once './DB.php';
 date_default_timezone_set('Asia/Shanghai');
 
-$config = [
-    'hostname' => 'rm-wz98r5cn33zq4ou980o.mysql.rds.aliyuncs.com',
-	'username' => 'idcol20',
-	'password' => 'idcol@1234',
-	'dbname' => 'idcol',
-];
+$config = json_decode(file_get_contents('./db_config.php'),true);
+
 while (1) {
 	$db = new Db($config);
 	$t = date('H:i',time());

+ 2 - 6
sendCmd/totalLightTime.php

@@ -3,12 +3,8 @@
 require_once './DB.php';
 date_default_timezone_set('Asia/Shanghai');
 
-$config = [
-    'hostname' => 'rm-wz98r5cn33zq4ou980o.mysql.rds.aliyuncs.com',
-	'username' => 'lampmanager',
-	'password' => 'lampmanager@2019',
-	'dbname' => 'lampmanager',
-];
+$config = json_decode(file_get_contents('./db_config.php'),true);
+
 // $db = new Db($config);
 while (1) {
 	$db = new Db($config);

+ 1 - 6
sendCmd/xiuwenDataTest.php

@@ -3,12 +3,7 @@
 require_once './DB.php';
 date_default_timezone_set('Asia/Shanghai');
 
-$config = [
-    'hostname' => 'rm-wz98r5cn33zq4ou980o.mysql.rds.aliyuncs.com',
-	'username' => 'lampmanager',
-	'password' => 'lampmanager@2019',
-	'dbname' => 'lampmanager',
-];
+$config = json_decode(file_get_contents('./db_config.php'),true);
 
 $begin = date('H:i',time()-60);
 while (1) {

+ 6 - 0
websocket/db_config.php

@@ -0,0 +1,6 @@
+{
+    "hostname":"rm-wz98r5cn33zq4ou980o.mysql.rds.aliyuncs.com",
+	"username":"idcol20",
+	"password":"idcol@1234",
+	"dbname":"idcol"
+}

+ 3 - 1
websocket/idcolWss.php

@@ -17,7 +17,9 @@ $ws_worker->onWorkerStart = function($ws_worker)
     global $websocketDB;
     global $mqtt;
 
-    $websocketDB = new \Workerman\MySQL\Connection('rm-wz98r5cn33zq4ou980o.mysql.rds.aliyuncs.com', '3306', 'idcol20', 'idcol@1234', 'idcol');
+    $config = json_decode(file_get_contents('./db_config.php'),true);
+
+    $websocketDB = new \Workerman\MySQL\Connection($config['hostname'], '3306', $config['username'], $config['password'], $config['dbname']);
     global $devList;
     $devList = array();
     global $devUpdateList;

+ 5 - 1
websocket/policyCmd.php

@@ -81,7 +81,11 @@ $task->onWorkerStart = function($task)
 	$beginDate = date('H:i',time());
 
 	$mqttCmdList = array();
-    $websocketDB = new \Workerman\MySQL\Connection('rm-wz98r5cn33zq4ou980o.mysql.rds.aliyuncs.com', '3306', 'lampmanager', 'lampmanager@2019', 'lampmanager');
+
+    $config = json_decode(file_get_contents('./db_config.php'),true);
+
+    $websocketDB = new \Workerman\MySQL\Connection($config['hostname'], '3306', $config['username'], $config['password'], $config['dbname']);
+    
 
     Timer::add(1, function()
     {