From 6a977db12e0ae2f0f1ae5ba8fa677a3e896834ce Mon Sep 17 00:00:00 2001
From: wolter <wolter@yourdomain.com>
Date: Tue, 13 Aug 2024 18:30:44 +0800
Subject: [PATCH] =?UTF-8?q?=E5=89=8D=E5=8F=B0fix=EF=BC=8C=E5=9B=9E?=
 =?UTF-8?q?=E8=B0=83?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/services/thirdpay/thirdpay_notify/notify.go | 10 +++++++---
 app/utils/httpclient/fasthttp.go                |  2 +-
 2 files changed, 8 insertions(+), 4 deletions(-)

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