|
@@ -4,6 +4,7 @@ import (
|
|
|
"encoding/json"
|
|
|
logger "eta/eta_mini_ht_api/common/component/log"
|
|
|
"eta/eta_mini_ht_api/models"
|
|
|
+ merchantDao "eta/eta_mini_ht_api/models/merchant"
|
|
|
"eta/eta_mini_ht_api/models/message"
|
|
|
"eta/eta_mini_ht_api/models/order"
|
|
|
"fmt"
|
|
@@ -221,17 +222,30 @@ func DealPayment(tradeOrderNo string, flag string) (productOrderDTO ProductOrder
|
|
|
if flag == PaySuccess {
|
|
|
isSuccess = true
|
|
|
}
|
|
|
- err = order.DealPaymentOrder(tradeOrder, isSuccess)
|
|
|
- if err != nil {
|
|
|
- logger.Error("处理支付结果失败%v,支付订单:%s", err, tradeOrderNo)
|
|
|
- return
|
|
|
- }
|
|
|
var productOrder order.ProductOrder
|
|
|
productOrder, err = order.GetOrderByOrderNo(tradeOrder.ProductOrderID)
|
|
|
if err != nil {
|
|
|
logger.Error("获取产品订单失败%v,支付订单:%s", err, tradeOrderNo)
|
|
|
return
|
|
|
}
|
|
|
+ product, err := merchantDao.GetMerchantProductById(productOrder.ProductID)
|
|
|
+ if err != nil {
|
|
|
+ logger.Error("获取产品信息失败:%v,productId:%d", err, productOrder.ProductID)
|
|
|
+ }
|
|
|
+ var validDuration string
|
|
|
+ if product.Type == merchantDao.Package {
|
|
|
+ beginDate := time.Now().Format(time.DateOnly)
|
|
|
+ endDate := time.Now().Add(time.Duration(product.ValidDays * 24)).Format(time.DateOnly)
|
|
|
+ validDuration = fmt.Sprintf("%s~%s", beginDate, endDate)
|
|
|
+ } else {
|
|
|
+ validDuration = "永久有效"
|
|
|
+ }
|
|
|
+ err = order.DealPaymentOrder(tradeOrder, isSuccess, validDuration)
|
|
|
+ if err != nil {
|
|
|
+ logger.Error("处理支付结果失败%v,支付订单:%s", err, tradeOrderNo)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
productOrderDTO = ConvertProductOrderDTO(productOrder)
|
|
|
return
|
|
|
}
|