Procházet zdrojové kódy

部署工具调整

fly před 1 rokem
rodič
revize
6d575a3866

+ 492 - 37
Tools/Flyinsono.Deployment/lib/PublishProcessView.dart

@@ -1,6 +1,9 @@
+import 'dart:io';
 import 'package:flutter/material.dart';
 import 'dart:async';
 import 'Services/PublishService.dart';
+import 'package:flutter_gen/gen_l10n/app_localizations.dart';
+import 'package:file_picker/file_picker.dart';
 
 class PublishProcessView extends StatefulWidget {
   @override
@@ -13,19 +16,40 @@ class _PublishProcessViewState extends State<PublishProcessView> {
   final PublishService _publishService = PublishService();
   Timer? _timer;
   final Duration _pollingInterval = Duration(seconds: 2);
-  // 默认D盘
   String installDirectory = "D:/WingServer";
+  final TextEditingController _directoryController = TextEditingController();
   String domain = "";
   String ipAddress = ""; // 您应该自动获取并填写 IP 地址
+  String emailAccount = '';
+  String emailPassword = '';
+  String emailServer = '';
+  int smtpPort = 0;
+  bool enableSSL = true;
+//高级设置
+  bool showAdvancedSettings = false;
+  bool isDistributed = false;
+  bool isMasterServer = true;
+  String? masterServerAddress;
+  String? serverID;
+  bool isRemoteDeployable = false;
+  bool hasWingAIDiagnosisService = false;
+  bool hasWingRtcService = false;
+  bool hasWingLiveConsultationService = false;
+  bool hasWingASRService = false;
+  bool hasWingPaymentService = false;
+  bool hasWingLabService = false;
+  bool hasWingEducationService = false;
+
   @override
   void initState() {
     super.initState();
+    _directoryController.text = installDirectory ?? '';
     _fetchIpAddress();
   }
 
   Future<void> _startDeployment() async {
     setState(() {
-      _deployMessage="start deployment...";
+      _deployMessage = "start deployment...";
       _isDeploying = true;
     });
 
@@ -43,8 +67,28 @@ class _PublishProcessViewState extends State<PublishProcessView> {
         });
       }
     });
-    _publishService.deployProcess(installDirectory,ipAddress);
-     
+    _publishService.deployProcess(
+      installDirectory,
+      ipAddress,
+      domain,
+      emailAccount,
+      emailPassword,
+      emailServer,
+      smtpPort,
+      enableSSL,
+      isDistributed,
+      isMasterServer,
+      masterServerAddress ?? "",
+      serverID ?? "",
+      isRemoteDeployable,
+      hasWingAIDiagnosisService,
+      hasWingRtcService,
+      hasWingLiveConsultationService,
+      hasWingASRService,
+      hasWingPaymentService,
+      hasWingLabService,
+      hasWingEducationService,
+    );
   }
 
   @override
@@ -70,57 +114,468 @@ class _PublishProcessViewState extends State<PublishProcessView> {
             child: Column(
               crossAxisAlignment: CrossAxisAlignment.start,
               children: [
-                Text('基本设置',
+                Text(AppLocalizations.of(context)!.basicSettings,
                     style:
                         TextStyle(fontSize: 20, fontWeight: FontWeight.bold)),
                 SizedBox(height: 8),
-                TextFormField(
-                  initialValue: installDirectory,
-                  decoration: InputDecoration(
-                    labelText: '安装目录',
-                    hintText: '默认为 D 盘',
-                  ),
-                  onChanged: (value) {
-                    setState(() {
-                      installDirectory = value;
-                    });
-                  },
+                Row(
+                  children: [
+                    Expanded(
+                      flex: 1,
+                      child: TextFormField(
+                        controller: _directoryController,
+                        decoration: InputDecoration(
+                          labelText:
+                              AppLocalizations.of(context)!.installDirectory,
+                          hintText: AppLocalizations.of(context)!.defaultD,
+                          border: OutlineInputBorder(
+                            borderSide: BorderSide(
+                              color: Colors.grey.withOpacity(0.5),
+                              width: 1,
+                            ),
+                          ),
+                          enabledBorder: OutlineInputBorder(
+                            borderSide: BorderSide(
+                              color: Colors.grey.withOpacity(0.5),
+                              width: 1,
+                            ),
+                          ),
+                          focusedBorder: OutlineInputBorder(
+                            borderSide: BorderSide(
+                              color: Colors.blue.withOpacity(0.5),
+                              width: 2,
+                            ),
+                          ),
+                        ),
+                        onChanged: (value) {
+                          setState(() {
+                            installDirectory = value;
+                          });
+                        },
+                      ),
+                    ),
+                    IconButton(
+                      icon: Icon(Icons.folder_open),
+                      onPressed: () async {
+                        String? directory =
+                            await FilePicker.platform.getDirectoryPath();
+                        if (directory != null) {
+                          setState(() {
+                            installDirectory = directory;
+                            _directoryController.text = directory;
+                          });
+                        }
+                      },
+                    ),
+                  ],
                 ),
                 SizedBox(height: 8),
-                TextFormField(
-                  decoration: InputDecoration(
-                    labelText: '域名',
-                    hintText: '非必填',
-                  ),
+                Row(
+                  children: [
+                    Expanded(
+                      child: TextFormField(
+                        decoration: InputDecoration(
+                          labelText: AppLocalizations.of(context)!.domain,
+                          hintText: AppLocalizations.of(context)!.notRequired,
+                          border: OutlineInputBorder(
+                            borderSide: BorderSide(
+                              color: Colors.grey.withOpacity(0.5),
+                              width: 1,
+                            ),
+                          ),
+                          enabledBorder: OutlineInputBorder(
+                            borderSide: BorderSide(
+                              color: Colors.grey.withOpacity(0.5),
+                              width: 1,
+                            ),
+                          ),
+                          focusedBorder: OutlineInputBorder(
+                            borderSide: BorderSide(
+                              color: Colors.blue.withOpacity(0.5),
+                              width: 2,
+                            ),
+                          ),
+                        ),
+                        onChanged: (value) {
+                          setState(() {
+                            domain = value;
+                          });
+                        },
+                      ),
+                    ),
+                  ],
+                ),
+                SizedBox(height: 8),
+                Row(
+                  children: [
+                    Expanded(
+                      child: TextFormField(
+                        controller: TextEditingController(text: ipAddress),
+                        decoration: InputDecoration(
+                          labelText: 'IP',
+                          hintText: AppLocalizations.of(context)!.ipAuto,
+                          border: OutlineInputBorder(
+                            borderSide: BorderSide(
+                              color: Colors.grey.withOpacity(0.5),
+                              width: 1,
+                            ),
+                          ),
+                          enabledBorder: OutlineInputBorder(
+                            borderSide: BorderSide(
+                              color: Colors.grey.withOpacity(0.5),
+                              width: 1,
+                            ),
+                          ),
+                          focusedBorder: OutlineInputBorder(
+                            borderSide: BorderSide(
+                              color: Colors.blue.withOpacity(0.5),
+                              width: 2,
+                            ),
+                          ),
+                        ),
+                      ),
+                    ),
+                  ],
+                ),
+                SizedBox(height: 8),
+                Row(
+                  children: [
+                    Expanded(
+                      child: TextFormField(
+                        decoration: InputDecoration(
+                          labelText: 'Email Account',
+                          border: OutlineInputBorder(
+                            borderSide: BorderSide(
+                              color: Colors.grey.withOpacity(0.5),
+                              width: 1,
+                            ),
+                          ),
+                          enabledBorder: OutlineInputBorder(
+                            borderSide: BorderSide(
+                              color: Colors.grey.withOpacity(0.5),
+                              width: 1,
+                            ),
+                          ),
+                          focusedBorder: OutlineInputBorder(
+                            borderSide: BorderSide(
+                              color: Colors.blue.withOpacity(0.5),
+                              width: 2,
+                            ),
+                          ),
+                        ),
+                        onChanged: (value) {
+                          setState(() {
+                            emailAccount = value;
+                          });
+                        },
+                      ),
+                    ),
+                  ],
+                ),
+                SizedBox(height: 8),
+                Row(
+                  children: [
+                    Expanded(
+                      child: TextFormField(
+                        decoration: InputDecoration(
+                          labelText: 'Email Password',
+                          border: OutlineInputBorder(
+                            borderSide: BorderSide(
+                              color: Colors.grey.withOpacity(0.5),
+                              width: 1,
+                            ),
+                          ),
+                          enabledBorder: OutlineInputBorder(
+                            borderSide: BorderSide(
+                              color: Colors.grey.withOpacity(0.5),
+                              width: 1,
+                            ),
+                          ),
+                          focusedBorder: OutlineInputBorder(
+                            borderSide: BorderSide(
+                              color: Colors.blue.withOpacity(0.5),
+                              width: 2,
+                            ),
+                          ),
+                        ),
+                        onChanged: (value) {
+                          setState(() {
+                            emailPassword = value;
+                          });
+                        },
+                      ),
+                    ),
+                  ],
+                ),
+                SizedBox(height: 8),
+                Row(
+                  children: [
+                    Expanded(
+                      child: TextFormField(
+                        decoration: InputDecoration(
+                          labelText: 'Email Server',
+                          border: OutlineInputBorder(
+                            borderSide: BorderSide(
+                              color: Colors.grey.withOpacity(0.5),
+                              width: 1,
+                            ),
+                          ),
+                          enabledBorder: OutlineInputBorder(
+                            borderSide: BorderSide(
+                              color: Colors.grey.withOpacity(0.5),
+                              width: 1,
+                            ),
+                          ),
+                          focusedBorder: OutlineInputBorder(
+                            borderSide: BorderSide(
+                              color: Colors.blue.withOpacity(0.5),
+                              width: 2,
+                            ),
+                          ),
+                        ),
+                        onChanged: (value) {
+                          setState(() {
+                            emailServer = value;
+                          });
+                        },
+                      ),
+                    ),
+                  ],
+                ),
+                SizedBox(height: 8),
+                Row(
+                  children: [
+                    Expanded(
+                      child: TextFormField(
+                        keyboardType: TextInputType.number,
+                        decoration: InputDecoration(
+                          labelText: 'SMTP Port',
+                          border: OutlineInputBorder(
+                            borderSide: BorderSide(
+                              color: Colors.grey.withOpacity(0.5),
+                              width: 1,
+                            ),
+                          ),
+                          enabledBorder: OutlineInputBorder(
+                            borderSide: BorderSide(
+                              color: Colors.grey.withOpacity(0.5),
+                              width: 1,
+                            ),
+                          ),
+                          focusedBorder: OutlineInputBorder(
+                            borderSide: BorderSide(
+                              color: Colors.blue.withOpacity(0.5),
+                              width: 2,
+                            ),
+                          ),
+                        ),
+                        onChanged: (value) {
+                          setState(() {
+                            smtpPort = int.tryParse(value) ?? 0;
+                          });
+                        },
+                      ),
+                    ),
+                  ],
+                ),
+                SizedBox(height: 8),
+                SwitchListTile(
+                  title: Text('Enable SSL'),
+                  value: enableSSL,
                   onChanged: (value) {
                     setState(() {
-                      domain = value;
+                      enableSSL = value;
                     });
                   },
                 ),
-                SizedBox(height: 8),
-                TextFormField(
-                  controller: TextEditingController(text: ipAddress),
-                  decoration: InputDecoration(
-                    labelText: 'IP地址',
-                    hintText: 'IP地址将自动获取并填写',
-                  ),
-                ),
                 SizedBox(height: 16),
-                Text('高级设置',
-                    style:
-                        TextStyle(fontSize: 20, fontWeight: FontWeight.bold)),
-                SizedBox(height: 8),
-                // 在此处添加您的高级设置组件
+                //高级设置
+                Row(
+                  children: [
+                    Text(AppLocalizations.of(context)!.advancedSetting,
+                        style: TextStyle(
+                            fontSize: 20, fontWeight: FontWeight.bold)),
+                    Checkbox(
+                      value: showAdvancedSettings,
+                      onChanged: (value) {
+                        setState(() {
+                          showAdvancedSettings = value!;
+                        });
+                      },
+                    ),
+                  ],
+                ),
+                if (showAdvancedSettings) ...[
+                  SizedBox(height: 8),
+                  CheckboxListTile(
+                    title:
+                        Text(AppLocalizations.of(context)!.isRemoteDeployable),
+                    value: isRemoteDeployable,
+                    onChanged: (value) {
+                      setState(() {
+                        isRemoteDeployable = value!;
+                      });
+                    },
+                  ),
+                  CheckboxListTile(
+                    title: Text(
+                        AppLocalizations.of(context)!.wingAIDiagnosisService),
+                    value: hasWingAIDiagnosisService,
+                    onChanged: (value) {
+                      setState(() {
+                        hasWingAIDiagnosisService = value!;
+                      });
+                    },
+                  ),
+                  CheckboxListTile(
+                    title: Text(AppLocalizations.of(context)!.wingRtcService),
+                    value: hasWingRtcService,
+                    onChanged: (value) {
+                      setState(() {
+                        hasWingRtcService = value!;
+                      });
+                    },
+                  ),
+                  CheckboxListTile(
+                    title: Text(AppLocalizations.of(context)!
+                        .wingLiveConsultationService),
+                    value: hasWingLiveConsultationService,
+                    onChanged: (value) {
+                      setState(() {
+                        hasWingLiveConsultationService = value!;
+                      });
+                    },
+                  ),
+                  CheckboxListTile(
+                    title: Text(AppLocalizations.of(context)!.wingASRService),
+                    value: hasWingASRService,
+                    onChanged: (value) {
+                      setState(() {
+                        hasWingASRService = value!;
+                      });
+                    },
+                  ),
+                  CheckboxListTile(
+                    title:
+                        Text(AppLocalizations.of(context)!.wingPaymentService),
+                    value: hasWingPaymentService,
+                    onChanged: (value) {
+                      setState(() {
+                        hasWingPaymentService = value!;
+                      });
+                    },
+                  ),
+                  CheckboxListTile(
+                    title: Text(AppLocalizations.of(context)!.wingLabService),
+                    value: hasWingLabService,
+                    onChanged: (value) {
+                      setState(() {
+                        hasWingLabService = value!;
+                      });
+                    },
+                  ),
+                  CheckboxListTile(
+                    title: Text(
+                        AppLocalizations.of(context)!.wingEducationService),
+                    value: hasWingEducationService,
+                    onChanged: (value) {
+                      setState(() {
+                        hasWingEducationService = value!;
+                      });
+                    },
+                  ),
+                  CheckboxListTile(
+                    title: Text(AppLocalizations.of(context)!.isDistributed),
+                    value: isDistributed,
+                    onChanged: (value) {
+                      setState(() {
+                        isDistributed = value!;
+                      });
+                    },
+                  ),
+                  CheckboxListTile(
+                    title: Text(AppLocalizations.of(context)!.isMasterServer),
+                    value: isMasterServer,
+                    onChanged: (value) {
+                      setState(() {
+                        isMasterServer = value!;
+                      });
+                    },
+                  ),
+                  if (!isMasterServer) ...[
+                    SizedBox(height: 8),
+                    TextFormField(
+                      initialValue: masterServerAddress,
+                      decoration: InputDecoration(
+                        labelText:
+                            AppLocalizations.of(context)!.masterServerAddress,
+                        border: OutlineInputBorder(
+                          borderSide: BorderSide(
+                            color: Colors.grey.withOpacity(0.5),
+                            width: 1,
+                          ),
+                        ),
+                        enabledBorder: OutlineInputBorder(
+                          borderSide: BorderSide(
+                            color: Colors.grey.withOpacity(0.5),
+                            width: 1,
+                          ),
+                        ),
+                        focusedBorder: OutlineInputBorder(
+                          borderSide: BorderSide(
+                            color: Colors.blue.withOpacity(0.5),
+                            width: 2,
+                          ),
+                        ),
+                      ),
+                      onChanged: (value) {
+                        setState(() {
+                          masterServerAddress = value;
+                        });
+                      },
+                    ),
+                  ],
+                  SizedBox(height: 8),
+                  TextFormField(
+                    initialValue: serverID,
+                    decoration: InputDecoration(
+                      labelText: AppLocalizations.of(context)!.serverID,
+                      border: OutlineInputBorder(
+                        borderSide: BorderSide(
+                          color: Colors.grey.withOpacity(0.5),
+                          width: 1,
+                        ),
+                      ),
+                      enabledBorder: OutlineInputBorder(
+                        borderSide: BorderSide(
+                          color: Colors.grey.withOpacity(0.5),
+                          width: 1,
+                        ),
+                      ),
+                      focusedBorder: OutlineInputBorder(
+                        borderSide: BorderSide(
+                          color: Colors.blue.withOpacity(0.5),
+                          width: 2,
+                        ),
+                      ),
+                    ),
+                    onChanged: (value) {
+                      setState(() {
+                        serverID = value;
+                      });
+                    },
+                  ),
+                  SizedBox(height: 35),
+                ],
               ],
             ),
           ),
           Positioned(
-            bottom: MediaQuery.of(context).padding.bottom + 16,
+            bottom: MediaQuery.of(context).padding.bottom + 6,
             right: MediaQuery.of(context).padding.right + 16,
             child: ElevatedButton(
               onPressed: _isDeploying ? null : () => _startDeployment(),
-              child: Text('开始部署'),
+              child: Text(AppLocalizations.of(context)!.startDeployment),
             ),
           ),
           if (_isDeploying)

+ 253 - 33
Tools/Flyinsono.Deployment/lib/Services/PublishService.dart

@@ -20,8 +20,32 @@ import 'PackageService.dart';
 
 class PublishService {
   String _deployInfo = "start...";
+
   String _installDirectory = "";
+
   String _ipAddress = "";
+  String _domain = "";
+
+  String _emailAccount = '';
+  String _emailPassword = '';
+  String _emailServer = '';
+  int _smtpPort = 0;
+  bool _enableSSL = false;
+
+  bool _isDistributed = false;
+  bool _isMasterServer = false;
+  String _masterServerAddress = "";
+  String _serverID = "";
+
+  bool _hasWingAIDiagnosisService = false;
+  bool _hasWingRtcService = false;
+  bool _hasWingLiveConsultationService = false;
+  bool _hasWingASRService = false;
+  bool _hasWingPaymentService = false;
+  bool _hasWingLabService = false;
+  bool _hasWingEducationService = false;
+
+  bool _isRemoteDeployable = false;
 
   Future<String?> getLocalIPv4Address() async {
     try {
@@ -45,9 +69,48 @@ class PublishService {
   }
 
   //独立部署工具部署
-  Future<bool> deployProcess(String installDirectory, String ipAddress) async {
+  Future<bool> deployProcess(
+      String installDirectory,
+      String ipAddress,
+      String domain,
+      String emailAccount,
+      String emailPassword,
+      String emailServer,
+      int smtpPort,
+      bool enableSSL,
+      bool isDistributed,
+      bool isMasterServer,
+      String masterServerAddress,
+      String serverID,
+      bool isRemoteDeployable,
+      bool hasWingAIDiagnosisService,
+      bool hasWingRtcService,
+      bool hasWingLiveConsultationService,
+      bool hasWingASRService,
+      bool hasWingPaymentService,
+      bool hasWingLabService,
+      bool hasWingEducationService) async {
     _installDirectory = installDirectory;
     _ipAddress = ipAddress;
+    _domain = domain;
+    _emailAccount = emailAccount;
+    _emailPassword = emailPassword;
+    _emailServer = emailServer;
+    _smtpPort = smtpPort;
+    _enableSSL = enableSSL;
+    _isDistributed = isDistributed;
+    _isMasterServer = isMasterServer;
+    _masterServerAddress = masterServerAddress;
+    _serverID = serverID;
+    _isRemoteDeployable = isRemoteDeployable;
+
+    _hasWingAIDiagnosisService = hasWingAIDiagnosisService;
+    _hasWingRtcService = hasWingRtcService;
+    _hasWingLiveConsultationService = hasWingLiveConsultationService;
+    _hasWingASRService = hasWingASRService;
+    _hasWingPaymentService = hasWingPaymentService;
+    _hasWingLabService = hasWingLabService;
+    _hasWingEducationService = hasWingEducationService;
     var isNeedUpdateServer = false;
     String basePath = getBasePath();
     String deployPackageDir = '$basePath/DeployPackage';
@@ -76,7 +139,7 @@ class PublishService {
           await copyWingServerContent();
           //启动
           _deployInfo = "try start server...";
-          await runStartBat();
+          runStartBat();
           await checkStartStatus();
           _deployInfo = "upload files...";
           //上传更新文件
@@ -85,13 +148,13 @@ class PublishService {
           _deployInfo = "update config...";
           await updateAppSettings(uploadResult);
           await terminateWingCloudServer();
-          await runStartBat();
+          runStartBat();
         } else {
           //修改配置
           _deployInfo = "update config...";
           await updateAppSettings(null);
           await terminateWingCloudServer();
-          await runStartBat();
+          runStartBat();
         }
         break;
       } catch (e) {
@@ -241,18 +304,161 @@ class PublishService {
           String oldJsonString = await oldAppSettingsFile.readAsString();
           Map<String, dynamic> oldJsonMap = jsonDecode(oldJsonString);
 
-          //修改"Gateway"下面的"Host"节点
-          if (oldJsonMap.containsKey('Gateway')) {
-            Map<String, dynamic> gatewayMap = oldJsonMap['Gateway'];
-            if (gatewayMap.containsKey('Host')) {
-              if (copyType == 1) {
+          //deploy server
+          if (copyType == 2) {
+            if (oldJsonMap.containsKey('Gateway')) {
+              Map<String, dynamic> gatewayMap = oldJsonMap['Gateway'];
+              if (gatewayMap.containsKey('Host')) {
+                gatewayMap['Host'] = "http://" + _ipAddress + ":8305/";
+              }
+            }
+          }
+          //wingserver
+          else if (copyType == 1) {
+            if (oldJsonMap.containsKey('Gateway')) {
+              Map<String, dynamic> gatewayMap = oldJsonMap['Gateway'];
+              if (gatewayMap.containsKey('Host')) {
                 gatewayMap['Host'] =
                     "http://" + _ipAddress + ":8303/"; //todo 协议
-              } else {
-                gatewayMap['Host'] = "http://" + _ipAddress + ":8305/";
               }
+              if (gatewayMap.containsKey('Domains')) {
+                gatewayMap['Domains'] =
+                    _domain == "" ? gatewayMap['Host'] : _domain;
+              }
+            }
+            if (oldJsonMap.containsKey("General")) {
+              Map<String, dynamic> generalMap = oldJsonMap['General'];
+              if (generalMap.containsKey('IsDistributed')) {
+                generalMap['IsDistributed'] = _isDistributed;
+              }
+              if (generalMap.containsKey('IsMaster')) {
+                generalMap['IsMaster'] = _isMasterServer;
+              }
+              if (generalMap.containsKey('MasterUrl') &&
+                  _masterServerAddress != "") {
+                generalMap['MasterUrl'] = _masterServerAddress;
+              }
+              if (generalMap.containsKey('ServerID') && _serverID != "") {
+                generalMap['ServerID'] = _serverID;
+              }
+            }
+            if (oldJsonMap.containsKey("Email")) {
+              Map<String, dynamic> emailMap = oldJsonMap['Email'];
+              if (emailMap.containsKey('EmailUserName') &&
+                  _emailAccount != "") {
+                emailMap['EmailUserName'] = _emailAccount;
+              }
+              if (emailMap.containsKey('EmailUserPassword') &&
+                  _emailPassword != "") {
+                emailMap['EmailUserPassword'] = _emailPassword;
+              }
+              if (emailMap.containsKey('MailHost') && _emailServer != "") {
+                emailMap['MailHost'] = _emailServer;
+              }
+              if (emailMap.containsKey('SmtpPort') && _smtpPort != "") {
+                emailMap['SmtpPort'] = _smtpPort;
+              }
+              if (emailMap.containsKey('UseSSL')) {
+                emailMap['UseSSL'] = _enableSSL;
+              }
+            }
+            if (oldJsonMap.containsKey("Services")) {
+              Map<String, dynamic> servicesMap = oldJsonMap['Services'];
+              var inProcess = servicesMap["InProcess"].toString();
+              var jsonRpcHttp = servicesMap["JsonRpcHttp"].toString();
+              var remote = servicesMap["Remote"].toString();
+              if (_hasWingAIDiagnosisService == false) {
+                inProcess = inProcess
+                    .replaceAll("WingAIDiagnosisService,", "")
+                    .replaceAll("WingAIDiagnosisService", "");
+                jsonRpcHttp = jsonRpcHttp
+                    .replaceAll("WingAIDiagnosisService,", "")
+                    .replaceAll("WingAIDiagnosisService", "");
+                remote = remote
+                    .replaceAll("WingAIDiagnosisService,", "")
+                    .replaceAll("WingAIDiagnosisService", "");
+              }
+              if (_hasWingRtcService == false) {
+                inProcess = inProcess
+                    .replaceAll("WingRtcService,", "")
+                    .replaceAll("WingRtcService", "");
+                jsonRpcHttp = jsonRpcHttp
+                    .replaceAll("WingRtcService,", "")
+                    .replaceAll("WingRtcService", "");
+                remote = remote
+                    .replaceAll("WingRtcService,", "")
+                    .replaceAll("WingRtcService", "");
+              }
+              if (_hasWingLiveConsultationService == false) {
+                inProcess = inProcess
+                    .replaceAll("WingLiveConsultationService,", "")
+                    .replaceAll("WingLiveConsultationService", "");
+                jsonRpcHttp = jsonRpcHttp
+                    .replaceAll("WingLiveConsultationService,", "")
+                    .replaceAll("WingLiveConsultationService", "");
+                remote = remote
+                    .replaceAll("WingLiveConsultationService,", "")
+                    .replaceAll("WingLiveConsultationService", "");
+              }
+              if (_hasWingASRService == false) {
+                inProcess = inProcess
+                    .replaceAll("WingASRService,", "")
+                    .replaceAll("WingASRService", "");
+                jsonRpcHttp = jsonRpcHttp
+                    .replaceAll("WingASRService,", "")
+                    .replaceAll("WingASRService", "");
+                remote = remote
+                    .replaceAll("WingASRService,", "")
+                    .replaceAll("WingASRService", "");
+              }
+              if (_hasWingPaymentService == false) {
+                inProcess = inProcess
+                    .replaceAll("WingPaymentService,", "")
+                    .replaceAll("WingPaymentService", "");
+                jsonRpcHttp = jsonRpcHttp
+                    .replaceAll("WingPaymentService,", "")
+                    .replaceAll("WingPaymentService", "");
+                remote = remote
+                    .replaceAll("WingPaymentService,", "")
+                    .replaceAll("WingPaymentService", "");
+              }
+              if (_hasWingLabService == false) {
+                inProcess = inProcess
+                    .replaceAll("WingLabService,", "")
+                    .replaceAll("WingLabService", "");
+                jsonRpcHttp = jsonRpcHttp
+                    .replaceAll("WingLabService,", "")
+                    .replaceAll("WingLabService", "");
+                remote = remote
+                    .replaceAll("WingLabService,", "")
+                    .replaceAll("WingLabService", "");
+              }
+              if (_hasWingEducationService == false) {
+                inProcess = inProcess
+                    .replaceAll("WingEducationService,", "")
+                    .replaceAll("WingEducationService", "");
+                jsonRpcHttp = jsonRpcHttp
+                    .replaceAll("WingEducationService,", "")
+                    .replaceAll("WingEducationService", "");
+                remote = remote
+                    .replaceAll("WingEducationService,", "")
+                    .replaceAll("WingEducationService", "");
+              }
+              if (inProcess.endsWith(',')) {
+                inProcess = inProcess.substring(0, inProcess.length - 1);
+              }
+              if (jsonRpcHttp.endsWith(',')) {
+                jsonRpcHttp = jsonRpcHttp.substring(0, jsonRpcHttp.length - 1);
+              }
+              if (remote.endsWith(',')) {
+                remote = remote.substring(0, remote.length - 1);
+              }
+              servicesMap["InProcess"] = inProcess;
+              servicesMap["JsonRpcHttp"] = jsonRpcHttp;
+              servicesMap["Remote"] = remote;
             }
           }
+
           // 将更改后的 JSON 数据写回文件
           String updatedJsonString = jsonEncode(oldJsonMap);
           await oldAppSettingsFile.writeAsString(updatedJsonString);
@@ -264,11 +470,14 @@ class PublishService {
 //启动
   Future<void> runStartBat() async {
     Logger.info("runStartBat start");
-    String parentDir = path.dirname(_installDirectory);
-    File deployServerStartBat = File('$parentDir/DeployServer/start.bat');
-    if (await deployServerStartBat.exists()) {
-      await Process.start(deployServerStartBat.path, [],
-          workingDirectory: _installDirectory, runInShell: true);
+    //是否允许远程部署
+    if (_isRemoteDeployable) {
+      String parentDir = path.dirname(_installDirectory);
+      File deployServerStartBat = File('$parentDir/DeployServer/start.bat');
+      if (await deployServerStartBat.exists()) {
+        await Process.start(deployServerStartBat.path, [],
+            workingDirectory: _installDirectory, runInShell: true);
+      }
     }
     File startBat = File('${_installDirectory}/start.bat');
 
@@ -290,9 +499,10 @@ class PublishService {
 
   //验证启动状态
   Future<void> checkStartStatus() async {
+    Logger.info("checkStartStatus start");
     var num = 0;
     var result = false;
-    while (!result && num < 10) {
+    while (!result && num < 6) {
       try {
         await Future.delayed(Duration(seconds: 5));
         result = await getServerStateAsync(_ipAddress);
@@ -300,6 +510,10 @@ class PublishService {
           Logger.info("server  start success");
           print("server  start success");
           break;
+        } else {
+          Logger.warning("erver not start yet ");
+          print("erver not start yet ");
+          num++;
         }
       } catch (e) {
         Logger.info("server not start yet");
@@ -307,6 +521,9 @@ class PublishService {
         num++;
       }
     }
+    if (num >= 6) {
+      throw Exception("start server error");
+    }
   }
 
   //上传更新包-多线程
@@ -737,24 +954,27 @@ class PublishService {
   //查询日志
   Future<List<String>> getLogsAsync(String id, String ip) async {
     List<String> logs = [];
-    logs = await getPublishPackageLogsAsync(ip);
-    final rpc = GetIt.instance.get<JsonRpcProxy>();
-    var result =
-        await rpc.deployPlatform.getServerAsync(new GetServerRequest(id: id));
-    var detailLogs = result.logs ?? "";
-    if (logs.length > 0) {
-      if (!detailLogs.contains(logs.last) &&
-          logs.last.contains('publish completed')) {
-        saveLogsAsync(id, logs);
-      }
-    } else {
-      if (detailLogs != '') {
-        List<dynamic> jsonList = json.decode(detailLogs);
-        List<String> stringList = jsonList.cast<String>();
-        logs = stringList;
+    try {
+      logs = await getPublishPackageLogsAsync(ip);
+      final rpc = GetIt.instance.get<JsonRpcProxy>();
+      var result =
+          await rpc.deployPlatform.getServerAsync(new GetServerRequest(id: id));
+      var detailLogs = result.logs ?? "";
+      if (logs.length > 0) {
+        if (!detailLogs.contains(logs.last) &&
+            logs.last.contains('publish completed')) {
+          saveLogsAsync(id, logs);
+        }
+      } else {
+        if (detailLogs != '') {
+          List<dynamic> jsonList = json.decode(detailLogs);
+          List<String> stringList = jsonList.cast<String>();
+          logs = stringList;
+        }
       }
+    } catch (e) {
+      Logger.error(e);
     }
-
     return logs;
   }
 }

+ 21 - 1
Tools/Flyinsono.Deployment/lib/l10n/app_en.arb

@@ -33,5 +33,25 @@
   "editPackageInfo": "Edit Package Info",
   "versionRequired": "Version is required!",
   "operatorRequired": "Publisher is required!",
-  "internalRecordRequired": "Internal note is required!"
+  "internalRecordRequired": "Internal note is required!",
+  "basicSettings": "Basic Settings",
+  "installDirectory": "Installation Directory",
+  "defaultD": "Default D Drive",
+  "domain": "Domain Name",
+  "notRequired": "Not Required",
+  "ipAuto": "IP Address will be automatically obtained and filled in",
+  "advancedSetting": "Advanced Settings",
+  "startDeployment": "Start Deployment",
+  "isDistributed": "Is distributed",
+  "isMasterServer": "Is master server",
+  "masterServerAddress": "Master server address",
+  "serverID": "Server ID",
+  "isRemoteDeployable": "Is remote deployable",
+  "wingAIDiagnosisService": "Artificial Intelligence Diagnosis Service",
+  "wingRtcService": "Video Live Streaming Service",
+  "wingLiveConsultationService": "Real-time Consultation Service",
+  "wingASRService": "Speech Recognition Service",
+  "wingPaymentService": "Payment Platform Service",
+  "wingLabService": "Scientific Research Service",
+  "wingEducationService": "Education and Training Service"
 }

+ 23 - 1
Tools/Flyinsono.Deployment/lib/l10n/app_zh.arb

@@ -33,5 +33,27 @@
   "editPackageInfo": "修改打包记录",
   "versionRequired": "请填写版本号",
   "operatorRequired": "请选择发布负责人",
-  "internalRecordRequired": "请填写发布更新内容"
+  "internalRecordRequired": "请填写发布更新内容",
+  "basicSettings":"基本设置",
+  "installDirectory":"安装目录",
+  "defaultD":"默认D盘",
+  "domain":"域名",
+  "notRequired":"非必填",
+  "ipAuto":"IP地址将自动获取并填写",
+  "advancedSetting":"高级设置",
+  "startDeployment":"开始部署",
+  "isDistributed":"是否分布式",
+  "isMasterServer":"是否主服务器",
+  "masterServerAddress":"主服务器地址",
+  "serverID":"serverID",
+  "isRemoteDeployable":"是否可远程部署",
+  "wingAIDiagnosisService":"人工智能",  
+  "wingRtcService":"视频直播",
+  "wingLiveConsultationService":"实时会诊", 
+  "wingASRService":"语言识别", 
+  "wingPaymentService":"支付平台", 
+  "wingLabService":	"科研服务",
+  "wingEducationService":"教培服务"	
+ 
+
 }

+ 1 - 0
Tools/Flyinsono.Deployment/pubspec.yaml

@@ -54,6 +54,7 @@ dependencies:
   archive: ^3.3.7
   image_picker: ^0.8.7+3
   flutter_isolate: ^2.0.4
+  file_picker: ^5.2.11