模型超时

This commit is contained in:
2023-07-03 11:01:29 +08:00
parent e9637f85a7
commit fb780572e7
2 changed files with 11 additions and 0 deletions

View File

@@ -108,6 +108,10 @@ func (server *Server) InitModels() (err error) {
// 从数据库检查此模型hash是否存在
for _, item := range data {
// 打印为格式化的JSON
b, _ := json.MarshalIndent(item, "", " ")
fmt.Println(string(b))
var model Model
if err := configs.ORMDB().Where("hash = ?", item["sha256"].(string)).First(&model).Error; err != nil {
// 不存在则添加