1.根据咪咕沟通要求,优化回调接口;订购成功后立即调用订购状态查询接口;

This commit is contained in:
chenlin 2024-11-20 15:10:26 +08:00
parent ec84726547
commit 1bb18a58a5

View File

@ -75,6 +75,7 @@ func (e MiGuDeployService) SubscribeNotice(c *gin.Context) {
}
}
var checkPhoneNum string
if errors.Is(err, gorm.ErrRecordNotFound) { // 订单表没有记录
// 查询交易流水表
var logInfo models.MgTransactionLog
@ -86,6 +87,8 @@ func (e MiGuDeployService) SubscribeNotice(c *gin.Context) {
return
}
checkPhoneNum = logInfo.PhoneNumber
// 插入订单表
var inOrder models.MgOrder
inOrder.CreatedAt = logInfo.CreatedAt
@ -111,6 +114,7 @@ func (e MiGuDeployService) SubscribeNotice(c *gin.Context) {
orderInfo.OrderSerial = inOrder.OrderSerial
orderInfo.ChannelTradeNo = inOrder.ChannelTradeNo
} else { // 订单表有记录
checkPhoneNum = orderInfo.PhoneNumber
if orderInfo.State != 1 {
err = e.Orm.Table("mg_order").Where("external_order_id = ?", orderId).Updates(map[string]interface{}{
"state": models.SubscribeOK,
@ -156,6 +160,17 @@ func (e MiGuDeployService) SubscribeNotice(c *gin.Context) {
}
}
var req models.QueryRightsInfoReq
req.AppChannelList = append(req.AppChannelList, models.ChannelCode)
req.Mobile = checkPhoneNum
resp, err := models.MiGuQueryRightsInfo(&req)
if err != nil {
fmt.Println("CheckOrderState MiGuQueryRightsInfo err:", err.Error())
logger.Errorf("CheckOrderState MiGuQueryRightsInfo err:", err.Error())
}
fmt.Println("CheckOrderState MiGuQueryRightsInfo resp:", resp)
fmt.Println("SubscribeNotice-end")
logger.Info("订购成功通知-end")