🎨 优化用户头像显示逻辑,支持显示用户头像或默认图标;更新日志格式��修复IP地址记录
All checks were successful
BuildImage / build-image (push) Successful in 4m18s

This commit is contained in:
李寻欢 2025-04-09 11:04:27 +08:00
parent b4bb6654c5
commit 224885c439
3 changed files with 12 additions and 4 deletions

View File

@ -118,7 +118,7 @@ func New(cfg *config.Config) *Server {
// 注册中间件
app.Use(recover.New())
app.Use(logger.New(logger.Config{
Format: "[${time}] ${status} - ${ip} - ${latency} ${method} ${path}\n",
Format: "[${time}] ${status} - ${ips} - ${latency} ${method} ${path}\n",
TimeFormat: "2006-01-02 15:04:05",
}))
app.Use(cors.New())

View File

@ -79,8 +79,12 @@
<!-- 卡片内容 -->
<div class="p-6">
<div class="flex items-center">
<div class="w-10 h-10 rounded-full {{if eq .Status "online"}}bg-green-100 text-green-600{{else}}bg-gray-100 text-gray-500{{end}} flex items-center justify-center mr-4">
<div class="w-10 h-10 rounded-full {{if eq .Status "online"}}bg-green-100 text-green-600{{else}}bg-gray-100 text-gray-500{{end}} flex items-center justify-center mr-4 overflow-hidden">
{{if .Avatar}}
<img src="{{.Avatar}}" alt="WeChat Avatar" class="w-full h-full object-cover">
{{else}}
<i class="fas fa-robot text-lg"></i>
{{end}}
</div>
<div>
<h3 class="text-lg font-medium text-gray-800 robot-name">{{.Nickname}}</h3>

View File

@ -28,8 +28,12 @@
<div class="lg:col-span-1">
<div class="clean-card overflow-hidden">
<div class="pattern-dots h-24 relative flex items-center justify-center bg-gray-50 border-b border-gray-100">
<div class="absolute w-20 h-20 rounded-full bg-white shadow-sm border border-gray-100 flex items-center justify-center">
<div class="absolute w-20 h-20 rounded-full bg-white shadow-sm border border-gray-100 flex items-center justify-center overflow-hidden">
{{if .Robot.Avatar}}
<img src="{{.Robot.Avatar}}" alt="WeChat Avatar" class="w-full h-full object-cover">
{{else}}
<i class="fas fa-robot text-3xl text-gray-500"></i>
{{end}}
</div>
</div>