前台fix,回调

This commit is contained in:
wolter 2024-08-13 18:30:44 +08:00
parent 2f88c1be58
commit 6a977db12e
2 changed files with 8 additions and 4 deletions
app
services/thirdpay/thirdpay_notify
utils/httpclient

View File

@ -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,
}

View File

@ -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