This commit is contained in:
邹宗楠
2022-07-15 14:55:54 +08:00
parent 9f3b148453
commit 98d22a905f
2 changed files with 15 additions and 24 deletions

View File

@@ -61,7 +61,6 @@ func OnTTPayCallback(msg *tiktok.DetailCallBackMessage, refund *tiktok.DetailCal
} }
func onTTPayFinished(msg *tiktok.DetailCallBackMessage) (err error) { func onTTPayFinished(msg *tiktok.DetailCallBackMessage) (err error) {
globals.SugarLogger.Debugf("退款回调==================1")
orderPay := &model.OrderPay{ orderPay := &model.OrderPay{
PayOrderID: msg.OrderId, PayOrderID: msg.OrderId,
PayType: model.PayTypeTicTok, PayType: model.PayTypeTicTok,
@@ -79,9 +78,7 @@ func onTTPayFinished(msg *tiktok.DetailCallBackMessage) (err error) {
} else { } else {
orderPay.Status = model.PayStatusFailed orderPay.Status = model.PayStatusFailed
} }
num, err := dao.UpdateEntity(db, orderPay) dao.UpdateEntity(db, orderPay)
globals.SugarLogger.Debug("退款回调==================err", err)
globals.SugarLogger.Debug("退款回调==================err", num)
if msg.Status == tiktok.ResponseCodeSuccess { if msg.Status == tiktok.ResponseCodeSuccess {
err = OnPayFinished(orderPay) err = OnPayFinished(orderPay)
@@ -93,7 +90,6 @@ func onTTPayFinished(msg *tiktok.DetailCallBackMessage) (err error) {
} }
func onTTPayRefund(msg *tiktok.DetailCallBackMessage2Refund) (err error) { func onTTPayRefund(msg *tiktok.DetailCallBackMessage2Refund) (err error) {
globals.SugarLogger.Debugf("退款回调==================2")
orderPayRefund := &model.OrderPayRefund{ orderPayRefund := &model.OrderPayRefund{
RefundID: msg.CpRefundno, RefundID: msg.CpRefundno,
} }
@@ -135,8 +131,6 @@ func RefundOrderByTT(ctx *jxcontext.Context, orderPay *model.OrderPay, refundID
CpExtra: "msg", CpExtra: "msg",
NotifyURL: globals.TictokpayNotifyURL, NotifyURL: globals.TictokpayNotifyURL,
}) })
globals.SugarLogger.Debug("申请退款============", err)
globals.SugarLogger.Debug("申请退款============", result)
if err == nil { if err == nil {
orderPayRefund = &model.OrderPayRefund{ orderPayRefund = &model.OrderPayRefund{
RefundID: refundID, RefundID: refundID,

View File

@@ -39,25 +39,22 @@ func MsgFail() *TicktockRes {
} }
func (c *TicTocController) TiktokMsg() { func (c *TicTocController) TiktokMsg() {
globals.SugarLogger.Debugf("============err:%s", "抖音支付/退款回调")
//if c.Ctx.Input.Method() == http.MethodPost { //if c.Ctx.Input.Method() == http.MethodPost {
call, refund, payType, err := api.TiktokApi.GetCallbackMsg(getPayInfo(c.Ctx)) call, refund, payType, err := api.TiktokApi.GetCallbackMsg(getPayInfo(c.Ctx))
globals.SugarLogger.Debugf("tictok callback callbackResponse:%s", utils.Format4Output(call, true)) globals.SugarLogger.Debugf("tictok callback callbackResponse:%s", utils.Format4Output(call, true))
if err != nil || call == nil{ if err != nil || call == nil {
c.Data["json"] = MsgFail() c.Data["json"] = MsgFail()
c.ServeJSON()
globals.SugarLogger.Debugf("============err:%s", err)
return
}
if err = localjx.OnTTPayCallback(call, refund, payType); err != nil {
c.Data["json"] = MsgFail()
c.ServeJSON()
globals.SugarLogger.Debugf("============err:%s", err)
return
}
c.Data["json"] = MsgSuccess()
c.ServeJSON() c.ServeJSON()
return
}
if err = localjx.OnTTPayCallback(call, refund, payType); err != nil {
c.Data["json"] = MsgFail()
c.ServeJSON()
return
}
c.Data["json"] = MsgSuccess()
c.ServeJSON()
//} else { //} else {
// c.Abort("404") // c.Abort("404")
//} //}