tongshanglei před 2 dny
rodič
revize
164c46c5b8

+ 43 - 2
config/database.php

@@ -24,11 +24,12 @@ return [
             // 服务器地址
             'hostname'          => Env::get('database.hostname', '127.0.0.1'),
             // 数据库名
-            'database'          => Env::get('database.database', ''),
+            'database'          => Env::get('database.database', 'uav'),
+
             // 用户名
             'username'          => Env::get('database.username', 'root'),
             // 密码
-            'password'          => Env::get('database.password', ''),
+            'password'          => Env::get('database.password', 'root'),
             // 端口
             'hostport'          => Env::get('database.hostport', '3306'),
             // 数据库连接参数
@@ -57,6 +58,46 @@ return [
             // 字段缓存路径
             'schema_cache_path' => app()->getRuntimePath() . 'schema' . DIRECTORY_SEPARATOR,
         ],
+        'uav' => [
+            // 数据库类型
+            'type'              => 'mysql',
+            // 服务器地址
+            'hostname'          => '192.168.1.203',
+            // 数据库名
+            'database'          => 'cloud_sample',
+
+            // 用户名
+            'username'          => 'root',
+            // 密码
+            'password'          => '000000',
+            // 端口
+            'hostport'          =>  '3306',
+            // 数据库连接参数
+            'params'            => [],
+            // 数据库编码默认采用utf8
+            'charset'           => 'utf8',
+            // 数据库表前缀
+            'prefix'            => '',
+
+            // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
+            'deploy'            => 0,
+            // 数据库读写是否分离 主从式有效
+            'rw_separate'       => false,
+            // 读写分离后 主服务器数量
+            'master_num'        => 1,
+            // 指定从服务器序号
+            'slave_no'          => '',
+            // 是否严格检查字段是否存在
+            'fields_strict'     => true,
+            // 是否需要断线重连
+            'break_reconnect'   => false,
+            // 监听SQL
+            'trigger_sql'       => true,
+            // 开启字段缓存
+            'fields_cache'      => false,
+            // 字段缓存路径
+            'schema_cache_path' => app()->getRuntimePath() . 'schema' . DIRECTORY_SEPARATOR,
+        ],
 
         // 更多的数据库配置信息
     ],

+ 1 - 1
task_script/LIVESTOCK_MQTT_CLIENT.php

@@ -214,7 +214,7 @@ function loop()
 
     $server   = '116.62.220.88';
     $port     = 1883;
-    $clientId = 'local_mqtt_livestock_cli_202502101';
+    $clientId = 'local_mqtt_livestock_cli_202504101';
     $username = 'rl517';
     $password = "rlian2022";
 

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 10 - 11
task_script/OSD_DOCK_CLIENT.php


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 10 - 13
task_script/OSD_DRONE_CLIENT.php


+ 37 - 0
task_script/a.php

@@ -0,0 +1,37 @@
+<?php
+function uMayGet($url, $params = [], $field = 'x-access-token', $token = 'jblZHVu7QXS2CbtmkkZQzwL9HO61gOF1')
+{
+    $curl = curl_init();
+    //将参数params转成url参数
+    $params = http_build_query($params);
+    $url .= '?' . $params;
+    curl_setopt_array($curl, [
+        CURLOPT_URL =>  $url,
+        CURLOPT_RETURNTRANSFER => true,
+        CURLOPT_ENCODING => "",
+        CURLOPT_MAXREDIRS => 10,
+        CURLOPT_CONNECTTIMEOUT => 5,  // 连接超时时间(秒)
+        CURLOPT_TIMEOUT => 5,
+        CURLOPT_SSL_VERIFYPEER => false,  // 禁用 SSL 验证
+        CURLOPT_SSL_VERIFYHOST => false,  // 禁用 SSL 验证
+        CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
+        CURLOPT_CUSTOMREQUEST => "GET",
+        CURLOPT_POSTFIELDS => "",
+        CURLOPT_HTTPHEADER => [
+            "$field: $token"
+        ],
+    ]);
+
+    $response = curl_exec($curl);
+    var_dump($response);
+    $err = curl_error($curl);
+
+    curl_close($curl);
+
+    if ($err) {
+        echo "cURL Error #:" . $err;
+    }
+    return json_decode($response, true);
+}
+
+uMayGet('https://sports.umaysports.cn/api/receive/setting?umay_match_id=250318UO6A&_mall_id=1');

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 2 - 1
task_script/test.php


+ 85 - 0
task_script/test2.php

@@ -0,0 +1,85 @@
+<?php
+require('../vendor/autoload.php');
+// 定义要查询的目录路径
+$directoryPath = 'F:\声音文件\bark sound\UrbanSound8K_Expand_verison\UrbanSound8K_Expand_verison\audio';
+// 定义分类的目标目录路径
+$categoryDir = 'F:\声音文件\bark sound\category_new';
+
+
+// 确保目标目录存在
+if (!file_exists($categoryDir)) {
+    mkdir($categoryDir, 0777, true);
+}
+
+
+// 递归函数,用于遍历文件夹并处理文件
+function processDirectory($dir) {
+    global $categoryDir;
+
+    // 打开目录
+    if ($handle = opendir($dir)) {
+        
+        // 读取目录中的文件
+        while (false !== ($entry = readdir($handle))) {
+            
+            // 排除 "." 和 ".."
+            if ($entry == "." || $entry == "..") {
+                continue;
+            }
+
+            // 获取文件或目录的完整路径
+            $filePath = $dir . DIRECTORY_SEPARATOR . $entry;
+          
+            // 如果是文件,则进行分类处理
+            if (is_file($filePath)) {
+                $fileInfo = pathinfo($filePath);
+                 
+                $parts = explode('-', $fileInfo['filename']);
+
+            // 获取第二个下标的元素并判断是否在 1 到 9 之间
+            if (isset($parts[1]) && is_numeric($parts[1]) && $parts[1] >= 0 && $parts[1] <= 9) {
+                $type_arr=[
+                    0 => 'air_conditioner',
+                    1 => 'car_horn',
+                    2 => 'children_playing',
+                    3 => 'dog_bark',
+                    4 => 'drilling',
+                    5 => 'engine_idling',
+                    6 => 'gun_shot',
+                    7 => 'jackhammer',
+                    8 => 'siren',
+                    9 => 'street_music'
+                ];
+              
+                $path=$categoryDir. DIRECTORY_SEPARATOR. $type_arr[$parts[1]].'\\';
+                if (!file_exists($path)) {
+                    mkdir($path, 0777, true);
+                }
+                 var_dump($filePath);
+                 var_dump($path);
+                 var_dump($fileInfo['filename']);
+           
+    
+                // 复制文件到目标目录
+                copy($filePath, $path.DIRECTORY_SEPARATOR.$fileInfo['basename']);
+            } else {
+                
+            }
+
+            }
+
+            // 如果是目录,则递归处理该目录
+            if (is_dir($filePath)) {
+                processDirectory($filePath);  // 递归调用
+            }
+        }
+
+        // 关闭目录
+        closedir($handle);
+    } else {
+        echo "无法打开目录 $dir!";
+    }
+}
+
+// 开始处理根目录
+processDirectory($directoryPath);

+ 66 - 0
task_script/test3.php

@@ -0,0 +1,66 @@
+<?php
+require('../vendor/autoload.php');
+// 设置接口路径
+$api_url = 'http://58.213.156.66/qjpt/f/interactive/dealRfidData';
+
+$data = [
+    "data" => [
+        [
+            "rfid" => "000001004968",
+            "location" => "01393A3173657005",
+            "volt" => "0"
+        ]
+    ]
+];
+//{"data":[{"rfid":"000001004968","location":"01393A3173657005","volt":"0"}]}
+// 1. 将数据转换为 JSON 格式并进行 Base64 编码
+$json_data = json_encode($data);
+var_dump($json_data);
+$base64_data = base64_encode($json_data);
+
+// 2. 设置 POST 请求数据
+$post_data = [
+    'data' => $base64_data
+];
+
+$curl = curl_init();
+
+curl_setopt_array($curl, array(
+  CURLOPT_URL => $api_url,
+  CURLOPT_RETURNTRANSFER => true,
+  CURLOPT_ENCODING => '',
+  CURLOPT_MAXREDIRS => 10,
+  CURLOPT_TIMEOUT => 0,
+  CURLOPT_FOLLOWLOCATION => true,
+  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
+  CURLOPT_CUSTOMREQUEST => 'POST',
+  CURLOPT_POSTFIELDS =>$base64_data,
+  CURLOPT_HTTPHEADER => array(
+    'Content-Type: text/plain'
+  ),
+));
+// 3. 接口返回的数据
+$response = curl_exec($curl);
+
+curl_close($curl);
+var_dump($response);
+
+
+// 4. AES 解密函数
+function aes_decrypt($data, $key) {
+    $decrypted_data = openssl_decrypt(base64_decode($data), 'AES-128-ECB', $key, OPENSSL_RAW_DATA);
+    return $decrypted_data;
+}
+// 5. 返回数据处理 AES 解密
+// 解密密码
+$password = 'njmind.comnjsjly';
+$decrypted_response = aes_decrypt($response, $password);
+
+$base64_decrypted_data = base64_decode($decrypted_response);
+
+$final_response = json_decode($base64_decrypted_data, true);
+
+// 6. 输出解密后的结果
+var_dump($final_response);
+
+