diff --git a/app/services/thirdpay/thirdpay_notify/notify.go b/app/services/thirdpay/thirdpay_notify/notify.go index 977f31a..4749c00 100644 --- a/app/services/thirdpay/thirdpay_notify/notify.go +++ b/app/services/thirdpay/thirdpay_notify/notify.go @@ -110,15 +110,19 @@ func (o *OrderNotify) sendNotify(body *OrderNotifySendContent) { if err != nil || string(resByte) != "success" { o.Code = errorcode.NotifySendFail callbackStatus = common.STATUS_DISABLED - response = "url=" + o.app.NotifyUrl + "|error=" + err.Error() + if err != nil { + response = " | url=" + o.app.NotifyUrl + " | error=" + err.Error() + } else { + response = " | url=" + o.app.NotifyUrl + } } - response = string(resByte) + response + response = "response=" + string(resByte) + response // 记录回调日志 go func(orderId int64, status int, request, response string) { repo := data.NewOrderCallbackLogRepo(ordercallbacklogmodel.GetInstance().GetDb()) log := ordercallbacklogmodel.OrderCallbackLog{ OrderId: orderId, - MerchantRequest: string(bodyByte), + MerchantRequest: request, Status: status, MerchantResponse: response, } diff --git a/app/utils/httpclient/fasthttp.go b/app/utils/httpclient/fasthttp.go index 42f78eb..f79b3f9 100644 --- a/app/utils/httpclient/fasthttp.go +++ b/app/utils/httpclient/fasthttp.go @@ -21,7 +21,7 @@ func FastHttpPost(url string, header map[string]string, body []byte, timeout int resp := fasthttp.AcquireResponse() defer fasthttp.ReleaseResponse(resp) // 用完需要释放资源 var err error - if timeout > 0 { + if timeout <= 0 { if err = fasthttp.Do(req, resp); err != nil { utils.Log(nil, "http请求失败", err, url) return nil, err