boweniac 8 maanden geleden
bovenliggende
commit
19076432cd

+ 15 - 4
internal/logic/sop_node/create_sop_node_logic.go

@@ -2,6 +2,7 @@ package sop_node
 
 import (
 	"context"
+	"fmt"
 	"wechat-api/ent/custom_types"
 	"wechat-api/ent/sopstage"
 	"wechat-api/internal/svc"
@@ -40,14 +41,24 @@ func (l *CreateSopNodeLogic) CreateSopNode(req *types.SopNodeInfo) (*types.SopNo
 	if task.Status != 1 {
 		return nil, dberrorhandler.DefaultEntError(l.Logger, err, req)
 	}
-
+	fmt.Printf("req.ActionMessage: %+v\n", req.ActionMessage)
 	var actionMessage []custom_types.Action
 	if len(req.ActionMessage) > 0 {
 		actionMessage = make([]custom_types.Action, len(req.ActionMessage))
 		for i, condition := range req.ActionMessage {
-			actionMessage[i] = custom_types.Action{
-				Type:    condition.Type,
-				Content: condition.Content,
+			if condition.Type == 1 {
+				actionMessage[i] = custom_types.Action{
+					Type:    condition.Type,
+					Content: condition.Content,
+				}
+			} else {
+				actionMessage[i] = custom_types.Action{
+					Type:    condition.Type,
+					Content: condition.Content,
+					Meta: &custom_types.Meta{
+						Filename: condition.Meta.Filename,
+					},
+				}
 			}
 		}
 	}

+ 13 - 3
internal/logic/sop_node/update_sop_node_logic.go

@@ -49,9 +49,19 @@ func (l *UpdateSopNodeLogic) UpdateSopNode(req *types.SopNodeInfo) (*types.BaseM
 	if len(req.ActionMessage) > 0 {
 		actionMessage = make([]custom_types.Action, len(req.ActionMessage))
 		for i, condition := range req.ActionMessage {
-			actionMessage[i] = custom_types.Action{
-				Type:    condition.Type,
-				Content: condition.Content,
+			if condition.Type == 1 {
+				actionMessage[i] = custom_types.Action{
+					Type:    condition.Type,
+					Content: condition.Content,
+				}
+			} else {
+				actionMessage[i] = custom_types.Action{
+					Type:    condition.Type,
+					Content: condition.Content,
+					Meta: &custom_types.Meta{
+						Filename: condition.Meta.Filename,
+					},
+				}
 			}
 		}
 	}

+ 13 - 3
internal/logic/sop_stage/create_sop_stage_logic.go

@@ -58,9 +58,19 @@ func (l *CreateSopStageLogic) CreateSopStage(req *types.SopStageInfo) (*types.So
 	if len(req.ActionMessage) > 0 {
 		actionMessage = make([]custom_types.Action, len(req.ActionMessage))
 		for i, condition := range req.ActionMessage {
-			actionMessage[i] = custom_types.Action{
-				Type:    condition.Type,
-				Content: condition.Content,
+			if condition.Type == 1 {
+				actionMessage[i] = custom_types.Action{
+					Type:    condition.Type,
+					Content: condition.Content,
+				}
+			} else {
+				actionMessage[i] = custom_types.Action{
+					Type:    condition.Type,
+					Content: condition.Content,
+					Meta: &custom_types.Meta{
+						Filename: condition.Meta.Filename,
+					},
+				}
 			}
 		}
 	}

+ 13 - 3
internal/logic/sop_stage/update_sop_stage_logic.go

@@ -56,9 +56,19 @@ func (l *UpdateSopStageLogic) UpdateSopStage(req *types.SopStageInfo) (*types.Ba
 	if len(req.ActionMessage) > 0 {
 		actionMessage = make([]custom_types.Action, len(req.ActionMessage))
 		for i, condition := range req.ActionMessage {
-			actionMessage[i] = custom_types.Action{
-				Type:    condition.Type,
-				Content: condition.Content,
+			if condition.Type == 1 {
+				actionMessage[i] = custom_types.Action{
+					Type:    condition.Type,
+					Content: condition.Content,
+				}
+			} else {
+				actionMessage[i] = custom_types.Action{
+					Type:    condition.Type,
+					Content: condition.Content,
+					Meta: &custom_types.Meta{
+						Filename: condition.Meta.Filename,
+					},
+				}
 			}
 		}
 	}

+ 1 - 1
wechat.go

@@ -38,7 +38,7 @@ var configFile = flag.String("f", "etc/wechat.yaml", "the config file")
 
 func main() {
 	flag.Parse()
-	
+
 	var c config.Config
 	conf.MustLoad(*configFile, &c, conf.UseEnv())