feat(share): 新增 shareList 接口 + 分享码模块全链路优化
- 新增 GET /audio/shareList?mac=xx 查询未过期分享码(纯 Redis,ZSET 索引)
- share:mac:{mac} 从 SET 改为 ZSET(score=expire_at),支持 ZREMRANGEBYSCORE 精确过期清理
- 空 ZSET 自动 DEL,避免 key 累积
- share:import:pending 增加 12h 兜底 TTL,防止 DB 不可用时内存泄漏
- 导入日志 field 改为 mac:code(去掉 nanotime),同 MAC+code 多次导入幂等去重
- MarkPersisted 保存/恢复 PTTL,防御性编程
- shareCreate 改为 POST + JSON body
- 全量 handler 补充 Swagger 注释,集成 swag 文档生成
- Makefile 使用 $(go env GOPATH)/bin/swag 解决 PATH 问题
This commit is contained in:
@@ -564,6 +564,50 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/audio/shareList": {
|
||||
"get": {
|
||||
"description": "根据设备 MAC 地址查询该设备尚未过期的所有分享码(仅查询 Redis,依赖 TTL 自动过期)",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"ShareCode"
|
||||
],
|
||||
"summary": "查询未过期分享码",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "设备 MAC 地址",
|
||||
"name": "mac",
|
||||
"in": "query",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "成功返回 share_codes 列表",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "参数校验失败",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "系统错误",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user