Skip to content

Commit 8cd40e0

Browse files
author
dushixiang
committed
优化代码
1 parent fd4a1a2 commit 8cd40e0

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

internal/service/serial_service.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ func (s *SerialService) Start() {
8484
s.logger.Warn("串口连接异常,将重试",
8585
zap.Error(err),
8686
zap.Duration("retry_after", retryAfter))
87+
s.deviceCache.Delete(CacheKeyDeviceStatus)
8788

8889
time.Sleep(retryAfter)
8990
}
@@ -593,7 +594,7 @@ func (s *SerialService) handleSMSSendResult(msg map[string]interface{}) {
593594
zap.String("request_id", requestID))
594595
} else {
595596
status = models.MessageStatusFailed
596-
s.logger.Error("短信发送失败",
597+
s.logger.Warn("短信发送失败",
597598
zap.String("to", to),
598599
zap.String("request_id", requestID))
599600
}

web/src/components/Layout.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ export default function Layout() {
120120
"w-2 h-2 rounded-full animate-pulse",
121121
deviceStatus?.connected ? 'bg-green-500' : 'bg-red-500',
122122
)}/>
123-
<div className={'text-xs font-medium text-gray-600'}>设备在线</div>
123+
<div className={'text-xs font-medium text-gray-600'}>
124+
{deviceStatus?.connected ? '设备在线' : '设备离线'}
125+
</div>
124126
</div>
125127
<div className="text-[10px] text-gray-400 font-mono mt-0.5">
126128
{deviceStatus?.port_name}

0 commit comments

Comments
 (0)