feat(equalize): 添加目标曲线获取及缓存功能

- 新增CurveCache实现Redis曲线数据缓存与分布式锁机制,避免重复请求
- 增加CurveHandler支持目标曲线接口,通过EQ API获取并缓存曲线数据
- Config新增EqualizeConfig配置,支持环境变量动态配置
- Repository新增CurveRepository,按brand和name查询模型与目标曲线数据
- 路由更新,集成/getCurve接口处理目标曲线请求
- OTA模型字段优化,bool类型改为BoolInt,实现数据库int与JSON bool映射
- 统一响应格式,调整response包中OK和Fail函数消息字段命名
- 修改服务端配置默认DB IP,支持Equalize参数传递到路由层
- 新增CSV解析实现,从文件读取测量与目标曲线数据
- 修改OTA处理逻辑,修复定向升级判断bug
- Java层新增EqualizeController和ModelService对应功能,保持客户端接口兼容与调用逻辑一致
This commit is contained in:
eafonyang
2026-06-01 19:08:43 +08:00
parent 665397ede7
commit c4cd8b6f5d
16 changed files with 1085 additions and 26 deletions
+34 -10
View File
@@ -1,27 +1,51 @@
package model
import "time"
import (
"database/sql"
"time"
)
// BoolInt 数据库存储为 int(1/0)JSON 序列化为 bool(true/false)
type BoolInt bool
func (b *BoolInt) Scan(value interface{}) error {
if value == nil {
*b = false
return nil
}
switch v := value.(type) {
case int64:
*b = v == 1
case []byte:
*b = len(v) > 0 && v[0] == '1'
default:
*b = false
}
return nil
}
var _ sql.Scanner = (*BoolInt)(nil)
// OTA 固件升级记录
type OTA struct {
ID int `json:"id"`
ID int `json:"-"`
VerCode int `json:"verCode"`
VerName string `json:"verName"`
URL string `json:"url"`
MD5 string `json:"md5"`
Force int `json:"force"`
Force BoolInt `json:"force"`
Desc *string `json:"desc,omitempty"`
Model *string `json:"model,omitempty"`
HW int `json:"hw"`
Target int `json:"target"`
Beta int `json:"beta"`
PawVerCode int `json:"pawVerCode"`
PawVerName string `json:"pawVerName"`
PawURL string `json:"pawUrl"`
PawMD5 string `json:"pawMd5"`
Target BoolInt `json:"target"`
Beta BoolInt `json:"beta"`
PawVerCode int `json:"-"`
PawVerName string `json:"-"`
PawURL string `json:"-"`
PawMD5 string `json:"-"`
StartTime *time.Time `json:"startTime,omitempty"`
EndTime *time.Time `json:"endTime,omitempty"`
Status int `json:"status"`
Status int `json:"-"`
}
// BlackList OTA 黑名单
+13
View File
@@ -0,0 +1,13 @@
package model
import "time"
// Target 目标曲线
type Target struct {
ID int `json:"id"`
Label string `json:"label"`
ReadCSV BoolInt `json:"readCsv"`
File *string `json:"file,omitempty"`
BassBoost *string `json:"bassBoost,omitempty"`
CreateAt time.Time `json:"createAt"`
}