From 9a413afa51e28b5c9db7aa00ebf0490eca31f28b Mon Sep 17 00:00:00 2001 From: wolter Date: Fri, 9 Aug 2024 16:40:21 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=90=8E=E5=8F=B0,=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E5=88=97=E8=A1=A8=E5=A2=9E=E5=8A=A0=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/http/entities/backend/order.go | 5 ++++- app/services/order.go | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/app/http/entities/backend/order.go b/app/http/entities/backend/order.go index b60f97e..64a479f 100644 --- a/app/http/entities/backend/order.go +++ b/app/http/entities/backend/order.go @@ -102,7 +102,10 @@ func (o *OrdersResponse) ResponseFromDb(db ordersmodel.OrdersBackendList) { } type OrderLogsListRequest struct { - OrderId int64 `json:"order_id" form:"order_id"` + Id int64 `json:"id" form:"id"` + OrderId int64 `json:"order_id" form:"order_id"` + AppId int64 `json:"app_id" form:"app_id"` + OutTradeNo string `json:"out_trade_no" form:"out_trade_no"` entities.PageRequest } diff --git a/app/services/order.go b/app/services/order.go index 59d53e4..777bbb2 100644 --- a/app/services/order.go +++ b/app/services/order.go @@ -60,6 +60,15 @@ func OrderRequestLogsList(req backend.OrderLogsListRequest) (requestLog []orderr if req.OrderId > 0 { conn = conn.And(builder.Eq{"orders.id": req.OrderId}) } + if req.Id > 0 { + conn = conn.And(builder.Eq{"order_request_log.id": req.Id}) + } + if req.AppId > 0 { + conn = conn.And(builder.Eq{"order_request_log.app_id": req.AppId}) + } + if req.OutTradeNo != "" { + conn = conn.And(builder.Like{"order_request_log.out_trade_no", req.OutTradeNo}) + } // 请求日志 orderLogList := make([]orderrequestlogmodel.OrderRequestLog, 0) total, err := requestRepo.OrderRequestLogBackendList(conn, req.PageRequest, &orderLogList) @@ -74,6 +83,9 @@ func OrderCallbackLogsList(req backend.OrderLogsListRequest) (callback []orderca if req.OrderId > 0 { conn = conn.And(builder.Eq{"order_id": req.OrderId}) } + if req.Id > 0 { + conn = conn.And(builder.Eq{"id": req.Id}) + } // 回调日志 callbackLogList := make([]ordercallbacklogmodel.OrderCallbackLog, 0) total, err := callbackRepo.OrderCallbackLogList(conn, req.PageRequest, &callbackLogList) @@ -90,6 +102,9 @@ func OrderThirdLogsList(req backend.OrderLogsListRequest) (thirdLod []orderthird if req.OrderId > 0 { conn = conn.And(builder.Eq{"order_id": req.OrderId}) } + if req.Id > 0 { + conn = conn.And(builder.Eq{"id": req.Id}) + } thirdLogList := make([]orderthirdpaylogmodel.OrderThirdPayLog, 0) total, err := thirdRepo.OrderThirdPayLogList(conn, req.PageRequest, &thirdLogList) code = handErr(err) From 78380d3a70556be82bd24985893541d71ed19ed0 Mon Sep 17 00:00:00 2001 From: wolter Date: Fri, 9 Aug 2024 17:14:30 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=89=8D=E5=8F=B0,=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/http/controllers/api.go | 6 +++++- app/http/controllers/front/api.go | 2 +- app/http/requestmapping/front.go | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/http/controllers/api.go b/app/http/controllers/api.go index bf0f1d7..085c8b1 100644 --- a/app/http/controllers/api.go +++ b/app/http/controllers/api.go @@ -19,8 +19,12 @@ func ApiRes(c *gin.Context, data interface{}, code int, msg ...string) { var logId int64 var responseData interface{} var message string + var appCheckInfo *services.AppCheck originData := "{}" - appCheckInfo := GetAppCheckInfo(c).(*services.AppCheck) + appInfo := GetAppCheckInfo(c) + if appInfo != nil { + appCheckInfo = appInfo.(*services.AppCheck) + } // 空数据 if utils.IsNil(data) { data = struct{}{} diff --git a/app/http/controllers/front/api.go b/app/http/controllers/front/api.go index 4ffffc9..67a0b49 100644 --- a/app/http/controllers/front/api.go +++ b/app/http/controllers/front/api.go @@ -71,7 +71,7 @@ func QueryOrder(c *gin.Context) { cond := builder.NewCond() cond = cond.And(builder.Eq{"out_trade_no": order.OutTradeNo}, builder.Eq{"app_id": order.AppId}) _, code := services.OrderFindOne(&order, cond) - if code != errorcode.OrdersExist { + if code != errorcode.Success { controllers.ApiRes(c, nil, code) return } diff --git a/app/http/requestmapping/front.go b/app/http/requestmapping/front.go index 1d87d3d..366d8a4 100644 --- a/app/http/requestmapping/front.go +++ b/app/http/requestmapping/front.go @@ -12,5 +12,6 @@ var FrontRequestMap = map[string]func() (validForm interface{}, isSaveLog bool){ } var FrontRequestMapBeforeDecrypt = map[string]func() interface{}{ - common.FRONT_V1 + "/pay/url": func() interface{} { return new(front.RequestBody) }, + common.FRONT_V1 + "/pay/url": func() interface{} { return new(front.RequestBody) }, + common.FRONT_V1 + "/pay/query": func() interface{} { return new(front.RequestBody) }, }