Compare commits
No commits in common. "0d38872fa68cda3df274c131ac3162b1fff9cd60" and "e9d3dbece038c19fb5d1119961dae9286474c0ac" have entirely different histories.
0d38872fa6
...
e9d3dbece0
|
@ -215,7 +215,7 @@ func queryOrder() {
|
||||||
OrderId: orderInfo.Id,
|
OrderId: orderInfo.Id,
|
||||||
PayCallback: string(body),
|
PayCallback: string(body),
|
||||||
Status: 0,
|
Status: 0,
|
||||||
PayParam: "",
|
MerchantParam: "",
|
||||||
MerchantCallback: "",
|
MerchantCallback: "",
|
||||||
}
|
}
|
||||||
_, err = orderLogRepo.OrderThirdPayLogInsertOne(&log)
|
_, err = orderLogRepo.OrderThirdPayLogInsertOne(&log)
|
||||||
|
|
|
@ -31,11 +31,4 @@ const (
|
||||||
|
|
||||||
PAY_CHANNLE_TYPE_WECHAT = 1 // 支付类型: 微信
|
PAY_CHANNLE_TYPE_WECHAT = 1 // 支付类型: 微信
|
||||||
PAY_CHANNLE_TYPE_ZFB = 2 // 支付类型:支付宝
|
PAY_CHANNLE_TYPE_ZFB = 2 // 支付类型:支付宝
|
||||||
|
|
||||||
THIRD_ORDER_TYPE_PAY = 1 // 发起支付
|
|
||||||
THIRD_ORDER_TYPE_ORDER_QUERY = 2 // 查询订单
|
|
||||||
THIRD_ORDER_TYPE_REFUND = 3 // 发起退款
|
|
||||||
THIRD_ORDER_TYPE_REFUND_QUERY = 4 // 退款查询
|
|
||||||
THIRD_ORDER_TYPE_CLOSE = 5 // 关闭订单
|
|
||||||
THIRD_ORDER_TYPE_CALL_BACK = 6 // 支付回调
|
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,13 +1,8 @@
|
||||||
package paymentService
|
package paymentService
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"PaymentCenter/app/constants/common"
|
|
||||||
"PaymentCenter/app/data"
|
|
||||||
"PaymentCenter/app/models/orderthirdpaylogmodel"
|
|
||||||
"PaymentCenter/app/models/paychannelmodel"
|
|
||||||
"PaymentCenter/app/third/paymentService/payCommon"
|
"PaymentCenter/app/third/paymentService/payCommon"
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"github.com/qit-team/snow-core/log/logger"
|
"github.com/qit-team/snow-core/log/logger"
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
@ -46,7 +41,7 @@ type PayOrderResponse struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// PaymentService 统一发起支付
|
// PaymentService 统一发起支付
|
||||||
func PaymentService(c context.Context, payOrderRequest PayOrderRequest) PayOrderResponse {
|
func PaymentService(c context.Context, payOrderRequest PayOrderRequest) (payOrderResponse PayOrderResponse) {
|
||||||
logger.Info(c, "PaymentService 收到支付请求", payOrderRequest)
|
logger.Info(c, "PaymentService 收到支付请求", payOrderRequest)
|
||||||
var err error
|
var err error
|
||||||
var info string
|
var info string
|
||||||
|
@ -69,20 +64,11 @@ func PaymentService(c context.Context, payOrderRequest PayOrderRequest) PayOrder
|
||||||
ErrorMsg: err.Error(),
|
ErrorMsg: err.Error(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
payOrderResponse := PayOrderResponse{
|
return PayOrderResponse{
|
||||||
Code: payCommon.PAY_SUCCESS_CODE,
|
Code: payCommon.PAY_SUCCESS_CODE,
|
||||||
ErrorMsg: "",
|
ErrorMsg: "",
|
||||||
Result: info,
|
Result: info,
|
||||||
}
|
}
|
||||||
// 记录日志
|
|
||||||
go func() {
|
|
||||||
orderId := payOrderRequest.OrderId
|
|
||||||
payCallback := info
|
|
||||||
payParam, _ := json.Marshal(payOrderRequest)
|
|
||||||
merchantCallback, _ := json.Marshal(payOrderResponse)
|
|
||||||
saveLog(orderId, common.THIRD_ORDER_TYPE_PAY, payCallback, string(payParam), string(merchantCallback))
|
|
||||||
}()
|
|
||||||
return payOrderResponse
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type PayOrderQueryRequest struct {
|
type PayOrderQueryRequest struct {
|
||||||
|
@ -131,21 +117,10 @@ func PayOrderQuery(c context.Context, payOrderQueryRequest PayOrderQueryRequest)
|
||||||
ErrorMsg: err.Error(),
|
ErrorMsg: err.Error(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return PayOrderQueryResponse{
|
||||||
payOrderQueryResponse := PayOrderQueryResponse{
|
|
||||||
Code: payCommon.PAY_SUCCESS_CODE,
|
Code: payCommon.PAY_SUCCESS_CODE,
|
||||||
Result: info,
|
Result: info,
|
||||||
}
|
}
|
||||||
|
|
||||||
// 记录日志
|
|
||||||
go func() {
|
|
||||||
orderId := payOrderQueryRequest.OrderId
|
|
||||||
payCallback, _ := json.Marshal(info)
|
|
||||||
payParam, _ := json.Marshal(payOrderQueryRequest)
|
|
||||||
merchantCallback, _ := json.Marshal(payOrderQueryResponse)
|
|
||||||
saveLog(orderId, common.THIRD_ORDER_TYPE_ORDER_QUERY, string(payCallback), string(payParam), string(merchantCallback))
|
|
||||||
}()
|
|
||||||
return payOrderQueryResponse
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type OrderRefundRequest struct {
|
type OrderRefundRequest struct {
|
||||||
|
@ -196,21 +171,10 @@ func OrderRefund(c context.Context, orderRefundRequest OrderRefundRequest) Order
|
||||||
ErrorMsg: err.Error(),
|
ErrorMsg: err.Error(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return OrderRefundResponse{
|
||||||
orderRefundResponse := OrderRefundResponse{
|
|
||||||
Code: payCommon.PAY_SUCCESS_CODE,
|
Code: payCommon.PAY_SUCCESS_CODE,
|
||||||
Result: info,
|
Result: info,
|
||||||
}
|
}
|
||||||
// 记录日志
|
|
||||||
go func() {
|
|
||||||
orderId := orderRefundRequest.OrderId
|
|
||||||
payCallback, _ := json.Marshal(info)
|
|
||||||
payParam, _ := json.Marshal(orderRefundRequest)
|
|
||||||
merchantCallback, _ := json.Marshal(orderRefundResponse)
|
|
||||||
saveLog(orderId, common.THIRD_ORDER_TYPE_REFUND, string(payCallback), string(payParam), string(merchantCallback))
|
|
||||||
}()
|
|
||||||
|
|
||||||
return orderRefundResponse
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type OrderRefundQueryRequest struct {
|
type OrderRefundQueryRequest struct {
|
||||||
|
@ -248,21 +212,10 @@ func OrderRefundQuery(c context.Context, orderRefundQueryRequest OrderRefundQuer
|
||||||
ErrorMsg: err.Error(),
|
ErrorMsg: err.Error(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
orderRefundQueryResponse := OrderRefundQueryResponse{
|
return OrderRefundQueryResponse{
|
||||||
Code: payCommon.PAY_SUCCESS_CODE,
|
Code: payCommon.PAY_SUCCESS_CODE,
|
||||||
Result: info,
|
Result: info,
|
||||||
}
|
}
|
||||||
|
|
||||||
// 记录日志
|
|
||||||
go func() {
|
|
||||||
orderId := orderRefundQueryRequest.OrderId
|
|
||||||
payCallback, _ := json.Marshal(info)
|
|
||||||
payParam, _ := json.Marshal(orderRefundQueryRequest)
|
|
||||||
merchantCallback, _ := json.Marshal(orderRefundQueryResponse)
|
|
||||||
saveLog(orderId, common.THIRD_ORDER_TYPE_REFUND_QUERY, string(payCallback), string(payParam), string(merchantCallback))
|
|
||||||
}()
|
|
||||||
|
|
||||||
return orderRefundQueryResponse
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type OrderCloseRequest struct {
|
type OrderCloseRequest struct {
|
||||||
|
@ -305,35 +258,8 @@ func OrderClose(c context.Context, orderCloseRequest OrderCloseRequest) OrderClo
|
||||||
ErrorMsg: err.Error(),
|
ErrorMsg: err.Error(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
orderCloseResponse := OrderCloseResponse{
|
return OrderCloseResponse{
|
||||||
Code: payCommon.PAY_SUCCESS_CODE,
|
Code: payCommon.PAY_SUCCESS_CODE,
|
||||||
Result: info,
|
Result: info,
|
||||||
}
|
}
|
||||||
// 记录日志
|
|
||||||
go func() {
|
|
||||||
orderId := orderCloseRequest.OrderId
|
|
||||||
payCallback, _ := json.Marshal(info)
|
|
||||||
payParam, _ := json.Marshal(orderCloseRequest)
|
|
||||||
merchantCallback, _ := json.Marshal(orderCloseResponse)
|
|
||||||
saveLog(orderId, common.THIRD_ORDER_TYPE_CLOSE, string(payCallback), string(payParam), string(merchantCallback))
|
|
||||||
}()
|
|
||||||
|
|
||||||
return orderCloseResponse
|
|
||||||
}
|
|
||||||
|
|
||||||
// saveLog 记录操作日志
|
|
||||||
func saveLog(orderId int64, OType int, payCallback string, PayParam string, MerchantCallback string) {
|
|
||||||
thirdRepo := data.NewOrderThirdPayLogRepo(paychannelmodel.GetInstance().GetDb())
|
|
||||||
log := orderthirdpaylogmodel.OrderThirdPayLog{
|
|
||||||
OrderId: orderId,
|
|
||||||
PayCallback: payCallback,
|
|
||||||
Status: 0,
|
|
||||||
PayParam: PayParam,
|
|
||||||
MerchantCallback: MerchantCallback,
|
|
||||||
Type: OType,
|
|
||||||
}
|
|
||||||
_, err := thirdRepo.OrderThirdPayLogInsertOne(&log)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue