修改门店发单和品牌发单是扣费问题

This commit is contained in:
邹宗楠
2023-05-11 10:58:50 +08:00
parent 85b2870a5e
commit 476f8c0943
26 changed files with 417 additions and 273 deletions

View File

@@ -4,6 +4,7 @@ import (
"errors"
"fmt"
"git.rosy.net.cn/baseapi/platformapi/mtpsapi"
"time"
"git.rosy.net.cn/baseapi/platformapi/dadaapi"
"git.rosy.net.cn/baseapi/utils"
@@ -540,3 +541,35 @@ func (c *DeliveryHandler) GetRiderInfo(orderId string, deliveryId int64, mtPeiso
}
return result, nil
}
// GetDeliverLiquidatedDamages 获取达达平台扣除配送费
// 待接单,待取货(小于一分钟,大于十五分钟)不扣钱
// 待取货1-15分钟内取消扣两元
func (c *DeliveryHandler) GetDeliverLiquidatedDamages(orderId string, deliverId string) (money int64, err error) {
dadaOrder, err := api.DadaAPI.QueryOrderInfo(orderId)
if err != nil {
return 0, err
}
// 未接单不扣款
if dadaOrder.AcceptTime == "" {
return 0, nil
}
// 有了接单时间,订单变成了待取货
if dadaOrder.AcceptTime != "" && dadaOrder.FetchTime == "" {
nowTime := time.Now().Unix()
fetchTime := utils.Str2Time(dadaOrder.AcceptTime).Unix()
timeDiffer := nowTime - fetchTime
if timeDiffer > 15*60 || timeDiffer < 60 {
return 0, nil
}
return 200, nil
}
if dadaOrder.FetchTime != "" {
return jxutils.StandardPrice2Int(dadaOrder.ActualFee), nil
}
return 0, err
}