Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
Update tp_scenario_strategy_service.go
Browse files Browse the repository at this point in the history
  • Loading branch information
November-12 committed Sep 28, 2023
1 parent e7d82a1 commit 83bd3b1
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions services/tp_scenario_strategy_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,32 @@ func (*TpScenarioStrategyService) GetTpScenarioStrategyDetail(tp_scenario_strate
if result.Error != nil {
return tp_scenario_strategy, result.Error
}

for i, action := range tp_scenario_action {
if value, ok := action["action_type"].(string); ok {
if value == "3" {
if instruct, ok := action["instruct"].(string); ok {
// 解析json
m := make(map[string]string)
json.Unmarshal([]byte(instruct), &m)
if warning_strategy_id, ok := m["warning_strategy_id"]; ok {

var tp_warning_strategy = make(map[string]interface{})
result := psql.Mydb.Model(models.TpWarningStrategy{}).Where(&models.TpWarningStrategy{Id: warning_strategy_id}).First(&tp_warning_strategy)
if result.Error != nil {
if !errors.Is(result.Error, gorm.ErrRecordNotFound) {
return tp_scenario_strategy, result.Error
}
}
tp_scenario_action[i]["warning_strategy"] = tp_warning_strategy

}

}
}
}
}

tp_scenario_strategy["scenario_actions"] = tp_scenario_action
return tp_scenario_strategy, nil
}
Expand Down

0 comments on commit 83bd3b1

Please sign in to comment.