添加 submit 表记录每次提交配置;顺序排列提交配置

This commit is contained in:
2025-09-23 19:01:49 +08:00
parent d70bdaae16
commit 923ca32b98
4 changed files with 56 additions and 6 deletions

27
actions/submit.go Normal file
View File

@@ -0,0 +1,27 @@
package actions
import (
"encoding/json"
"fmt"
"time"
"zzman/clients/jd"
"zzman/model"
)
func RecordSubmit(time time.Time, gatewat model.Gateway, edges []jd.EdgeInfo) error {
config, err := json.Marshal(edges)
if err != nil {
return fmt.Errorf("序列化提交数据失败:%w", err)
}
err = model.DB.Create(&model.Submit{
Time: time,
Gateway: gatewat.Macaddr,
Config: string(config),
}).Error
if err != nil {
return fmt.Errorf("保存提交记录失败:%w", err)
}
return nil
}