作者 yangfu

模板管理修改

1 #app的名称 1 #app的名称
2 appname = ability 2 appname = ability
3 #运行模式 3 #运行模式
4 -runmode =${ProRunMode||local} 4 +runmode =${ProRunMode||dev}
5 #是否自动渲染页面 5 #是否自动渲染页面
6 autorender = false 6 autorender = false
7 #是否复制请求body 7 #是否复制请求body
@@ -83,7 +83,7 @@ func (this *TemplateController) TemplateList() { @@ -83,7 +83,7 @@ func (this *TemplateController) TemplateList() {
83 defer func() { 83 defer func() {
84 this.ResposeJson(msg) 84 this.ResposeJson(msg)
85 }() 85 }()
86 - var request *protocol.TemplateUpdateRequest 86 + var request *protocol.TemplateListRequest
87 87
88 if err := json.Unmarshal(this.Ctx.Input.RequestBody, &request); err != nil { 88 if err := json.Unmarshal(this.Ctx.Input.RequestBody, &request); err != nil {
89 log.Error("json 解析失败", err) 89 log.Error("json 解析失败", err)
@@ -101,11 +101,40 @@ func (this *TemplateController) TemplateList() { @@ -101,11 +101,40 @@ func (this *TemplateController) TemplateList() {
101 msg = m 101 msg = m
102 return 102 return
103 } 103 }
104 - rsp, err := audit.TemplateUpdate(uid, companyId, request) 104 + rsp, err := audit.TemplateList(uid, companyId, request)
105 msg = protocol.NewReturnResponse(rsp, err) 105 msg = protocol.NewReturnResponse(rsp, err)
106 return 106 return
107 } 107 }
108 108
  109 +//TemplateGet
  110 +//@router /templateGet [post]
  111 +func (this *TemplateController) TemplateGet() {
  112 + var msg *protocol.ResponseMessage
  113 + defer func() {
  114 + this.ResposeJson(msg)
  115 + }()
  116 + var request *protocol.TemplateGetRequest
  117 +
  118 + if err := json.Unmarshal(this.Ctx.Input.RequestBody, &request); err != nil {
  119 + log.Error("json 解析失败", err)
  120 + msg = protocol.BadRequestParam("1")
  121 + return
  122 + }
  123 + uid := this.GetUserId()
  124 + companyId := this.GetCompanyId()
  125 + if companyId <= 0 {
  126 + log.Debug("companyId:%d err", companyId)
  127 + msg = protocol.BadRequestParam("1")
  128 + return
  129 + }
  130 + if b, m := this.Valid(request); !b {
  131 + msg = m
  132 + return
  133 + }
  134 + rsp, err := audit.TemplateGet(uid, companyId, request)
  135 + msg = protocol.NewReturnResponse(rsp, err)
  136 +}
  137 +
109 //TemplateEditVisible 138 //TemplateEditVisible
110 //@router /templateEditVisible [post] 139 //@router /templateEditVisible [post]
111 func (this *TemplateController) TemplateEditVisible() { 140 func (this *TemplateController) TemplateEditVisible() {
@@ -56,6 +56,14 @@ func init() { @@ -56,6 +56,14 @@ func init() {
56 beego.NSRouter("/role", &controllers.CommonController{}, "post:SelectorRole"), 56 beego.NSRouter("/role", &controllers.CommonController{}, "post:SelectorRole"),
57 beego.NSRouter("/position", &controllers.CommonController{}, "post:SelectorPosition"), 57 beego.NSRouter("/position", &controllers.CommonController{}, "post:SelectorPosition"),
58 ), 58 ),
  59 + beego.NSNamespace("/template",
  60 + beego.NSRouter("/add", &controllers.TemplateController{}, "post:TemplateAdd"),
  61 + beego.NSRouter("/list", &controllers.TemplateController{}, "post:TemplateList"),
  62 + beego.NSRouter("/get", &controllers.TemplateController{}, "post:TemplateGet"),
  63 + beego.NSRouter("/update", &controllers.TemplateController{}, "post:TemplateUpdate"),
  64 + beego.NSRouter("/editVisible", &controllers.TemplateController{}, "post:TemplateEditVisible"),
  65 + beego.NSRouter("/operateCategory", &controllers.TemplateController{}, "post:TemplateOperateCategory"),
  66 + ),
59 ) 67 )
60 68
61 nsAuth := beego.NewNamespace("/auth", 69 nsAuth := beego.NewNamespace("/auth",