作者 yangfu

注入用户

@@ -107,6 +107,13 @@ func FilterComm(ctx *context.Context) { @@ -107,6 +107,13 @@ func FilterComm(ctx *context.Context) {
107 if beego.BConfig.RunMode == "dev" && (ctx.Input.Header("x-mmm-uid") != "" || ctx.Input.Header("uid") != "") { 107 if beego.BConfig.RunMode == "dev" && (ctx.Input.Header("x-mmm-uid") != "" || ctx.Input.Header("uid") != "") {
108 return 108 return
109 } 109 }
  110 + //TODO:注入账号,后期移除掉
  111 + if beego.BConfig.RunMode != "prod" {
  112 + ctx.Request.Header.Add("x-mmm-uid", fmt.Sprintf("%v", 1))
  113 + ctx.Request.Header.Add("x-mmm-cid", fmt.Sprintf("%v", 1))
  114 + ctx.Request.Header.Add("x-mmm-id", fmt.Sprintf("%v", 1))
  115 + return
  116 + }
110 //1.检查签名 117 //1.检查签名
111 if !CheckSign(ctx) { 118 if !CheckSign(ctx) {
112 return 119 return
1 -package routers  
2 -  
3 -import (  
4 - "github.com/astaxie/beego"  
5 - "github.com/astaxie/beego/context/param"  
6 -)  
7 -  
8 -func init() {  
9 -  
10 - beego.GlobalControllerRouter["opp/controllers:H5Controller"] = append(beego.GlobalControllerRouter["opp/controllers:H5Controller"],  
11 - beego.ControllerComments{  
12 - Method: "Announcement",  
13 - Router: `/announcement`,  
14 - AllowHTTPMethods: []string{"post"},  
15 - MethodParams: param.Make(),  
16 - Params: nil})  
17 -  
18 - beego.GlobalControllerRouter["opp/controllers:H5Controller"] = append(beego.GlobalControllerRouter["opp/controllers:H5Controller"],  
19 - beego.ControllerComments{  
20 - Method: "AnnouncementSubmit",  
21 - Router: `/announcementSubmit`,  
22 - AllowHTTPMethods: []string{"post"},  
23 - MethodParams: param.Make(),  
24 - Params: nil})  
25 -  
26 -}