From 03b0fb0ba2de86bcfff277778826547c0e37a93f Mon Sep 17 00:00:00 2001
From: 张世豪 <979909237@qq.com>
Date: 星期四, 20 十一月 2025 23:52:51 +0800
Subject: [PATCH] 优化修改

---
 src/xitongshezhi/banbenguanli.java | 1317 +++++++++++++++++++++++++++++++++++++----------------------
 1 files changed, 823 insertions(+), 494 deletions(-)

diff --git a/src/xitongshezhi/banbenguanli.java b/src/xitongshezhi/banbenguanli.java
index d92bd61..87b09ff 100644
--- a/src/xitongshezhi/banbenguanli.java
+++ b/src/xitongshezhi/banbenguanli.java
@@ -1,503 +1,832 @@
 package xitongshezhi;
 import javax.swing.*;
 import java.awt.*;
-import java.awt.event.*;
 import java.text.SimpleDateFormat;
 import java.util.Date;
+import java.io.*;
+import java.net.*;
 
-public class banbenguanli extends JFrame {
-    private JPanel mainPanel;
-    private JLabel titleLabel;
-    private JButton closeButton;
-    
-    // 鐗堟湰淇℃伅缁勪欢
-    private JLabel currentVersionLabel;
-    private JLabel versionDateLabel;
-    private JLabel statusIconLabel;
-    private JLabel statusTitleLabel;
-    private JLabel statusMessageLabel;
-    private JPanel latestVersionPanel;
-    private JLabel latestVersionLabel;
-    
-    // 鎸夐挳缁勪欢
-    private JButton checkUpdateButton;
-    private JButton updateButton;
-    
-    // 杩涘害鏉$粍浠�
-    private JProgressBar downloadProgressBar;
-    private JLabel progressPercentLabel;
-    
-    // 鐗堟湰鏁版嵁
-    private String currentVersion = "V2.3.5";
-    private String currentDate = "2023-10-15";
-    private String latestVersion = "V2.4.0";
-    private boolean updateAvailable = false;
-    
-    // 棰滆壊瀹氫箟
-    private final Color BACKGROUND_COLOR = new Color(15, 28, 48);
-    private final Color CARD_COLOR = new Color(26, 43, 68);
-    private final Color PRIMARY_COLOR = new Color(52, 152, 219);
-    private final Color SECONDARY_COLOR = new Color(46, 204, 113);
-    private final Color WARNING_COLOR = new Color(243, 156, 18);
-    private final Color TEXT_COLOR = new Color(224, 224, 224);
-    private final Color TEXT_LIGHT_COLOR = new Color(160, 200, 255);
+@SuppressWarnings("serial")
+public class banbenguanli extends JDialog {
+	private JPanel mainPanel;
+	private JButton closeButton;
 
-    public banbenguanli() {
-        initializeUI();
-        setupEventListeners();
-        updateVersionInfo();
-    }
+	// 鐗堟湰淇℃伅缁勪欢
+	private JLabel currentVersionLabel;
+	private JLabel versionDateLabel;
+	private JLabel statusTitleLabel;
+	private JLabel statusMessageLabel;
+	private JPanel latestVersionPanel;
+	private JLabel latestVersionLabel;
 
-    private void initializeUI() {
-        // 璁剧疆绐楀彛灞炴�� - 7瀵哥珫灞� (480x800)
-        setTitle("鐗堟湰绠$悊 - UWB浜哄憳瀹氫綅鍗″彂鍗℃満绠$悊绯荤粺");
-        setSize(480, 800);
-        setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
-        setLocationRelativeTo(null);
-        setResizable(false);
-        
-        // 璁剧疆涓嶉�忔槑鑳屾櫙
-        getContentPane().setBackground(BACKGROUND_COLOR);
-        
-        // 涓婚潰鏉�
-        mainPanel = new JPanel();
-        mainPanel.setLayout(new BorderLayout());
-        mainPanel.setBackground(BACKGROUND_COLOR);
-        mainPanel.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
-        
-        // 鍒涘缓鐗堟湰绠$悊寮圭獥鍐呭
-        JPanel versionPanel = createVersionPanel();
-        mainPanel.add(versionPanel, BorderLayout.CENTER);
-        
-        add(mainPanel);
-    }
-    
-    private JPanel createVersionPanel() {
-        JPanel panel = new JPanel();
-        panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
-        panel.setBackground(CARD_COLOR);
-        panel.setBorder(BorderFactory.createCompoundBorder(
-            BorderFactory.createLineBorder(PRIMARY_COLOR, 1),
-            BorderFactory.createEmptyBorder(25, 25, 25, 25)
-        ));
-        
-        // 椤堕儴娓愬彉鏉�
-        JPanel gradientBar = new JPanel();
-        gradientBar.setBackground(PRIMARY_COLOR);
-        gradientBar.setPreferredSize(new Dimension(400, 5));
-        gradientBar.setMaximumSize(new Dimension(400, 5));
-        gradientBar.setAlignmentX(Component.CENTER_ALIGNMENT);
-        
-        // 鏍囬鍖哄煙
-        JPanel headerPanel = new JPanel();
-        headerPanel.setLayout(new BoxLayout(headerPanel, BoxLayout.Y_AXIS));
-        headerPanel.setBackground(CARD_COLOR);
-        headerPanel.setAlignmentX(Component.CENTER_ALIGNMENT);
-        
-        // 鍥炬爣
-        JLabel iconLabel = new JLabel("馃搵");
-        iconLabel.setFont(new Font("Segoe UI Emoji", Font.PLAIN, 42));
-        iconLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
-        iconLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 15, 0));
-        
-        // 鏍囬
-        JLabel titleLabel = new JLabel("鐗堟湰绠$悊");
-        titleLabel.setFont(new Font("Microsoft YaHei", Font.BOLD, 24));
-        titleLabel.setForeground(TEXT_COLOR);
-        titleLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
-        
-        // 鍓爣棰�
-        JLabel subtitleLabel = new JLabel("UWB浜哄憳瀹氫綅鍗″彂鍗℃満绠$悊绯荤粺");
-        subtitleLabel.setFont(new Font("Microsoft YaHei", Font.PLAIN, 14));
-        subtitleLabel.setForeground(TEXT_LIGHT_COLOR);
-        subtitleLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
-        subtitleLabel.setBorder(BorderFactory.createEmptyBorder(5, 0, 25, 0));
-        
-        headerPanel.add(iconLabel);
-        headerPanel.add(titleLabel);
-        headerPanel.add(subtitleLabel);
-        
-        // 褰撳墠鐗堟湰鍗$墖
-        JPanel currentVersionPanel = createCurrentVersionPanel();
-        
-        // 鏇存柊鐘舵�佸尯鍩�
-        JPanel statusPanel = createStatusPanel();
-        
-        // 涓嬭浇杩涘害
-        JPanel progressPanel = createProgressPanel();
-        
-        // 鎸夐挳鍖哄煙
-        JPanel buttonPanel = createButtonPanel();
-        
-        // 鍏抽棴鎸夐挳
-        JButton closeBtn = new JButton("鍏抽棴");
-        closeBtn.setFont(new Font("Microsoft YaHei", Font.BOLD, 15));
-        closeBtn.setBackground(new Color(255, 255, 255, 20));
-        closeBtn.setForeground(TEXT_COLOR);
-        closeBtn.setBorder(BorderFactory.createCompoundBorder(
-            BorderFactory.createLineBorder(new Color(255, 255, 255, 50), 1),
-            BorderFactory.createEmptyBorder(12, 20, 12, 20)
-        ));
-        closeBtn.setFocusPainted(false);
-        closeBtn.setCursor(new Cursor(Cursor.HAND_CURSOR));
-        closeBtn.setAlignmentX(Component.CENTER_ALIGNMENT);
-        closeBtn.setMaximumSize(new Dimension(400, 45));
-        
-        closeButton = closeBtn;
-        
-        // 缁勮鎵�鏈夌粍浠�
-        panel.add(gradientBar);
-        panel.add(Box.createRigidArea(new Dimension(0, 20)));
-        panel.add(headerPanel);
-        panel.add(currentVersionPanel);
-        panel.add(Box.createRigidArea(new Dimension(0, 20)));
-        panel.add(statusPanel);
-        panel.add(Box.createRigidArea(new Dimension(0, 15)));
-        panel.add(progressPanel);
-        panel.add(Box.createRigidArea(new Dimension(0, 20)));
-        panel.add(buttonPanel);
-        panel.add(Box.createRigidArea(new Dimension(0, 15)));
-        panel.add(closeBtn);
-        
-        return panel;
-    }
-    
-    private JPanel createCurrentVersionPanel() {
-        JPanel panel = new JPanel();
-        panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
-        panel.setBackground(new Color(15, 28, 48, 150));
-        panel.setBorder(BorderFactory.createCompoundBorder(
-            BorderFactory.createLineBorder(new Color(255, 255, 255, 12), 1),
-            BorderFactory.createEmptyBorder(20, 20, 20, 20)
-        ));
-        panel.setAlignmentX(Component.CENTER_ALIGNMENT);
-        panel.setMaximumSize(new Dimension(400, 150));
-        
-        // 鐗堟湰鍙锋爣绛�
-        currentVersionLabel = new JLabel(currentVersion);
-        currentVersionLabel.setFont(new Font("Microsoft YaHei", Font.BOLD, 22));
-        currentVersionLabel.setForeground(Color.WHITE);
-        currentVersionLabel.setBackground(PRIMARY_COLOR);
-        currentVersionLabel.setOpaque(true);
-        currentVersionLabel.setBorder(BorderFactory.createEmptyBorder(10, 25, 10, 25));
-        currentVersionLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
-        
-        // 鐗堟湰鎻忚堪
-        JLabel versionDescLabel = new JLabel("褰撳墠鐗堟湰");
-        versionDescLabel.setFont(new Font("Microsoft YaHei", Font.PLAIN, 14));
-        versionDescLabel.setForeground(TEXT_LIGHT_COLOR);
-        versionDescLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
-        versionDescLabel.setBorder(BorderFactory.createEmptyBorder(10, 0, 5, 0));
-        
-        // 鏇存柊鏃ユ湡
-        versionDateLabel = new JLabel("鏈�鍚庢洿鏂�: " + currentDate);
-        versionDateLabel.setFont(new Font("Microsoft YaHei", Font.PLAIN, 13));
-        versionDateLabel.setForeground(TEXT_LIGHT_COLOR);
-        versionDateLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
-        
-        panel.add(currentVersionLabel);
-        panel.add(versionDescLabel);
-        panel.add(versionDateLabel);
-        
-        return panel;
-    }
-    
-    private JPanel createStatusPanel() {
-        JPanel panel = new JPanel();
-        panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
-        panel.setBackground(new Color(15, 28, 48, 150));
-        panel.setBorder(BorderFactory.createCompoundBorder(
-            BorderFactory.createLineBorder(new Color(255, 255, 255, 12), 1),
-            BorderFactory.createEmptyBorder(20, 20, 20, 20)
-        ));
-        panel.setAlignmentX(Component.CENTER_ALIGNMENT);
-        panel.setMaximumSize(new Dimension(400, 200));
-        
-        JPanel contentPanel = new JPanel();
-        contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.Y_AXIS));
-        contentPanel.setBackground(new Color(15, 28, 48, 0));
-        contentPanel.setAlignmentX(Component.CENTER_ALIGNMENT);
-        
-        // 鐘舵�佸浘鏍�
-        statusIconLabel = new JLabel("鉁�");
-        statusIconLabel.setFont(new Font("Segoe UI Emoji", Font.PLAIN, 48));
-        statusIconLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
-        statusIconLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
-        
-        // 鐘舵�佹爣棰�
-        statusTitleLabel = new JLabel("绯荤粺宸叉槸鏈�鏂扮増鏈�");
-        statusTitleLabel.setFont(new Font("Microsoft YaHei", Font.BOLD, 18));
-        statusTitleLabel.setForeground(TEXT_COLOR);
-        statusTitleLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
-        
-        // 鐘舵�佹秷鎭�
-        statusMessageLabel = new JLabel("鎮ㄧ殑绯荤粺杩愯鐨勬槸鏈�鏂扮ǔ瀹氱増鏈紝鎵�鏈夊姛鑳芥甯歌繍琛屻��");
-        statusMessageLabel.setFont(new Font("Microsoft YaHei", Font.PLAIN, 13));
-        statusMessageLabel.setForeground(TEXT_LIGHT_COLOR);
-        statusMessageLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
-        statusMessageLabel.setBorder(BorderFactory.createEmptyBorder(10, 0, 15, 0));
-        
-        // 鏈�鏂扮増鏈俊鎭潰鏉�
-        latestVersionPanel = new JPanel();
-        latestVersionPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
-        latestVersionPanel.setBackground(new Color(243, 156, 18, 38));
-        latestVersionPanel.setBorder(BorderFactory.createCompoundBorder(
-            BorderFactory.createLineBorder(new Color(243, 156, 18, 75), 1),
-            BorderFactory.createEmptyBorder(10, 15, 10, 15)
-        ));
-        latestVersionPanel.setAlignmentX(Component.CENTER_ALIGNMENT);
-        latestVersionPanel.setMaximumSize(new Dimension(350, 50));
-        
-        JLabel arrowLabel = new JLabel("猬嗭笍");
-        arrowLabel.setFont(new Font("Segoe UI Emoji", Font.PLAIN, 14));
-        
-        JLabel latestTextLabel = new JLabel("鏈�鏂扮増鏈�: ");
-        latestTextLabel.setFont(new Font("Microsoft YaHei", Font.BOLD, 14));
-        latestTextLabel.setForeground(WARNING_COLOR);
-        
-        latestVersionLabel = new JLabel(latestVersion);
-        latestVersionLabel.setFont(new Font("Microsoft YaHei", Font.BOLD, 15));
-        latestVersionLabel.setForeground(WARNING_COLOR);
-        
-        latestVersionPanel.add(arrowLabel);
-        latestVersionPanel.add(latestTextLabel);
-        latestVersionPanel.add(latestVersionLabel);
-        latestVersionPanel.setVisible(false);
-        
-        contentPanel.add(statusIconLabel);
-        contentPanel.add(statusTitleLabel);
-        contentPanel.add(statusMessageLabel);
-        contentPanel.add(latestVersionPanel);
-        
-        panel.add(contentPanel);
-        
-        return panel;
-    }
-    
-    private JPanel createProgressPanel() {
-        JPanel panel = new JPanel();
-        panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
-        panel.setBackground(CARD_COLOR);
-        panel.setAlignmentX(Component.CENTER_ALIGNMENT);
-        panel.setMaximumSize(new Dimension(400, 60));
-        panel.setVisible(false);
-        
-        // 杩涘害淇℃伅
-        JPanel infoPanel = new JPanel(new BorderLayout());
-        infoPanel.setBackground(CARD_COLOR);
-        infoPanel.setMaximumSize(new Dimension(400, 25));
-        
-        JLabel downloadingLabel = new JLabel("涓嬭浇鏇存柊...");
-        downloadingLabel.setFont(new Font("Microsoft YaHei", Font.PLAIN, 13));
-        downloadingLabel.setForeground(TEXT_LIGHT_COLOR);
-        
-        progressPercentLabel = new JLabel("0%");
-        progressPercentLabel.setFont(new Font("Microsoft YaHei", Font.BOLD, 13));
-        progressPercentLabel.setForeground(TEXT_LIGHT_COLOR);
-        
-        infoPanel.add(downloadingLabel, BorderLayout.WEST);
-        infoPanel.add(progressPercentLabel, BorderLayout.EAST);
-        
-        // 杩涘害鏉�
-        downloadProgressBar = new JProgressBar(0, 100);
-        downloadProgressBar.setValue(0);
-        downloadProgressBar.setBackground(new Color(255, 255, 255, 25));
-        downloadProgressBar.setForeground(SECONDARY_COLOR);
-        downloadProgressBar.setBorder(BorderFactory.createEmptyBorder());
-        downloadProgressBar.setMaximumSize(new Dimension(400, 8));
-        
-        panel.add(infoPanel);
-        panel.add(Box.createRigidArea(new Dimension(0, 8)));
-        panel.add(downloadProgressBar);
-        
-        return panel;
-    }
-    
-    private JPanel createButtonPanel() {
-        JPanel panel = new JPanel();
-        panel.setLayout(new GridLayout(1, 2, 15, 0));
-        panel.setBackground(CARD_COLOR);
-        panel.setAlignmentX(Component.CENTER_ALIGNMENT);
-        panel.setMaximumSize(new Dimension(400, 50));
-        
-        // 妫�鏌ユ洿鏂版寜閽�
-        checkUpdateButton = new JButton("妫�鏌ユ洿鏂�");
-        checkUpdateButton.setFont(new Font("Microsoft YaHei", Font.BOLD, 14));
-        checkUpdateButton.setBackground(PRIMARY_COLOR);
-        checkUpdateButton.setForeground(Color.WHITE);
-        checkUpdateButton.setBorder(BorderFactory.createEmptyBorder(12, 0, 12, 0));
-        checkUpdateButton.setFocusPainted(false);
-        checkUpdateButton.setCursor(new Cursor(Cursor.HAND_CURSOR));
-        
-        // 绔嬪嵆鏇存柊鎸夐挳
-        updateButton = new JButton("绔嬪嵆鏇存柊");
-        updateButton.setFont(new Font("Microsoft YaHei", Font.BOLD, 14));
-        updateButton.setBackground(new Color(128, 128, 128));
-        updateButton.setForeground(Color.WHITE);
-        updateButton.setBorder(BorderFactory.createEmptyBorder(12, 0, 12, 0));
-        updateButton.setFocusPainted(false);
-        updateButton.setCursor(new Cursor(Cursor.HAND_CURSOR));
-        updateButton.setEnabled(false);
-        
-        panel.add(checkUpdateButton);
-        panel.add(updateButton);
-        
-        return panel;
-    }
-    
-    private void setupEventListeners() {
-        // 鍏抽棴鎸夐挳
-        closeButton.addActionListener(e -> {
-            dispose();
-        });
-        
-        // 妫�鏌ユ洿鏂版寜閽�
-        checkUpdateButton.addActionListener(e -> {
-            checkForUpdates();
-        });
-        
-        // 绔嬪嵆鏇存柊鎸夐挳
-        updateButton.addActionListener(e -> {
-            startUpdate();
-        });
-    }
-    
-    private void updateVersionInfo() {
-        currentVersionLabel.setText(currentVersion);
-        versionDateLabel.setText("鏈�鍚庢洿鏂�: " + currentDate);
-        latestVersionLabel.setText(latestVersion);
-        
-        if (updateAvailable) {
-            showUpdateAvailable();
-        } else {
-            showUpToDate();
-        }
-    }
-    
-    private void showUpToDate() {
-        statusIconLabel.setText("鉁�");
-        statusTitleLabel.setText("绯荤粺宸叉槸鏈�鏂扮増鏈�");
-        statusMessageLabel.setText("鎮ㄧ殑绯荤粺杩愯鐨勬槸鏈�鏂扮ǔ瀹氱増鏈紝鎵�鏈夊姛鑳芥甯歌繍琛屻��");
-        latestVersionPanel.setVisible(false);
-        updateButton.setEnabled(false);
-        updateButton.setBackground(new Color(128, 128, 128));
-    }
-    
-    private void showUpdateAvailable() {
-        statusIconLabel.setText("鈿狅笍");
-        statusTitleLabel.setText("鍙戠幇鏂扮増鏈�");
-        statusMessageLabel.setText("鏈夋柊鐗堟湰鍙敤锛屽缓璁洿鏂颁互鑾峰緱鏇村ソ鐨勪綋楠屽拰鍔熻兘銆�");
-        latestVersionPanel.setVisible(true);
-        updateButton.setEnabled(true);
-        updateButton.setBackground(SECONDARY_COLOR);
-    }
-    
-    private void checkForUpdates() {
-        // 淇濆瓨鍘熷鎸夐挳鐘舵��
-        String originalText = checkUpdateButton.getText();
-        
-        // 鏄剧ず妫�鏌ヤ腑鐘舵��
-        checkUpdateButton.setText("妫�鏌ヤ腑...");
-        checkUpdateButton.setEnabled(false);
-        
-        // 妯℃嫙缃戠粶璇锋眰寤惰繜
-        Timer timer = new Timer(2000, e -> {
-            // 闅忔満鍐冲畾鏄惁鏈夋洿鏂�
-            updateAvailable = Math.random() > 0.5;
-            
-            if (updateAvailable) {
-                showUpdateAvailable();
-            } else {
-                showUpToDate();
-            }
-            
-            // 鎭㈠鎸夐挳鐘舵��
-            checkUpdateButton.setText(originalText);
-            checkUpdateButton.setEnabled(true);
-            
-            // 鏄剧ず妫�鏌ュ畬鎴愭彁绀�
-            String originalMessage = statusMessageLabel.getText();
-            statusMessageLabel.setText(updateAvailable ? 
-                "鉁� 妫�鏌ュ畬鎴愶紝鍙戠幇鏂扮増鏈彲鐢�" : 
-                "鉁� 妫�鏌ュ畬鎴愶紝绯荤粺宸叉槸鏈�鏂扮増鏈�");
-            
-            // 3绉掑悗鎭㈠鍘熸秷鎭�
-            Timer restoreTimer = new Timer(3000, e2 -> {
-                if (updateAvailable) {
-                    statusMessageLabel.setText("鏈夋柊鐗堟湰鍙敤锛屽缓璁洿鏂颁互鑾峰緱鏇村ソ鐨勪綋楠屽拰鍔熻兘銆�");
-                } else {
-                    statusMessageLabel.setText("鎮ㄧ殑绯荤粺杩愯鐨勬槸鏈�鏂扮ǔ瀹氱増鏈紝鎵�鏈夊姛鑳芥甯歌繍琛屻��");
-                }
-            });
-            restoreTimer.setRepeats(false);
-            restoreTimer.start();
-        });
-        timer.setRepeats(false);
-        timer.start();
-    }
-    
-    private void startUpdate() {
-        // 绂佺敤鎸夐挳
-        checkUpdateButton.setEnabled(false);
-        updateButton.setEnabled(false);
-        updateButton.setText("鏇存柊涓�...");
-        
-        // 鏄剧ず涓嬭浇杩涘害
-        JPanel progressPanel = (JPanel) mainPanel.getComponent(0).getComponentAt(275, 500);
-        progressPanel.setVisible(true);
-        
-        // 妯℃嫙涓嬭浇杩涘害
-        Timer progressTimer = new Timer(100, null);
-        progressTimer.addActionListener(new ActionListener() {
-            int progress = 0;
-            
-            @Override
-            public void actionPerformed(ActionEvent e) {
-                progress += (int) (Math.random() * 8);
-                if (progress >= 100) {
-                    progress = 100;
-                    progressTimer.stop();
-                    
-                    // 鏇存柊瀹屾垚
-                    Timer completionTimer = new Timer(500, e2 -> {
-                        progressPanel.setVisible(false);
-                        updateButton.setText("鏇存柊瀹屾垚");
-                        updateButton.setBackground(new Color(149, 165, 166));
-                        
-                        // 鏇存柊鐗堟湰淇℃伅
-                        currentVersion = latestVersion;
-                        currentDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
-                        updateAvailable = false;
-                        updateVersionInfo();
-                        
-                        // 鏄剧ず鎴愬姛娑堟伅
-                        statusIconLabel.setText("鉁�");
-                        statusTitleLabel.setText("鏇存柊瀹屾垚");
-                        statusMessageLabel.setText("绯荤粺宸叉垚鍔熸洿鏂板埌鏈�鏂扮増鏈紝鎵�鏈夊姛鑳藉凡浼樺寲銆�");
-                    });
-                    completionTimer.setRepeats(false);
-                    completionTimer.start();
-                }
-                
-                downloadProgressBar.setValue(progress);
-                progressPercentLabel.setText(progress + "%");
-            }
-        });
-        progressTimer.start();
-    }
-    
-    // 涓绘柟娉曟祴璇�
-    public static void main(String[] args) {
-        // 璁剧疆绯荤粺澶栬
-        try {
-            UIManager.setLookAndFeel(UIManager.getLookAndFeel());
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        
-        SwingUtilities.invokeLater(() -> {
-            banbenguanli frame = new banbenguanli();
-            frame.setVisible(true);
-        });
-    }
+	// 鎸夐挳缁勪欢
+	private JButton checkUpdateButton;
+	private JButton updateButton;
+
+	// 杩涘害鏉$粍浠�
+	private JProgressBar downloadProgressBar;
+	private JLabel progressPercentLabel;
+
+	// 鐗堟湰鏁版嵁
+	private String currentVersion = "V1.0.0";
+	private String currentDate = "2025-11-20";
+	private String latestVersion = "V1.0.1";
+	private boolean updateAvailable = false;
+
+	// API閰嶇疆
+	private final String UPDATE_CHECK_URL = "http://39.106.210.13:8090/api/wx/findTbUpapp";
+	private final String LOGIN_URL = "http://39.106.210.13:8090/api/wx/login";
+	private final String APP_NAME = "鍙戝崱app";
+	private final String LOGIN_USERNAME = "鐜嬮";
+	private final String LOGIN_PASSWORD = "admin";
+
+	private String downloadUrl = "";
+	private String releaseNotes = "";
+	private String loginToken = "";
+
+	// 棰滆壊瀹氫箟
+	private final Color BACKGROUND_COLOR = new Color(15, 28, 48);
+	private final Color CARD_COLOR = new Color(26, 43, 68);
+	private final Color PRIMARY_COLOR = new Color(52, 152, 219);
+	private final Color SECONDARY_COLOR = new Color(46, 204, 113);
+	private final Color WARNING_COLOR = new Color(243, 156, 18);
+	private final Color TEXT_COLOR = new Color(224, 224, 224);
+	private final Color TEXT_LIGHT_COLOR = new Color(160, 200, 255);
+
+	public banbenguanli(JFrame parent) {
+		super(parent, "鐗堟湰绠$悊", true);
+		initializeUI();
+		setupEventListeners();
+		updateVersionInfo();
+	}
+
+	private void initializeUI() {
+		// 璁剧疆寮圭獥灞炴�� - 7瀵哥珫灞� (480x800)
+		setTitle("鐗堟湰绠$悊");
+		setSize(480, 800);
+		setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
+		setLocationRelativeTo(getParent());
+		setResizable(false);
+
+		// 璁剧疆涓嶉�忔槑鑳屾櫙
+		getContentPane().setBackground(BACKGROUND_COLOR);
+
+		// 涓婚潰鏉�
+		mainPanel = new JPanel();
+		mainPanel.setLayout(new BorderLayout());
+		mainPanel.setBackground(BACKGROUND_COLOR);
+		mainPanel.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
+
+		// 鍒涘缓鐗堟湰绠$悊寮圭獥鍐呭
+		JPanel versionPanel = createVersionPanel();
+		mainPanel.add(versionPanel, BorderLayout.CENTER);
+
+		add(mainPanel);
+	}
+
+	private JPanel createVersionPanel() {
+		JPanel panel = new JPanel();
+		panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
+		panel.setBackground(CARD_COLOR);
+		panel.setBorder(BorderFactory.createCompoundBorder(
+				BorderFactory.createLineBorder(PRIMARY_COLOR, 1),
+				BorderFactory.createEmptyBorder(25, 25, 25, 25)
+				));
+
+		// 椤堕儴娓愬彉鏉�
+		JPanel gradientBar = new JPanel();
+		gradientBar.setBackground(PRIMARY_COLOR);
+		gradientBar.setPreferredSize(new Dimension(400, 5));
+		gradientBar.setMaximumSize(new Dimension(400, 5));
+		gradientBar.setAlignmentX(Component.CENTER_ALIGNMENT);
+
+		// 鏍囬鍖哄煙
+		JPanel headerPanel = new JPanel();
+		headerPanel.setLayout(new BoxLayout(headerPanel, BoxLayout.Y_AXIS));
+		headerPanel.setBackground(CARD_COLOR);
+		headerPanel.setAlignmentX(Component.CENTER_ALIGNMENT);
+
+		// 鏍囬
+		JLabel titleLabel = new JLabel("鐗堟湰绠$悊");
+		titleLabel.setFont(new Font("Microsoft YaHei", Font.BOLD, 24));
+		titleLabel.setForeground(TEXT_COLOR);
+		titleLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
+
+		// 鍓爣棰�
+		JLabel subtitleLabel = new JLabel("UWB浜哄憳瀹氫綅鍗″彂鍗℃満绠$悊绯荤粺");
+		subtitleLabel.setFont(new Font("Microsoft YaHei", Font.PLAIN, 14));
+		subtitleLabel.setForeground(TEXT_LIGHT_COLOR);
+		subtitleLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
+		subtitleLabel.setBorder(BorderFactory.createEmptyBorder(5, 0, 25, 0));
+
+		headerPanel.add(titleLabel);
+		headerPanel.add(subtitleLabel);
+
+		// 褰撳墠鐗堟湰鍗$墖
+		JPanel currentVersionPanel = createCurrentVersionPanel();
+
+		// 鏇存柊鐘舵�佸尯鍩�
+		JPanel statusPanel = createStatusPanel();
+
+		// 涓嬭浇杩涘害
+		JPanel progressPanel = createProgressPanel();
+
+		// 鎸夐挳鍖哄煙
+		JPanel buttonPanel = createButtonPanel();
+
+		// 鍏抽棴鎸夐挳
+		JButton closeBtn = new JButton("鍏抽棴");
+		closeBtn.setFont(new Font("Microsoft YaHei", Font.BOLD, 15));
+		closeBtn.setBackground(new Color(60, 60, 60));
+		closeBtn.setForeground(TEXT_COLOR);
+		closeBtn.setBorder(BorderFactory.createCompoundBorder(
+				BorderFactory.createLineBorder(new Color(100, 100, 100), 1),
+				BorderFactory.createEmptyBorder(12, 20, 12, 20)
+				));
+		closeBtn.setFocusPainted(false);
+		closeBtn.setCursor(new Cursor(Cursor.HAND_CURSOR));
+		closeBtn.setAlignmentX(Component.CENTER_ALIGNMENT);
+		closeBtn.setMaximumSize(new Dimension(400, 45));
+		closeBtn.setOpaque(true);
+
+		closeButton = closeBtn;
+
+		// 缁勮鎵�鏈夌粍浠�
+		panel.add(gradientBar);
+		panel.add(Box.createRigidArea(new Dimension(0, 20)));
+		panel.add(headerPanel);
+		panel.add(currentVersionPanel);
+		panel.add(Box.createRigidArea(new Dimension(0, 20)));
+		panel.add(statusPanel);
+		panel.add(Box.createRigidArea(new Dimension(0, 15)));
+		panel.add(progressPanel);
+		panel.add(Box.createRigidArea(new Dimension(0, 20)));
+		panel.add(buttonPanel);
+		panel.add(Box.createRigidArea(new Dimension(0, 15)));
+		panel.add(closeBtn);
+
+		return panel;
+	}
+
+	private JPanel createCurrentVersionPanel() {
+		JPanel panel = new JPanel();
+		panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
+		panel.setBackground(new Color(20, 35, 55));
+		panel.setBorder(BorderFactory.createCompoundBorder(
+				BorderFactory.createLineBorder(new Color(80, 80, 80), 1),
+				BorderFactory.createEmptyBorder(20, 20, 20, 20)
+				));
+		panel.setAlignmentX(Component.CENTER_ALIGNMENT);
+		panel.setMaximumSize(new Dimension(400, 150));
+		panel.setOpaque(true);
+
+		// 鐗堟湰鍙锋爣绛�
+		currentVersionLabel = new JLabel(currentVersion);
+		currentVersionLabel.setFont(new Font("Microsoft YaHei", Font.BOLD, 22));
+		currentVersionLabel.setForeground(Color.WHITE);
+		currentVersionLabel.setBackground(PRIMARY_COLOR);
+		currentVersionLabel.setOpaque(true);
+		currentVersionLabel.setBorder(BorderFactory.createEmptyBorder(10, 25, 10, 25));
+		currentVersionLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
+
+		// 鐗堟湰鎻忚堪
+		JLabel versionDescLabel = new JLabel("褰撳墠鐗堟湰");
+		versionDescLabel.setFont(new Font("Microsoft YaHei", Font.PLAIN, 14));
+		versionDescLabel.setForeground(TEXT_LIGHT_COLOR);
+		versionDescLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
+		versionDescLabel.setBorder(BorderFactory.createEmptyBorder(10, 0, 5, 0));
+		versionDescLabel.setOpaque(true);
+		versionDescLabel.setBackground(new Color(20, 35, 55));
+
+		// 鏇存柊鏃ユ湡
+		versionDateLabel = new JLabel("鏈�鍚庢洿鏂�: " + currentDate);
+		versionDateLabel.setFont(new Font("Microsoft YaHei", Font.PLAIN, 13));
+		versionDateLabel.setForeground(TEXT_LIGHT_COLOR);
+		versionDateLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
+		versionDateLabel.setOpaque(true);
+		versionDateLabel.setBackground(new Color(20, 35, 55));
+
+		panel.add(currentVersionLabel);
+		panel.add(versionDescLabel);
+		panel.add(versionDateLabel);
+
+		return panel;
+	}
+
+	private JPanel createStatusPanel() {
+		JPanel panel = new JPanel();
+		panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
+		panel.setBackground(new Color(20, 35, 55));
+		panel.setBorder(BorderFactory.createCompoundBorder(
+				BorderFactory.createLineBorder(new Color(80, 80, 80), 1),
+				BorderFactory.createEmptyBorder(20, 20, 20, 20)
+				));
+		panel.setAlignmentX(Component.CENTER_ALIGNMENT);
+		panel.setMaximumSize(new Dimension(400, 150));
+		panel.setOpaque(true);
+
+		JPanel contentPanel = new JPanel();
+		contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.Y_AXIS));
+		contentPanel.setBackground(new Color(20, 35, 55));
+		contentPanel.setAlignmentX(Component.CENTER_ALIGNMENT);
+		contentPanel.setOpaque(true);
+
+		// 鐘舵�佹爣棰�
+		statusTitleLabel = new JLabel("绯荤粺宸叉槸鏈�鏂扮増鏈�");
+		statusTitleLabel.setFont(new Font("Microsoft YaHei", Font.BOLD, 18));
+		statusTitleLabel.setForeground(TEXT_COLOR);
+		statusTitleLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
+		statusTitleLabel.setOpaque(true);
+		statusTitleLabel.setBackground(new Color(20, 35, 55));
+
+		// 鐘舵�佹秷鎭�
+		statusMessageLabel = new JLabel("鎮ㄧ殑绯荤粺杩愯鐨勬槸鏈�鏂扮ǔ瀹氱増鏈紝鎵�鏈夊姛鑳芥甯歌繍琛屻��");
+		statusMessageLabel.setFont(new Font("Microsoft YaHei", Font.PLAIN, 13));
+		statusMessageLabel.setForeground(TEXT_LIGHT_COLOR);
+		statusMessageLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
+		statusMessageLabel.setBorder(BorderFactory.createEmptyBorder(10, 0, 15, 0));
+		statusMessageLabel.setOpaque(true);
+		statusMessageLabel.setBackground(new Color(20, 35, 55));
+
+		// 鏈�鏂扮増鏈俊鎭潰鏉�
+		latestVersionPanel = new JPanel();
+		latestVersionPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
+		latestVersionPanel.setBackground(new Color(60, 50, 30));
+		latestVersionPanel.setBorder(BorderFactory.createCompoundBorder(
+				BorderFactory.createLineBorder(WARNING_COLOR, 1),
+				BorderFactory.createEmptyBorder(10, 15, 10, 15)
+				));
+		latestVersionPanel.setAlignmentX(Component.CENTER_ALIGNMENT);
+		latestVersionPanel.setMaximumSize(new Dimension(350, 40));
+		latestVersionPanel.setOpaque(true);
+
+		JLabel latestTextLabel = new JLabel("鏈�鏂扮増鏈�: ");
+		latestTextLabel.setFont(new Font("Microsoft YaHei", Font.BOLD, 14));
+		latestTextLabel.setForeground(WARNING_COLOR);
+		latestTextLabel.setOpaque(true);
+		latestTextLabel.setBackground(new Color(60, 50, 30));
+
+		latestVersionLabel = new JLabel(latestVersion);
+		latestVersionLabel.setFont(new Font("Microsoft YaHei", Font.BOLD, 15));
+		latestVersionLabel.setForeground(WARNING_COLOR);
+		latestVersionLabel.setOpaque(true);
+		latestVersionLabel.setBackground(new Color(60, 50, 30));
+
+		latestVersionPanel.add(latestTextLabel);
+		latestVersionPanel.add(latestVersionLabel);
+		latestVersionPanel.setVisible(false);
+
+		contentPanel.add(statusTitleLabel);
+		contentPanel.add(statusMessageLabel);
+		contentPanel.add(latestVersionPanel);
+
+		panel.add(contentPanel);
+
+		return panel;
+	}
+
+	private JPanel createProgressPanel() {
+		// 灏嗗垱寤虹殑闈㈡澘璧嬪�肩粰鎴愬憳鍙橀噺 progressPanel
+		progressPanel = new JPanel();
+		progressPanel.setLayout(new BoxLayout(progressPanel, BoxLayout.Y_AXIS));
+		progressPanel.setBackground(CARD_COLOR);
+		progressPanel.setAlignmentX(Component.CENTER_ALIGNMENT);
+		progressPanel.setMaximumSize(new Dimension(400, 60));
+		progressPanel.setVisible(false);
+		progressPanel.setOpaque(true);
+
+		// 杩涘害淇℃伅
+		JPanel infoPanel = new JPanel(new BorderLayout());
+		infoPanel.setBackground(CARD_COLOR);
+		infoPanel.setMaximumSize(new Dimension(400, 25));
+		infoPanel.setOpaque(true);
+
+		JLabel downloadingLabel = new JLabel("涓嬭浇鏇存柊...");
+		downloadingLabel.setFont(new Font("Microsoft YaHei", Font.PLAIN, 13));
+		downloadingLabel.setForeground(TEXT_LIGHT_COLOR);
+		downloadingLabel.setOpaque(true);
+		downloadingLabel.setBackground(CARD_COLOR);
+
+		progressPercentLabel = new JLabel("0%");
+		progressPercentLabel.setFont(new Font("Microsoft YaHei", Font.BOLD, 13));
+		progressPercentLabel.setForeground(TEXT_LIGHT_COLOR);
+		progressPercentLabel.setOpaque(true);
+		progressPercentLabel.setBackground(CARD_COLOR);
+
+		infoPanel.add(downloadingLabel, BorderLayout.WEST);
+		infoPanel.add(progressPercentLabel, BorderLayout.EAST);
+
+		// 杩涘害鏉� - 涓嶉�忔槑
+		downloadProgressBar = new JProgressBar(0, 100);
+		downloadProgressBar.setValue(0);
+		downloadProgressBar.setBackground(Color.WHITE);
+		downloadProgressBar.setForeground(SECONDARY_COLOR);
+		downloadProgressBar.setBorder(BorderFactory.createLineBorder(new Color(200, 200, 200)));
+		downloadProgressBar.setMaximumSize(new Dimension(400, 12));
+		downloadProgressBar.setOpaque(true);
+
+		progressPanel.add(infoPanel);
+		progressPanel.add(Box.createRigidArea(new Dimension(0, 8)));
+		progressPanel.add(downloadProgressBar);
+
+		return progressPanel;
+	}
+
+	private JPanel createButtonPanel() {
+		JPanel panel = new JPanel();
+		panel.setLayout(new GridLayout(1, 2, 15, 0));
+		panel.setBackground(CARD_COLOR);
+		panel.setAlignmentX(Component.CENTER_ALIGNMENT);
+		panel.setMaximumSize(new Dimension(400, 50));
+		panel.setOpaque(true);
+
+		// 妫�鏌ユ洿鏂版寜閽�
+		checkUpdateButton = new JButton("妫�鏌ユ洿鏂�");
+		checkUpdateButton.setFont(new Font("Microsoft YaHei", Font.BOLD, 14));
+		checkUpdateButton.setBackground(PRIMARY_COLOR);
+		checkUpdateButton.setForeground(Color.WHITE);
+		checkUpdateButton.setBorder(BorderFactory.createEmptyBorder(12, 0, 12, 0));
+		checkUpdateButton.setFocusPainted(false);
+		checkUpdateButton.setCursor(new Cursor(Cursor.HAND_CURSOR));
+		checkUpdateButton.setOpaque(true);
+
+		// 绔嬪嵆鏇存柊鎸夐挳
+		updateButton = new JButton("绔嬪嵆鏇存柊");
+		updateButton.setFont(new Font("Microsoft YaHei", Font.BOLD, 14));
+		updateButton.setBackground(new Color(128, 128, 128));
+		updateButton.setForeground(Color.WHITE);
+		updateButton.setBorder(BorderFactory.createEmptyBorder(12, 0, 12, 0));
+		updateButton.setFocusPainted(false);
+		updateButton.setCursor(new Cursor(Cursor.HAND_CURSOR));
+		updateButton.setEnabled(false);
+		updateButton.setOpaque(true);
+
+		panel.add(checkUpdateButton);
+		panel.add(updateButton);
+
+		return panel;
+	}
+
+	private void setupEventListeners() {
+		// 鍏抽棴鎸夐挳
+		closeButton.addActionListener(e -> {
+			dispose();
+		});
+
+		// 妫�鏌ユ洿鏂版寜閽�
+		checkUpdateButton.addActionListener(e -> {
+			checkForUpdates();
+		});
+
+		// 绔嬪嵆鏇存柊鎸夐挳
+		updateButton.addActionListener(e -> {
+			startUpdate();
+		});
+	}
+
+	private void updateVersionInfo() {
+		currentVersionLabel.setText(currentVersion);
+		versionDateLabel.setText("鏈�鍚庢洿鏂�: " + currentDate);
+		latestVersionLabel.setText(latestVersion);
+
+		if (updateAvailable) {
+			showUpdateAvailable();
+		} else {
+			showUpToDate();
+		}
+	}
+
+	private void showUpToDate() {
+		statusTitleLabel.setText("绯荤粺宸叉槸鏈�鏂扮増鏈�");
+		statusMessageLabel.setText("鎮ㄧ殑绯荤粺杩愯鐨勬槸鏈�鏂扮ǔ瀹氱増鏈紝鎵�鏈夊姛鑳芥甯歌繍琛屻��");
+		latestVersionPanel.setVisible(false);
+		updateButton.setEnabled(false);
+		updateButton.setBackground(new Color(128, 128, 128));
+	}
+
+	private void showUpdateAvailable() {
+		statusTitleLabel.setText("鍙戠幇鏂扮増鏈�");
+		statusMessageLabel.setText("鏈夋柊鐗堟湰鍙敤锛屽缓璁洿鏂颁互鑾峰緱鏇村ソ鐨勪綋楠屽拰鍔熻兘銆�");
+		latestVersionPanel.setVisible(true);
+		updateButton.setEnabled(true);
+		updateButton.setBackground(SECONDARY_COLOR);
+	}
+
+	// 绠�鍗曠殑 JSON 瑙f瀽鏂规硶
+	private String extractJsonValue(String json, String key) {
+		try {
+			String searchKey = "\"" + key + "\":";
+			int startIndex = json.indexOf(searchKey);
+			if (startIndex == -1) return "";
+
+			startIndex += searchKey.length();
+			int endIndex = json.indexOf(",", startIndex);
+			if (endIndex == -1) endIndex = json.indexOf("}", startIndex);
+			if (endIndex == -1) return "";
+
+			String value = json.substring(startIndex, endIndex).trim();
+			// 鍘婚櫎寮曞彿
+			if (value.startsWith("\"") && value.endsWith("\"")) {
+				value = value.substring(1, value.length() - 1);
+			}
+			return value;
+		} catch (Exception e) {
+			return "";
+		}
+	}
+
+	private int extractJsonInt(String json, String key) {
+		try {
+			String value = extractJsonValue(json, key);
+			return Integer.parseInt(value);
+		} catch (Exception e) {
+			return -1;
+		}
+	}
+
+	private String normalizeVersion(String version) {
+		if (version == null || version.trim().isEmpty()) return "";
+		String normalized = version.trim();
+		if (!normalized.toUpperCase().startsWith("V")) {
+			normalized = "V" + normalized;
+		}
+		return normalized.replace("v", "V");
+	}
+
+	private void checkForUpdates() {
+		// 淇濆瓨鍘熷鎸夐挳鐘舵��
+		String originalText = checkUpdateButton.getText();
+
+		// 鏄剧ず妫�鏌ヤ腑鐘舵��
+		checkUpdateButton.setText("妫�鏌ヤ腑...");
+		checkUpdateButton.setEnabled(false);
+		statusTitleLabel.setText("妫�鏌ユ洿鏂�");
+		statusMessageLabel.setText("姝e湪妫�鏌ユ渶鏂扮増鏈紝璇风◢鍊�...");
+
+		// 浣跨敤SwingWorker鎵ц缃戠粶璇锋眰锛岄伩鍏嶉樆濉濽I
+		SwingWorker<Boolean, Void> worker = new SwingWorker<Boolean, Void>() {
+			@Override
+			protected Boolean doInBackground() throws Exception {
+				try {
+					// 鏋勫缓璇锋眰URL
+					String urlStr = UPDATE_CHECK_URL + "?name=" + URLEncoder.encode(APP_NAME, "UTF-8");
+					URL url = new URL(urlStr);
+					HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+					connection.setRequestMethod("GET");
+					connection.setConnectTimeout(10000);
+					connection.setReadTimeout(15000);
+
+					int responseCode = connection.getResponseCode();
+					if (responseCode == 200) {
+						BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
+						String inputLine;
+						StringBuilder response = new StringBuilder();
+
+						while ((inputLine = in.readLine()) != null) {
+							response.append(inputLine);
+						}
+						in.close();
+
+						// 瑙f瀽JSON鍝嶅簲锛堜娇鐢ㄧ畝鍗曞瓧绗︿覆澶勭悊锛�
+						String jsonResponse = response.toString();
+						int code = extractJsonInt(jsonResponse, "code");
+
+						if (code == 0) {
+							// 鎻愬彇data瀵硅薄
+							int dataStart = jsonResponse.indexOf("\"data\":");
+							if (dataStart == -1) {
+								throw new Exception("鍝嶅簲涓湭鎵惧埌data瀛楁");
+							}
+
+							String serverVersionRaw = extractJsonValue(jsonResponse, "version");
+							String serverVersion = normalizeVersion(serverVersionRaw);
+							String currentVersionNormalized = normalizeVersion(currentVersion);
+
+							// 姣旇緝鐗堟湰
+							boolean hasUpdate = !serverVersion.equals(currentVersionNormalized);
+
+							if (hasUpdate) {
+								latestVersion = serverVersion;
+								downloadUrl = extractJsonValue(jsonResponse, "address");
+								releaseNotes = extractJsonValue(jsonResponse, "info");
+								if (releaseNotes.isEmpty()) {
+									releaseNotes = "鏈夋柊鐗堟湰鍙敤锛屽缓璁洿鏂颁互鑾峰緱鏇村ソ鐨勪綋楠屽拰鍔熻兘銆�";
+								}
+
+								String uptime = extractJsonValue(jsonResponse, "uptime");
+								if (!uptime.isEmpty()) {
+									currentDate = uptime;
+								}
+							}
+
+							return hasUpdate;
+						} else {
+							throw new Exception("鏈嶅姟鍣ㄨ繑鍥為敊璇唬鐮�: " + code);
+						}
+					} else {
+						throw new Exception("HTTP閿欒浠g爜: " + responseCode);
+					}
+				} catch (Exception e) {
+					e.printStackTrace();
+					throw e;
+				}
+			}
+
+			protected void done() {
+				try {
+					updateAvailable = get();
+
+					if (updateAvailable) {
+						showUpdateAvailable();
+						statusMessageLabel.setText("妫�鏌ュ畬鎴愶紝鍙戠幇鏂扮増鏈彲鐢�");
+					} else {
+						showUpToDate();
+						statusMessageLabel.setText("妫�鏌ュ畬鎴愶紝绯荤粺宸叉槸鏈�鏂扮増鏈�");
+					}
+
+					// 鎭㈠鎸夐挳鐘舵��
+					checkUpdateButton.setText(originalText);
+					checkUpdateButton.setEnabled(true);
+
+					// 3绉掑悗鎭㈠鍘熸秷鎭�
+					Timer restoreTimer = new Timer(3000, e2 -> {
+						if (updateAvailable) {
+							statusMessageLabel.setText(releaseNotes.isEmpty() ? 
+									"鏈夋柊鐗堟湰鍙敤锛屽缓璁洿鏂颁互鑾峰緱鏇村ソ鐨勪綋楠屽拰鍔熻兘銆�" : releaseNotes);
+						} else {
+							statusMessageLabel.setText("鎮ㄧ殑绯荤粺杩愯鐨勬槸鏈�鏂扮ǔ瀹氱増鏈紝鎵�鏈夊姛鑳芥甯歌繍琛屻��");
+						}
+					});
+					restoreTimer.setRepeats(false);
+					restoreTimer.start();
+				} catch (Exception e) {
+					e.printStackTrace();
+					checkUpdateButton.setText(originalText);
+					checkUpdateButton.setEnabled(true);
+					statusTitleLabel.setText("妫�鏌ュけ璐�");
+					statusMessageLabel.setText("妫�鏌ユ洿鏂板け璐ワ紝璇锋鏌ョ綉缁滃悗閲嶈瘯銆�");
+
+					JOptionPane.showMessageDialog(banbenguanli.this, 
+							"妫�鏌ユ洿鏂板け璐�: " + e.getMessage(), "閿欒", JOptionPane.ERROR_MESSAGE);
+				}
+			}
+		};
+
+		worker.execute();
+	}
+
+	private void requestLoginToken() {
+		SwingWorker<String, Void> worker = new SwingWorker<String, Void>() {
+			@Override
+			protected String doInBackground() throws Exception {
+				try {
+					URL url = new URL(LOGIN_URL);
+					HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+					connection.setRequestMethod("POST");
+					connection.setRequestProperty("Content-Type", "application/json");
+					connection.setConnectTimeout(10000);
+					connection.setReadTimeout(15000);
+					connection.setDoOutput(true);
+
+					// 鏋勫缓鐧诲綍鏁版嵁
+					String loginData = "username=" + URLEncoder.encode(LOGIN_USERNAME, "UTF-8") + 
+							"&password=" + URLEncoder.encode(LOGIN_PASSWORD, "UTF-8");          
+					connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
+
+					OutputStream os = connection.getOutputStream();
+					os.write(loginData.getBytes());
+					os.flush();
+
+					int responseCode = connection.getResponseCode();
+					if (responseCode == 200) {
+						BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
+						String inputLine;
+						StringBuilder response = new StringBuilder();
+
+						while ((inputLine = in.readLine()) != null) {
+							response.append(inputLine);
+						}
+						in.close();
+
+						String jsonResponse = response.toString();
+						int code = extractJsonInt(jsonResponse, "code");
+
+						if (code == 0) {
+							String tokenType = extractJsonValue(jsonResponse, "tokentype");
+							String token = extractJsonValue(jsonResponse, "token");
+							return tokenType + " " + token;
+						} else {
+							throw new Exception("鐧诲綍澶辫触锛岄敊璇唬鐮�: " + code);
+						}
+					} else {
+						throw new Exception("HTTP閿欒浠g爜: " + responseCode);
+					}
+				} catch (Exception e) {
+					e.printStackTrace();
+					throw e;
+				}
+			}
+
+			@Override
+			protected void done() {
+				try {
+					loginToken = get();
+					statusMessageLabel.setText("姝e湪涓嬭浇鏈�鏂板畨瑁呭寘锛岃绋嶅��...");
+					downloadPackage();
+				} catch (Exception e) {
+					e.printStackTrace();
+					handleDownloadError("鑾峰彇鎺堟潈澶辫触锛岃绋嶅悗閲嶈瘯銆�");
+				}
+			}
+		};
+
+		worker.execute();
+	}
+
+	private void startUpdate() {
+		if (!updateAvailable || downloadUrl.isEmpty()) {
+			JOptionPane.showMessageDialog(this, 
+					"鏃犳硶鏇存柊锛氫笅杞藉湴鍧�鏃犳晥", "閿欒", JOptionPane.ERROR_MESSAGE);
+			return;
+		}
+
+		// 绂佺敤鎸夐挳
+		checkUpdateButton.setEnabled(false);
+		updateButton.setEnabled(false);
+		updateButton.setText("鏇存柊涓�...");
+
+		// 鏄剧ず涓嬭浇杩涘害
+		progressPanel.setVisible(true);
+		downloadProgressBar.setValue(0);
+		progressPercentLabel.setText("0%");
+
+		statusTitleLabel.setText("鏇存柊涓�");
+		statusMessageLabel.setText("姝e湪鍑嗗涓嬭浇锛岃绋嶅��...");
+
+		// 璇锋眰鐧诲綍token
+		requestLoginToken();
+	}
+
+	private void downloadPackage() {
+		SwingWorker<Void, Integer> downloadWorker = new SwingWorker<Void, Integer>() {
+			@Override
+			protected Void doInBackground() throws Exception {
+				//System.out.println("寮�濮嬩笅杞斤紝URL: " + downloadUrl);
+                //System.out.println("浣跨敤鐨凾oken: " + loginToken);
+				try {
+					URL url = new URL(downloadUrl);
+					HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+					connection.setRequestMethod("GET");
+					
+
+					// 娣诲姞璁よ瘉澶�
+					 if (!loginToken.isEmpty()) {
+		                    connection.setRequestProperty("Authorization", loginToken);
+		                    //System.out.println("璁剧疆Authorization澶�: " + loginToken);
+		                }
+
+					connection.setConnectTimeout(10000);
+					connection.setReadTimeout(30000);
+
+					int fileSize = connection.getContentLength();
+
+					// 鍒涘缓涓嬭浇鐩綍
+					File downloadDir = new File("downloads");
+					if (!downloadDir.exists()) {
+						downloadDir.mkdirs();
+					}
+
+					// 鍒涘缓杈撳嚭鏂囦欢
+					String fileName = "Issue_cards_" + latestVersion + ".apk";
+					File outputFile = new File(downloadDir, fileName);
+
+					try (InputStream inputStream = connection.getInputStream();
+							FileOutputStream outputStream = new FileOutputStream(outputFile)) {
+
+						byte[] buffer = new byte[4096];
+						int bytesRead;
+						long totalBytesRead = 0;
+
+						while ((bytesRead = inputStream.read(buffer)) != -1) {
+							outputStream.write(buffer, 0, bytesRead);
+							totalBytesRead += bytesRead;
+
+							// 璁$畻骞跺彂甯冭繘搴�
+							int progress = 0;
+							if (fileSize > 0) {
+								progress = (int) (totalBytesRead * 100 / fileSize);
+							} else {
+								// 濡傛灉鏃犳硶鑾峰彇鏂囦欢澶у皬锛屼娇鐢ㄦā鎷熻繘搴�
+								progress += (int) (Math.random() * 8);
+								if (progress >= 100) progress = 100;
+							}
+
+							publish(progress);
+
+							// 妯℃嫙涓嬭浇閫熷害
+							Thread.sleep(50);
+
+							if (isCancelled()) {
+								break;
+							}
+						}
+					}
+
+					connection.disconnect();
+
+				} catch (Exception e) {
+					e.printStackTrace();
+					throw e;
+				}
+
+				return null;
+			}
+
+			@Override
+			protected void process(java.util.List<Integer> chunks) {
+				int progress = chunks.get(chunks.size() - 1);
+				downloadProgressBar.setValue(progress);
+				progressPercentLabel.setText(progress + "%");
+			}
+
+			@Override
+			protected void done() {
+				try {
+					get(); // 妫�鏌ユ槸鍚︽湁寮傚父
+
+					// 涓嬭浇瀹屾垚
+					downloadProgressBar.setValue(100);
+					progressPercentLabel.setText("100%");
+
+					// 鏇存柊瀹屾垚
+					SwingUtilities.invokeLater(() -> {
+						finishUpdate();
+					});
+
+				} catch (Exception e) {
+					e.printStackTrace();
+					handleDownloadError("涓嬭浇澶辫触锛岃妫�鏌ョ綉缁滃悗閲嶈瘯銆�");
+				}
+			}
+		};
+
+		downloadWorker.execute();
+	}
+
+	private void finishUpdate() {
+		// 闅愯棌杩涘害鏉�
+		progressPanel.setVisible(false);
+
+		updateButton.setText("鏇存柊瀹屾垚");
+		updateButton.setBackground(new Color(149, 165, 166));
+
+		// 鏇存柊鐗堟湰淇℃伅
+		currentVersion = latestVersion;
+		currentDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
+		updateAvailable = false;
+		updateVersionInfo();
+
+		// 鏄剧ず鎴愬姛娑堟伅
+		statusTitleLabel.setText("鏇存柊瀹屾垚");
+		statusMessageLabel.setText("绯荤粺宸叉垚鍔熸洿鏂板埌鏈�鏂扮増鏈紝鎵�鏈夊姛鑳藉凡浼樺寲銆�");
+
+		// 閲嶇疆鐘舵��
+		checkUpdateButton.setEnabled(true);
+		updateButton.setEnabled(false);
+
+		// 娓呯悊涓存椂鏁版嵁
+		downloadUrl = "";
+		releaseNotes = "";
+		loginToken = "";
+
+		JOptionPane.showMessageDialog(banbenguanli.this, 
+				"鏇存柊瀹屾垚锛佸畨瑁呭寘宸蹭笅杞藉埌 downloads 鏂囦欢澶广��", 
+				"鏇存柊鎴愬姛", JOptionPane.INFORMATION_MESSAGE);
+	}
+
+	private void handleDownloadError(String message) {
+		progressPanel.setVisible(false);
+		updateButton.setText("绔嬪嵆鏇存柊");
+		updateButton.setEnabled(updateAvailable);
+		checkUpdateButton.setEnabled(true);
+
+		statusTitleLabel.setText("鏇存柊澶辫触");
+		statusMessageLabel.setText(message);
+
+		JOptionPane.showMessageDialog(this, message, "閿欒", JOptionPane.ERROR_MESSAGE);
+	}
+
+	// 杩涘害闈㈡澘寮曠敤
+	private JPanel progressPanel;
+
+
+
+	// 闈欐�佹柟娉曪細鏄剧ず鐗堟湰绠$悊瀵硅瘽妗�
+	public static void showVersionManagementDialog(JFrame parent) {
+		SwingUtilities.invokeLater(() -> {
+			banbenguanli dialog = new banbenguanli(parent);
+			dialog.setVisible(true);
+		});
+	}
+
 }
\ No newline at end of file

--
Gitblit v1.9.3