|
@@ -69,7 +69,7 @@ func (a ruleChainService) create(params *models.RuleChainParams) error {
|
|
|
|
|
|
nodeMap := make(map[string]models.RuleNode)
|
|
nodeMap := make(map[string]models.RuleNode)
|
|
var inputNodeId string
|
|
var inputNodeId string
|
|
- for _, v := range params.Cell {
|
|
|
|
|
|
+ for _, v := range params.Cells {
|
|
if v.Shape != "edge" {
|
|
if v.Shape != "edge" {
|
|
if v.Shape == "input-node" {
|
|
if v.Shape == "input-node" {
|
|
inputNodeId = v.Source.Cell
|
|
inputNodeId = v.Source.Cell
|
|
@@ -128,7 +128,7 @@ func (a ruleChainService) create(params *models.RuleChainParams) error {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- for _, v := range params.Cell {
|
|
|
|
|
|
+ for _, v := range params.Cells {
|
|
if v.Shape == "edge" && v.Source.Cell != inputNodeId {
|
|
if v.Shape == "edge" && v.Source.Cell != inputNodeId {
|
|
err := a.model.Relation.Create(&models.Relation{
|
|
err := a.model.Relation.Create(&models.Relation{
|
|
RecordId: guid.S(),
|
|
RecordId: guid.S(),
|
|
@@ -201,10 +201,15 @@ func (a ruleChainService) Update(params *models.RuleChainParams) error {
|
|
if err != nil {
|
|
if err != nil {
|
|
return err
|
|
return err
|
|
}
|
|
}
|
|
- if len(params.Cell) > 0 {
|
|
|
|
|
|
+ if params.Cell != nil {
|
|
|
|
+
|
|
marshal, _ := json.Marshal(params.Cell)
|
|
marshal, _ := json.Marshal(params.Cell)
|
|
ruleChain.Configuration = string(marshal)
|
|
ruleChain.Configuration = string(marshal)
|
|
|
|
|
|
|
|
+ err = json.Unmarshal(marshal, ¶ms.Cells)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return err
|
|
|
|
+ }
|
|
err = a.create(params)
|
|
err = a.create(params)
|
|
if err != nil {
|
|
if err != nil {
|
|
return err
|
|
return err
|