From bc37c44c45d08c2cb42822e08adf429f4bcffb51 Mon Sep 17 00:00:00 2001 From: zhaoqingang <zhaoqg0118@163.com> Date: 星期一, 10 二月 2025 11:36:20 +0800 Subject: [PATCH] 测试 场景分析 bug --- db/db.go | 85 +++++++++++++++++++++++++++++++++++++++--- 1 files changed, 79 insertions(+), 6 deletions(-) diff --git a/db/db.go b/db/db.go index b23ab8c..6ed04f8 100644 --- a/db/db.go +++ b/db/db.go @@ -63,7 +63,7 @@ }, Name: "鐤戜技鑱氶泦", Description: "閫氱敤鑱氶泦妯″瀷", - Version: "v1.0.1", + Version: "v1.0.2", Enabled: false, }, { @@ -72,13 +72,31 @@ }, Name: "鐤戜技鑴辩", Description: "閫氱敤鑴辩妯″瀷", + Version: "v1.1.0", + Enabled: false, + }, { + BaseModel: BaseModel{ + ID: ModelIdLocationAnalysis, + }, + Name: "閲嶇偣鍦烘墍鍒嗘瀽", + Description: "閫氱敤鍦烘墍鍒嗘瀽妯″瀷", Version: "v1.0.0", Enabled: false, }, + //{ + // BaseModel: BaseModel{ + // ID: ModelIdNightAnalysis, + // }, + // Name: "鏄间紡澶滃嚭鍒嗘瀽", + // Description: "鏄间紡澶滃嚭鍒嗘瀽", + // Version: "v1.0.0", + // Enabled: false, + //}, } for i := range models { - if err := GetDB().Model(models[i]).First(models[i].ID).Error; err != nil { + var existingModel Model + if err := GetDB().Model(models[i]).Where("id = ?", models[i].ID).First(&existingModel).Error; err != nil { GetDB().Model(models[i]).Create(models[i]) } else { GetDB().Model(models[i]).Update("version", models[i].Version) @@ -154,6 +172,8 @@ Sort: 3, }, }, + + // 鎵樼 { Id: "7a1f0a3a-c207-4d94-bc28-cc9e017b3628", ModelId: ModelIdDisappear, @@ -178,14 +198,14 @@ RuleArg: RuleArg{ Alias: "age", Name: "骞撮緞娈�", - Type: "input", - Must: true, + Type: "range", + Must: false, Unit: "宀�", Range: "1,100", Value: "60, 90", ValType: "int", Operator: "==", - Sort: 1, + Sort: 2, }, }, { @@ -193,7 +213,7 @@ ModelId: ModelIdDisappear, Scope: "", RuleArg: RuleArg{ - Alias: "age", + Alias: "lastDirection", Name: "杩涘嚭鏂瑰悜", Type: "input", Must: false, @@ -202,9 +222,62 @@ Value: "", ValType: "string", Operator: "==", + Sort: 1, + }, + }, + + // 鍦烘墍鍒嗘瀽 + { + Id: "3f667e5a-bd10-4673-be45-f385e19a9c25", + ModelId: ModelIdLocationAnalysis, + Scope: "", + RuleArg: RuleArg{ + Alias: "duration", + Name: "鏃堕棿娈�", + Type: "input", + Must: false, + Unit: "澶�", + Range: "1,2400", + Value: "30", + ValType: "int", + Operator: ">=", Sort: 2, }, }, + { + Id: "ce298639-0cf8-4a8f-89f9-a932034a1e86", + ModelId: ModelIdLocationAnalysis, + Scope: "", + RuleArg: RuleArg{ + Alias: "personCount", + Name: "鍑虹幇浜烘暟", + Type: "input", + Must: true, + Unit: "涓�", + Range: "1,100", + Value: "1, 90", + ValType: "int", + Operator: ">=", + Sort: 0, + }, + }, + { + Id: "f85ae400-0114-4862-99f7-14a41530d235", + ModelId: ModelIdLocationAnalysis, + Scope: "", + RuleArg: RuleArg{ + Alias: "appearances", + Name: "鍑虹幇娆℃暟", + Type: "input", + Must: true, + Unit: "", + Range: "", + Value: "", + ValType: "int", + Operator: ">=", + Sort: 1, + }, + }, } for i := range rules { -- Gitblit v1.8.0