zhangchuanxing 3 mēneši atpakaļ
vecāks
revīzija
a78b933766
1 mainītis faili ar 8 papildinājumiem un 8 dzēšanām
  1. 8 8
      controllers/wechat.go

+ 8 - 8
controllers/wechat.go

@@ -411,7 +411,7 @@ func (this *WechatController) UserInfo() {
 // @Success 200 {object} models.WechatSign
 // @router /notify [get,post]
 func (this *WechatCommonController) Notify() {
-	//echostr := this.GetString("echostr")
+	echostr := this.GetString("echostr")
 	method := this.Ctx.Input.Method()
 	//添加请求日志记录
 	itemApiLog := new(models.CygxThreeApiLog)
@@ -421,7 +421,7 @@ func (this *WechatCommonController) Notify() {
 	itemApiLog.Body = ""
 	if method == "POST" {
 		body := this.Ctx.Input.RequestBody
-		utils.FileLog.Info("wechat notify:" + string(body))
+		utils.FileLog.Info("wechat echostr:" + string(body))
 		itemApiLog.Result = string(body)
 	}
 
@@ -429,11 +429,11 @@ func (this *WechatCommonController) Notify() {
 	if method == "POST" {
 		body := this.Ctx.Input.RequestBody
 		utils.FileLog.Info("wechat notify:" + string(body))
-		fmt.Println(string(body))
-		if string(body) == "" {
-			this.Ctx.WriteString("hongze")
-			return
-		}
+		//fmt.Println(string(body))
+		//if string(body) == "" {
+		//	this.Ctx.WriteString("hongze")
+		//	return
+		//}
 
 		item := new(models.Notify)
 		err := xml.Unmarshal(body, &item)
@@ -530,6 +530,6 @@ func (this *WechatCommonController) Notify() {
 		returnResult = "hongze"
 		this.Ctx.WriteString(returnResult)
 	} else {
-		this.Ctx.WriteString("hongze")
+		this.Ctx.WriteString(echostr)
 	}
 }