作者 郑周

添加模板拷贝

@@ -85,7 +85,19 @@ func (controller *RuleController) ListRuleRelCreator() { @@ -85,7 +85,19 @@ func (controller *RuleController) ListRuleRelCreator() {
85 } 85 }
86 ua := middlewares.GetUser(controller.Ctx) 86 ua := middlewares.GetUser(controller.Ctx)
87 in.CompanyId = ua.CompanyId 87 in.CompanyId = ua.CompanyId
88 - //in.CompanyId = middlewares.GetCompanyId(controller.Ctx)  
89 controller.Response(ruService.ListRelCreator(in)) 88 controller.Response(ruService.ListRelCreator(in))
90 } 89 }
91 } 90 }
  91 +
  92 +func (controller *RuleController) ListCreator() {
  93 + ruService := service.NewEvaluationRuleService()
  94 + in := &command.QueryCreatorCommand{}
  95 + if err := controller.Unmarshal(in); err != nil {
  96 + controller.Response(nil, application.ThrowError(application.ARG_ERROR, err.Error()))
  97 + } else {
  98 +
  99 + ua := middlewares.GetUser(controller.Ctx)
  100 + in.CompanyId = ua.CompanyId
  101 + controller.Response(ruService.ListCreator(in))
  102 + }
  103 +}
@@ -111,8 +111,6 @@ func (controller *TemplateController) CopyTemplate() { @@ -111,8 +111,6 @@ func (controller *TemplateController) CopyTemplate() {
111 ua := middlewares.GetUser(controller.Ctx) 111 ua := middlewares.GetUser(controller.Ctx)
112 in.CompanyId = ua.CompanyId 112 in.CompanyId = ua.CompanyId
113 in.CreatorId = ua.UserId 113 in.CreatorId = ua.UserId
114 - //in.CompanyId = middlewares.GetCompanyId(controller.Ctx)  
115 - //in.CreatorId = middlewares.GetUserId(controller.Ctx)  
116 controller.Response(ruService.Copy(in)) 114 controller.Response(ruService.Copy(in))
117 } 115 }
118 } 116 }
@@ -15,6 +15,7 @@ func init() { @@ -15,6 +15,7 @@ func init() {
15 web.NSRouter("/", &controllers.RuleController{}, "Delete:RemoveRule"), 15 web.NSRouter("/", &controllers.RuleController{}, "Delete:RemoveRule"),
16 web.NSRouter("/:Id", &controllers.RuleController{}, "Get:GetRule"), 16 web.NSRouter("/:Id", &controllers.RuleController{}, "Get:GetRule"),
17 web.NSRouter("/list", &controllers.RuleController{}, "Post:ListRuleRelCreator"), 17 web.NSRouter("/list", &controllers.RuleController{}, "Post:ListRuleRelCreator"),
  18 + web.NSRouter("/list-creator", &controllers.RuleController{}, "Post:ListCreator"),
18 ) 19 )
19 web.AddNamespace(ns) 20 web.AddNamespace(ns)
20 } 21 }
@@ -16,6 +16,7 @@ func init() { @@ -16,6 +16,7 @@ func init() {
16 web.NSRouter("/:Id", &controllers.TemplateController{}, "Get:GetTemplate"), 16 web.NSRouter("/:Id", &controllers.TemplateController{}, "Get:GetTemplate"),
17 web.NSRouter("/list", &controllers.TemplateController{}, "Post:ListTemplate"), 17 web.NSRouter("/list", &controllers.TemplateController{}, "Post:ListTemplate"),
18 web.NSRouter("/list-enable", &controllers.TemplateController{}, "Post:ListEnableTemplate"), 18 web.NSRouter("/list-enable", &controllers.TemplateController{}, "Post:ListEnableTemplate"),
  19 + web.NSRouter("/copy", &controllers.TemplateController{}, "Post:CopyTemplate"),
19 ) 20 )
20 web.AddNamespace(ns) 21 web.AddNamespace(ns)
21 } 22 }