|
|
@@ -1,9 +1,11 @@
|
|
|
const axios = require('axios');
|
|
|
const http = require('http');
|
|
|
const { net } = require('electron');
|
|
|
-const { post } = require('./request')
|
|
|
+const { post, get: requestGet } = require('./request')
|
|
|
const { spawn, exec } = require('child_process');
|
|
|
//
|
|
|
+
|
|
|
+
|
|
|
const baseURL = 'http://localhost:5513/';
|
|
|
// 创建 Axios 实例
|
|
|
const service = axios.create({
|
|
|
@@ -133,36 +135,9 @@ module.exports = {
|
|
|
})
|
|
|
},
|
|
|
async minimizeSmartShooter(){
|
|
|
- try {
|
|
|
- // 使用 PowerShell 命令最小化 SmartShooter 窗口
|
|
|
- const command = `powershell -Command "Add-Type -TypeDefinition @'
|
|
|
-using System;
|
|
|
-using System.Runtime.InteropServices;
|
|
|
-public class Win32 {
|
|
|
- [DllImport(\\"user32.dll\\")]
|
|
|
- public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
|
|
|
- public const int SW_MINIMIZE = 6;
|
|
|
-}
|
|
|
-'@
|
|
|
-Get-Process | Where-Object { $_.MainWindowTitle -like '*SmartShooter*' -or $_.MainWindowTitle -like '*Smart Shooter*' } | ForEach-Object {
|
|
|
- [Win32]::ShowWindow($_.MainWindowHandle, [Win32]::SW_MINIMIZE) | Out-Null
|
|
|
-}"`;
|
|
|
-
|
|
|
- return new Promise((resolve, reject) => {
|
|
|
- exec(command, (error, stdout, stderr) => {
|
|
|
- if (error) {
|
|
|
- console.log('最小化SmartShooter失败:', error.message);
|
|
|
- resolve({ success: false, message: '最小化失败: ' + error.message });
|
|
|
- } else {
|
|
|
- console.log('SmartShooter窗口已最小化');
|
|
|
- resolve({ success: true, message: 'SmartShooter窗口已最小化' });
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
- } catch (error) {
|
|
|
- console.error('最小化SmartShooter失败:', error);
|
|
|
- return { success: false, message: '最小化失败: ' + error.message };
|
|
|
- }
|
|
|
+ return requestGet({
|
|
|
+ url: '/minimize_window?window_title=Smart%20Shoote',
|
|
|
+ })
|
|
|
},
|
|
|
async checkCamera(){
|
|
|
if(readConfigFile().controlType === 'digiCamControl'){
|