DengBiao 8 kuukautta sitten
vanhempi
commit
1c740e3448
3 muutettua tiedostoa jossa 11 lisäystä ja 6 poistoa
  1. +4
    -2
      app/customer/hdl/hdl_call_back.go
  2. +6
    -4
      app/customer/svc/svc_pay.go
  3. +1
    -0
      app/db/model/central_kitchen_for_school_package_ord.go

+ 4
- 2
app/customer/hdl/hdl_call_back.go Näytä tiedosto

@@ -12,6 +12,7 @@ import (
"fmt"
"github.com/gin-gonic/gin"
"github.com/wechatpay-apiv3/wechatpay-go/utils"
"time"
)

func AlipayJsApiCallBack(c *gin.Context) {
@@ -32,7 +33,7 @@ func AlipayJsApiCallBack(c *gin.Context) {
c.String(200, "success")
return
}
_, err := svc.DealCentralKitchenForSchoolOrderCallBack(args.OutTradeNo, args.TradeStatus)
_, err := svc.DealCentralKitchenForSchoolOrderCallBack(args.OutTradeNo, args.TradeStatus, args.GmtPayment)
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
@@ -71,7 +72,8 @@ func WxJsApiCallBack(c *gin.Context) {
}

utils2.FilePutContents("WxJsApiCallBack", utils2.SerializeStr(resp))
_, err = svc.DealCentralKitchenForSchoolOrderCallBackForWx(resp.OutTradeNo, resp.TransactionId, resp.TradeState)
successTime, _ := time.ParseInLocation("2006-01-02 15:04:05", resp.SuccessTime, time.Local)
_, err = svc.DealCentralKitchenForSchoolOrderCallBackForWx(resp.OutTradeNo, resp.TransactionId, resp.TradeState, successTime.Format("2006-01-02 15:04:05"))
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return


+ 6
- 4
app/customer/svc/svc_pay.go Näytä tiedosto

@@ -400,7 +400,7 @@ func NursingHomeBuyPackageReq(c *gin.Context, req md.NursingHomeBuyPackageReq) (
return
}

func DealCentralKitchenForSchoolOrderCallBack(outTradeNo, tradeStatus string) (state int, err error) {
func DealCentralKitchenForSchoolOrderCallBack(outTradeNo, tradeStatus, successTime string) (state int, err error) {
centralKitchenForSchoolPackageOrd := db.CentralKitchenForSchoolPackageOrd{}
centralKitchenForSchoolPackageOrd.Set(outTradeNo)
ord, err := centralKitchenForSchoolPackageOrd.GetCentralKitchenForSchoolPackageOrd()
@@ -420,6 +420,7 @@ func DealCentralKitchenForSchoolOrderCallBack(outTradeNo, tradeStatus string) (s
if tradeStatus == "TRADE_SUCCESS" {
ord.State = enum2.CentralKitchenForSchoolPackageOrdStateForSuccess
ord.OrdState = enum2.CentralKitchenForSchoolPackageOrdOrdStateForSuccess
ord.PayAt = successTime

//TODO::将预留数据插入到 `central_kitchen_for_school_user_with_day`
var data []*model.CentralKitchenForSchoolUserWithDay
@@ -493,7 +494,7 @@ func DealCentralKitchenForSchoolOrderCallBack(outTradeNo, tradeStatus string) (s
}
}
}
_, err = centralKitchenForSchoolPackageOrd.CentralKitchenForSchoolPackageOrdUpdate(ord, "state", "ord_state")
_, err = centralKitchenForSchoolPackageOrd.CentralKitchenForSchoolPackageOrdUpdate(ord, "state", "ord_state", "pay_at")
if err != nil {
return
}
@@ -502,7 +503,7 @@ func DealCentralKitchenForSchoolOrderCallBack(outTradeNo, tradeStatus string) (s
return
}

func DealCentralKitchenForSchoolOrderCallBackForWx(outTradeNo, transactionId, tradeStatus string) (state int, err error) {
func DealCentralKitchenForSchoolOrderCallBackForWx(outTradeNo, transactionId, tradeStatus, successTime string) (state int, err error) {
centralKitchenForSchoolPackageOrd := db.CentralKitchenForSchoolPackageOrd{}
centralKitchenForSchoolPackageOrd.Set(outTradeNo)
ord, err := centralKitchenForSchoolPackageOrd.GetCentralKitchenForSchoolPackageOrd()
@@ -523,6 +524,7 @@ func DealCentralKitchenForSchoolOrderCallBackForWx(outTradeNo, transactionId, tr
ord.State = enum2.CentralKitchenForSchoolPackageOrdStateForSuccess
ord.OrdState = enum2.CentralKitchenForSchoolPackageOrdOrdStateForSuccess
ord.TradeNo = transactionId
ord.PayAt = successTime

//TODO::将预留数据插入到 `central_kitchen_for_school_user_with_day`
var data []*model.CentralKitchenForSchoolUserWithDay
@@ -596,7 +598,7 @@ func DealCentralKitchenForSchoolOrderCallBackForWx(outTradeNo, transactionId, tr
}
}
}
_, err = centralKitchenForSchoolPackageOrd.CentralKitchenForSchoolPackageOrdUpdate(ord, "state", "ord_state", "trade_no")
_, err = centralKitchenForSchoolPackageOrd.CentralKitchenForSchoolPackageOrdUpdate(ord, "state", "ord_state", "trade_no", "pay_at")
if err != nil {
return
}


+ 1
- 0
app/db/model/central_kitchen_for_school_package_ord.go Näytä tiedosto

@@ -18,4 +18,5 @@ type CentralKitchenForSchoolPackageOrd struct {
PrepayId string `json:"prepay_id" xorm:"not null default '' comment('预支付交易会话标识。用于后续接口调用中使用,该值有效期为2小时(微信使用)') VARCHAR(255)"`
CreateAt string `json:"create_at" xorm:"not null pk default 'CURRENT_TIMESTAMP' DATETIME"`
UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
PayAt string `json:"pay_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"`
}

Ladataan…
Peruuta
Tallenna