Explorar o código

新增参数获取

longyu %!s(int64=2) %!d(string=hai) anos
pai
achega
2cd44bcfb6
Modificáronse 1 ficheiros con 11 adicións e 0 borrados
  1. 11 0
      controllers/wechat.go

+ 11 - 0
controllers/wechat.go

@@ -374,5 +374,16 @@ func (this *WechatCommonController) Notify() {
 	fmt.Println("signature:", signature)
 	fmt.Println("timestamp:", timestamp)
 	fmt.Println("nonce:", nonce)
+	body := this.Ctx.Input.RequestBody
+	paramsMap := this.Ctx.Input.Params()
+	fmt.Println("paramsMap")
+	fmt.Println(paramsMap)
+	paramsJson, err := json.Marshal(paramsMap)
+	if err != nil {
+		fmt.Println("json.Marshal Err:" + err.Error())
+	}
+
+	utils.FileLog.Info("notify result:" + string(body))
+	utils.FileLog.Info("notify paramsJson result:" + string(paramsJson))
 	this.Ctx.WriteString(echostr)
 }