This commit is contained in:
邹宗楠
2025-08-04 16:46:57 +08:00
parent a7a48ff1ee
commit 48f276b675
6 changed files with 68 additions and 27 deletions

View File

@@ -9,7 +9,6 @@ import (
"git.rosy.net.cn/jx-callback/business/model/dao"
"git.rosy.net.cn/jx-callback/business/partner"
"git.rosy.net.cn/jx-callback/globals/api"
"strings"
"time"
)
@@ -191,31 +190,26 @@ func BarCodeScannerPayByLaKaLa(ctx *jxcontext.Context, vendorOrderId, userPaymen
SettleType: "1",
Subject: fmt.Sprintf("感谢您在本店%s消费,欢迎下次再来", goodsOrder.StoreName),
}
code, msg, payOrderId, err := api.LaKaLaApi.ScannerPayMicroPay(parma)
code, msg, tradeNo, logNo, err := api.LaKaLaApi.ScannerPayMicroPay(parma)
if code == lakala.PaySuccess {
goodsOrder.Status = model.OrderStatusFinished
goodsOrder.VendorStatus = code
goodsOrder.VendorOrderID2 = logNo
goodsOrder.OrderFinishedAt = time.Now()
dao.UpdateEntity(db, goodsOrder, "Status", "VendorStatus", "OrderFinishedAt")
dao.UpdateEntity(db, goodsOrder, "Status", "VendorStatus", "OrderFinishedAt", "VendorOrderID2")
return "支付成功", nil
}
vendorPayType := ""
if strings.Contains(userPaymentLabel, "101112131415") {
vendorPayType = lakala.Wechat
} else {
vendorPayType = lakala.Alipay
}
payInfo := &model.OrderPay{
PayOrderID: payOrderId,
PayOrderID: tradeNo,
PayType: model.PayTypeLaKaLa,
VendorPayType: vendorPayType,
TransactionID: userPaymentLabel,
VendorPayType: lakala.PayWayAPP,
TransactionID: logNo,
VendorOrderID: goodsOrder.VendorOrderID,
VendorID: goodsOrder.VendorID,
Status: 0,
PayCreatedAt: time.Now(),
PrepayID: userPaymentLabel,
PrepayID: tradeNo,
CodeURL: "",
TotalFee: int(goodsOrder.ActualPayPrice),
}

View File

@@ -85,9 +85,9 @@ func pay4OrderByLaKaLa(ctx *jxcontext.Context, order *model.GoodsOrder, payType
result, err := api.LaKaLaApi.AggregatePay(param)
if err == nil {
orderPay = &model.OrderPay{
PayOrderID: param.OutTradeNo,
PayOrderID: result.TradeNo,
PayType: payType,
VendorPayType: vendorPayType,
VendorPayType: lakala.PayWayMini,
TransactionID: result.LogNo,
VendorOrderID: order.VendorOrderID,
VendorID: order.VendorID,
@@ -102,6 +102,9 @@ func pay4OrderByLaKaLa(ctx *jxcontext.Context, order *model.GoodsOrder, payType
orderPay.CodeURL = utils.LimitUTF8StringLen(string(fields), 3200)
}
}
order.VendorOrderID2 = result.LogNo
dao.UpdateEntity(dao.GetDB(), order, "VendorOrderID2")
return orderPay, err
}
@@ -124,7 +127,7 @@ func OnLaKaLaPayCallback(call *lakala.PayStatusCallBack) (err error) {
// onLaKaLaPayFinished 订单支付成功或失败
func onLaKaLaPayFinished(call *lakala.PayStatusCallBack) (err error) {
orderPay := &model.OrderPay{
PayOrderID: call.OutTradeNo,
PayOrderID: call.TradeNo,
}
orderPay.DeletedAt = utils.DefaultTimeValue
db := dao.GetDB()
@@ -154,7 +157,7 @@ func onLaKaLaPayFinished(call *lakala.PayStatusCallBack) (err error) {
// onLaKaLaOrderCancel 订单取消或撤单
func onLaKaLaOrderCancel(call *lakala.PayStatusCallBack) (err error) {
orderPay := &model.OrderPay{
PayOrderID: call.OutTradeNo,
PayOrderID: call.TradeNo,
}
orderPay.DeletedAt = utils.DefaultTimeValue
db := dao.GetDB()
@@ -173,7 +176,7 @@ func onLaKaLaOrderCancel(call *lakala.PayStatusCallBack) (err error) {
func onLaKaLaPayRefund(call *lakala.PayStatusCallBack) (err error) {
orderPayRefund := &model.OrderPayRefund{
RefundID: call.OutTradeNo,
RefundID: call.TradeNo,
}
db := dao.GetDB()
if err = dao.GetEntity(db, orderPayRefund, "RefundID"); err != nil && err == orm.ErrNoRows {