作者 yangfu

fix tmpl

... ... @@ -8,21 +8,22 @@ package tmpl
var ControllerMethod =`
//{{.Method}}
func(this *{{.Controller}}Controller){{.Method}}(){
var msg *mybeego.Message
defer func(){
var msg *protocol.ResponseMessage
defer func() {
this.Resp(msg)
}()
var request *protocol.{{.Method}}Request
if err:=json.Unmarshal(this.ByteBody,&request);err!=nil{
log.Error(err)
msg = mybeego.NewMessage(1)
msg = protocol.BadRequestParam(1)
return
}
if b,m :=this.Valid(request);!b{
msg = m
return
}
msg = protocol.NewReturnResponse({{.ControllerLowcase}}.{{.Method}}(request))
header := controllers.GetRequestHeader(this.Ctx)
msg = protocol.NewReturnResponse({{.ControllerLowcase}}.{{.Method}}(header,request))
}
`
... ... @@ -37,7 +38,7 @@ type {{.Method}}Response struct {
//Method Login
var Handler =`
func {{.Method}}(request *protocol.{{.Method}}Request)(rsp *protocol.{{.Method}}Response,err error){
func {{.Method}}(header *protocol.RequestHeader,request *protocol.{{.Method}}Request)(rsp *protocol.{{.Method}}Response,err error){
var (
)
... ...