Merge branch 'dev-zhengzhou' into test
正在显示
3 个修改的文件
包含
6 行增加
和
0 行删除
@@ -12,6 +12,7 @@ type CreateTemplateCommand struct { | @@ -12,6 +12,7 @@ type CreateTemplateCommand struct { | ||
12 | Name string `cname:"模板名称" json:"name" valid:"Required"` | 12 | Name string `cname:"模板名称" json:"name" valid:"Required"` |
13 | Describe string `cname:"模板描述" json:"describe"` | 13 | Describe string `cname:"模板描述" json:"describe"` |
14 | NodeContents []*domain.NodeContent `cname:"环节-评估内容" json:"nodeContents"` | 14 | NodeContents []*domain.NodeContent `cname:"环节-评估内容" json:"nodeContents"` |
15 | + State int `cname:"状态(0待完成配置、1待启用、2启用、3停用)"` | ||
15 | } | 16 | } |
16 | 17 | ||
17 | func (in *CreateTemplateCommand) Valid(validation *validation.Validation) { | 18 | func (in *CreateTemplateCommand) Valid(validation *validation.Validation) { |
@@ -93,6 +93,10 @@ func (rs *EvaluationTemplateService) Create(in *command.CreateTemplateCommand) ( | @@ -93,6 +93,10 @@ func (rs *EvaluationTemplateService) Create(in *command.CreateTemplateCommand) ( | ||
93 | State: domain.TemplateStateWaitConfig, | 93 | State: domain.TemplateStateWaitConfig, |
94 | LinkNodes: linkNodes, | 94 | LinkNodes: linkNodes, |
95 | } | 95 | } |
96 | + if in.State > domain.TemplateStateWaitConfig { | ||
97 | + newTemplate.State = in.State | ||
98 | + } | ||
99 | + | ||
96 | template, err := templateRepository.Insert(newTemplate) | 100 | template, err := templateRepository.Insert(newTemplate) |
97 | if err != nil { | 101 | if err != nil { |
98 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 102 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
@@ -422,6 +422,7 @@ func (controller *ImportController) parserAndInsert(file *os.File, fileName stri | @@ -422,6 +422,7 @@ func (controller *ImportController) parserAndInsert(file *os.File, fileName stri | ||
422 | in.Name = nameOnly | 422 | in.Name = nameOnly |
423 | in.Describe = "" | 423 | in.Describe = "" |
424 | in.NodeContents = list | 424 | in.NodeContents = list |
425 | + in.State = domain.TemplateStateWaitActive | ||
425 | 426 | ||
426 | if _, err := ruService.Create(in); err != nil { | 427 | if _, err := ruService.Create(in); err != nil { |
427 | return application.ThrowError(application.ARG_ERROR, err.Error()) | 428 | return application.ThrowError(application.ARG_ERROR, err.Error()) |
-
请 注册 或 登录 后发表评论