前台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

View File

@ -110,15 +110,19 @@ func (o *OrderNotify) sendNotify(body *OrderNotifySendContent) {
if err != nil || string(resByte) != "success" { if err != nil || string(resByte) != "success" {
o.Code = errorcode.NotifySendFail o.Code = errorcode.NotifySendFail
callbackStatus = common.STATUS_DISABLED 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) { go func(orderId int64, status int, request, response string) {
repo := data.NewOrderCallbackLogRepo(ordercallbacklogmodel.GetInstance().GetDb()) repo := data.NewOrderCallbackLogRepo(ordercallbacklogmodel.GetInstance().GetDb())
log := ordercallbacklogmodel.OrderCallbackLog{ log := ordercallbacklogmodel.OrderCallbackLog{
OrderId: orderId, OrderId: orderId,
MerchantRequest: string(bodyByte), MerchantRequest: request,
Status: status, Status: status,
MerchantResponse: response, MerchantResponse: response,
} }

View File

@ -21,7 +21,7 @@ func FastHttpPost(url string, header map[string]string, body []byte, timeout int
resp := fasthttp.AcquireResponse() resp := fasthttp.AcquireResponse()
defer fasthttp.ReleaseResponse(resp) // 用完需要释放资源 defer fasthttp.ReleaseResponse(resp) // 用完需要释放资源
var err error var err error
if timeout > 0 { if timeout <= 0 {
if err = fasthttp.Do(req, resp); err != nil { if err = fasthttp.Do(req, resp); err != nil {
utils.Log(nil, "http请求失败", err, url) utils.Log(nil, "http请求失败", err, url)
return nil, err return nil, err