Browse Source

no message

xingzai 1 year ago
parent
commit
f62f857ca2
2 changed files with 38 additions and 1 deletions
  1. 29 1
      controllers/wechat.go
  2. 9 0
      routers/commentsRouter.go

+ 29 - 1
controllers/wechat.go

@@ -462,7 +462,35 @@ func (this *WechatCommonController) WxpayNotify() {
 	if itemNotify.OutTradeNo != "" {
 		go services.HandleOrderHandle(itemNotify)
 	}
-	br.Data = itemNotify
+	//br.Data = itemNotify
+	br.Ret = 200
+	br.Success = true
+}
+
+// @Title 微信付款回调接口
+// @Description 微信付款回调接口
+// @Success 200 {object} models.WxLoginResp
+// @router /wxpay/refunds/notify [post]
+func (this *WechatCommonController) WxpayRefundsNotify() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	body := this.Ctx.Input.RequestBody
+	//utils.FileLog.Info("wechat notify:" + string(body))
+	item := new(models.CygxShanghaiCompanyLog)
+	item.CreateTime = time.Now()
+	//item.Body = jsonCompany
+	item.Result = string(body)
+	fmt.Println(item.Result)
+	//return
+	go models.AddCygxShanghaiCompanyLog(item)
+	//itemNotify := services.WxDecodeNotify(body)
+	//if itemNotify.OutTradeNo != "" {
+	//	go services.HandleOrderHandle(itemNotify)
+	//}
+	//br.Data = itemNotify
 	br.Ret = 200
 	br.Success = true
 }

+ 9 - 0
routers/commentsRouter.go

@@ -727,6 +727,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:WechatCommonController"] = append(beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:WechatCommonController"],
+        beego.ControllerComments{
+            Method: "WxpayRefundsNotify",
+            Router: `/wxpay/refunds/notify`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:WechatController"] = append(beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:WechatController"],
         beego.ControllerComments{
             Method: "GetEmailCode",