正在显示
1 个修改的文件
包含
6 行增加
和
5 行删除
| @@ -8,21 +8,22 @@ package tmpl | @@ -8,21 +8,22 @@ package tmpl | ||
| 8 | var ControllerMethod =` | 8 | var ControllerMethod =` |
| 9 | //{{.Method}} | 9 | //{{.Method}} |
| 10 | func(this *{{.Controller}}Controller){{.Method}}(){ | 10 | func(this *{{.Controller}}Controller){{.Method}}(){ |
| 11 | - var msg *mybeego.Message | ||
| 12 | - defer func(){ | 11 | + var msg *protocol.ResponseMessage |
| 12 | + defer func() { | ||
| 13 | this.Resp(msg) | 13 | this.Resp(msg) |
| 14 | }() | 14 | }() |
| 15 | var request *protocol.{{.Method}}Request | 15 | var request *protocol.{{.Method}}Request |
| 16 | if err:=json.Unmarshal(this.ByteBody,&request);err!=nil{ | 16 | if err:=json.Unmarshal(this.ByteBody,&request);err!=nil{ |
| 17 | log.Error(err) | 17 | log.Error(err) |
| 18 | - msg = mybeego.NewMessage(1) | 18 | + msg = protocol.BadRequestParam(1) |
| 19 | return | 19 | return |
| 20 | } | 20 | } |
| 21 | if b,m :=this.Valid(request);!b{ | 21 | if b,m :=this.Valid(request);!b{ |
| 22 | msg = m | 22 | msg = m |
| 23 | return | 23 | return |
| 24 | } | 24 | } |
| 25 | - msg = protocol.NewReturnResponse({{.ControllerLowcase}}.{{.Method}}(request)) | 25 | + header := controllers.GetRequestHeader(this.Ctx) |
| 26 | + msg = protocol.NewReturnResponse({{.ControllerLowcase}}.{{.Method}}(header,request)) | ||
| 26 | } | 27 | } |
| 27 | ` | 28 | ` |
| 28 | 29 | ||
| @@ -37,7 +38,7 @@ type {{.Method}}Response struct { | @@ -37,7 +38,7 @@ type {{.Method}}Response struct { | ||
| 37 | 38 | ||
| 38 | //Method Login | 39 | //Method Login |
| 39 | var Handler =` | 40 | var Handler =` |
| 40 | - func {{.Method}}(request *protocol.{{.Method}}Request)(rsp *protocol.{{.Method}}Response,err error){ | 41 | + func {{.Method}}(header *protocol.RequestHeader,request *protocol.{{.Method}}Request)(rsp *protocol.{{.Method}}Response,err error){ |
| 41 | var ( | 42 | var ( |
| 42 | 43 | ||
| 43 | ) | 44 | ) |
-
请 注册 或 登录 后发表评论