|
@@ -455,6 +455,7 @@ func (this *WechatCommonController) WxpayNotify() {
|
|
|
this.ServeJSON()
|
|
|
}()
|
|
|
body := this.Ctx.Input.RequestBody
|
|
|
+ resp := new(order.WechatPayNotifyUrlJson)
|
|
|
//utils.FileLog.Info("wechat notify:" + string(body))
|
|
|
item := new(models.CygxShanghaiCompanyLog)
|
|
|
item.CreateTime = time.Now()
|
|
@@ -462,10 +463,18 @@ func (this *WechatCommonController) WxpayNotify() {
|
|
|
item.Result = string(body)
|
|
|
go models.AddCygxShanghaiCompanyLog(item)
|
|
|
itemNotify := services.WxDecodeNotify(body)
|
|
|
+ if itemNotify == nil {
|
|
|
+ resp.Code = "FAIL"
|
|
|
+ resp.Message = "失败"
|
|
|
+ br.Ret = 400
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
if itemNotify.OutTradeNo != "" {
|
|
|
- go services.HandleOrderHandle(itemNotify)
|
|
|
+ go services.HandleOrderByWechatPay(itemNotify)
|
|
|
}
|
|
|
- br.Data = itemNotify
|
|
|
+ resp.Code = "SUCCESS"
|
|
|
+ br.Data = resp
|
|
|
br.Ret = 200
|
|
|
br.Success = true
|
|
|
}
|
|
@@ -481,31 +490,36 @@ func (this *WechatCommonController) WxpayRefundsNotify() {
|
|
|
this.ServeJSON()
|
|
|
}()
|
|
|
body := this.Ctx.Input.RequestBody
|
|
|
+ resp := new(order.WechatPayNotifyUrlJson)
|
|
|
//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
|
|
|
+
|
|
|
itemNotify := services.WxDecodeNotify(body)
|
|
|
- if itemNotify.OutTradeNo != "" {
|
|
|
- go services.HandleOrderRefundHandle(itemNotify)
|
|
|
- }
|
|
|
|
|
|
- outTradeNo := itemNotify.OutTradeNo
|
|
|
- orderDetail, e := order.GetCygxOrderDetailByOutTradeNo(outTradeNo)
|
|
|
- if e != nil {
|
|
|
+ if itemNotify == nil {
|
|
|
+ resp.Code = "FAIL"
|
|
|
+ resp.Message = "失败"
|
|
|
+ br.Ret = 400
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- //go AddCygxOrderPayment(itemCallback) // 记录支付交易信息
|
|
|
-
|
|
|
- //修改过状态的不再二次处理
|
|
|
- if orderDetail.OrderStatus != 3 {
|
|
|
- go models.AddCygxShanghaiCompanyLog(item)
|
|
|
+ if itemNotify.OutTradeNo != "" {
|
|
|
+ go services.HandleOrderRefundByWechatPay(itemNotify)
|
|
|
+ outTradeNo := itemNotify.OutTradeNo
|
|
|
+ orderDetail, err := order.GetCygxOrderDetailByOutTradeNo(outTradeNo)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ //修改过状态的不再二次处理
|
|
|
+ if orderDetail.OrderStatus != 3 {
|
|
|
+ go models.AddCygxShanghaiCompanyLog(item)
|
|
|
+ }
|
|
|
}
|
|
|
- br.Data = itemNotify
|
|
|
+
|
|
|
+ br.Data = resp
|
|
|
br.Ret = 200
|
|
|
br.Success = true
|
|
|
}
|