Browse Source

update

add_mode
DengBiao 1 year ago
parent
commit
07a2f48755
3 changed files with 6 additions and 3 deletions
  1. +1
    -1
      app/customer/hdl/hdl_call_back.go
  2. +4
    -2
      app/customer/svc/svc_pay.go
  3. +1
    -0
      app/db/model/central_kitchen_for_school_package_ord.go

+ 1
- 1
app/customer/hdl/hdl_call_back.go View File

@@ -68,7 +68,7 @@ func WxJsApiCallBack(c *gin.Context) {
return
}

_, err = svc.DealCentralKitchenForSchoolOrderCallBackForWx(resp.OutTradeNo, resp.TradeState)
_, err = svc.DealCentralKitchenForSchoolOrderCallBackForWx(resp.OutTradeNo, resp.TransactionId, resp.TradeState)
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return


+ 4
- 2
app/customer/svc/svc_pay.go View File

@@ -252,6 +252,7 @@ func BuyPackageForWx(c *gin.Context, req md.BuyPackageReq) (outTradeNo, total st
ReqContent: string(utils.Serialize(req)),
WithDayData: string(utils.Serialize(data)),
PayWay: enum.PayWayForWx,
PrepayId: *result.PrepayId,
CreateAt: now.Format("2006-01-02 15:04:05"),
UpdateAt: now.Format("2006-01-02 15:04:05"),
})
@@ -493,7 +494,7 @@ func DealCentralKitchenForSchoolOrderCallBack(outTradeNo, tradeStatus string) (s
return
}

func DealCentralKitchenForSchoolOrderCallBackForWx(outTradeNo, tradeStatus string) (state int, err error) {
func DealCentralKitchenForSchoolOrderCallBackForWx(outTradeNo, transactionId, tradeStatus string) (state int, err error) {
centralKitchenForSchoolPackageOrd := db.CentralKitchenForSchoolPackageOrd{}
centralKitchenForSchoolPackageOrd.Set(outTradeNo)
ord, err := centralKitchenForSchoolPackageOrd.GetCentralKitchenForSchoolPackageOrd()
@@ -513,6 +514,7 @@ func DealCentralKitchenForSchoolOrderCallBackForWx(outTradeNo, tradeStatus strin
if tradeStatus == "SUCCESS" {
ord.State = enum2.CentralKitchenForSchoolPackageOrdStateForSuccess
ord.OrdState = enum2.CentralKitchenForSchoolPackageOrdOrdStateForSuccess
ord.TradeNo = transactionId

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


+ 1
- 0
app/db/model/central_kitchen_for_school_package_ord.go View File

@@ -15,6 +15,7 @@ type CentralKitchenForSchoolPackageOrd struct {
ReqContent string `json:"req_content" xorm:"comment('请求内容') TEXT"`
WithDayData string `json:"with_day_data" xorm:"comment('待支付成功插入 central_kitchen_for_school_user_with_day') TEXT"`
PayWay int `json:"pay_way" xorm:"not null default 1 comment('支付方式(1:支付宝 2:微信)') TINYINT(1)"`
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"`
}

Loading…
Cancel
Save