Merge branch 'jdshop' of https://e.coding.net/rosydev/jx-callback into jdshop
This commit is contained in:
@@ -510,6 +510,7 @@ func (c *OrderManager) ExportOrders(ctx *jxcontext.Context, fromDateStr, toDateS
|
||||
paramDamages := []interface{}{v.VendorOrderID, model.OrderStatusCanceled}
|
||||
if err := dao.GetRow(dao.GetDB(), damages, sqlDamages, paramDamages); err == nil {
|
||||
v.LiquidatedDamages = damages.Damages
|
||||
v.DesiredFee += damages.Damages
|
||||
}
|
||||
orders2 = append(orders2, v)
|
||||
} else {
|
||||
@@ -730,31 +731,6 @@ func (c *OrderManager) GetWayBillStatusList(orderId, LogisticsId string, vendorI
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// GetOrderStatusList2 查询订单流程 refVendorOrderID 订单Id
|
||||
func GetOrderStatusList2(refVendorOrderID string, wayBillId string, orderType int, vendorID int) (statusList []*model.OrderStatus, err error) {
|
||||
sql := `
|
||||
SELECT *
|
||||
FROM order_status t1
|
||||
WHERE t1.ref_vendor_order_id = ? AND t1.vendor_order_id = ? AND t1.vendor_id = ?
|
||||
`
|
||||
sqlParams := []interface{}{
|
||||
refVendorOrderID,
|
||||
wayBillId,
|
||||
vendorID,
|
||||
}
|
||||
if orderType > 0 {
|
||||
sql += " AND t1.order_type = ?"
|
||||
sqlParams = append(sqlParams, orderType)
|
||||
}
|
||||
sql += " ORDER BY t1.status_time, t1.order_type DESC, t1.status"
|
||||
|
||||
db := dao.GetDB()
|
||||
if err = dao.GetRows(db, &statusList, sql, sqlParams...); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return statusList, nil
|
||||
}
|
||||
|
||||
// GetOrderStatusCancelList 取消订单
|
||||
func GetOrderStatusCancelList(refVendorOrderID string) (statusList []*model.OrderStatus, err error) {
|
||||
sql := `
|
||||
@@ -1718,3 +1694,21 @@ func GetOrderUserBuyFirst(ctx *jxcontext.Context, vendorOrderID string) (isFirst
|
||||
}
|
||||
return isFirst, err
|
||||
}
|
||||
|
||||
// GetWaybillStatusList 查询订单的运单记录
|
||||
func (c *OrderManager) GetWaybillStatusList(orderId, waybillID string, waybillVendorId int) ([]*model.OrderStatus, error) {
|
||||
sql := `SELECT *
|
||||
FROM order_status t1
|
||||
WHERE t1.vendor_order_id = ? AND t1.ref_vendor_order_id = ? AND t1.vendor_id = ?`
|
||||
sqlParams := []interface{}{
|
||||
waybillID,
|
||||
orderId,
|
||||
waybillVendorId,
|
||||
}
|
||||
sql += ` ORDER BY status_time ASC `
|
||||
var result []*model.OrderStatus
|
||||
if err := dao.GetRows(dao.GetDB(), &result, sql, sqlParams...); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
@@ -500,6 +500,9 @@ func (s *DefScheduler) QueryOrderWaybillFeeInfoEx(ctx *jxcontext.Context, vendor
|
||||
}
|
||||
} else {
|
||||
feeInfo.DeliveryFee += model.WayBillDeliveryMarkUp // 加收两毛
|
||||
if storeCourier.VendorID == model.VendorIDFengNiao {
|
||||
feeInfo.DeliveryFee += model.WayBillDeliveryMarkUp // 蜂鸟加
|
||||
}
|
||||
feeInfo.TimeoutSecond = timeoutSecond
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -2215,6 +2215,33 @@ func updateCourierStores(ctx *jxcontext.Context, storeID int) (err error) {
|
||||
return errList.GetErrListAsOne()
|
||||
}
|
||||
|
||||
func UpdateStoreName() error {
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
context = jxcontext.AdminCtx
|
||||
)
|
||||
|
||||
sql := ` SELECT * FROM store_courier_map WHERE vendor_id IN (?,?,?,?) AND deleted_at = ?`
|
||||
courierList := make([]*model.StoreCourierMap, 0, 0)
|
||||
if err := dao.GetRows(db, &courierList, sql, []interface{}{model.VendorIDMTPS, model.VendorIDFengNiao, model.VendorIDDada, model.VendorIDUUPT, utils.DefaultTimeValue}...); err != nil {
|
||||
globals.SugarLogger.Debugf("query Order err := %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
for i := 0; i < len(courierList); i++ {
|
||||
storeDetail, _ := dao.GetStoreDetail2(db, courierList[i].StoreID, courierList[i].VendorStoreID, courierList[i].VendorID)
|
||||
formalizeStore4Courier(storeDetail)
|
||||
if handlerInfo := partner.GetDeliveryPlatformFromVendorID(storeDetail.VendorID); handlerInfo != nil {
|
||||
if updateHandler, _ := handlerInfo.Handler.(partner.IDeliveryUpdateStoreHandler); updateHandler != nil {
|
||||
if err := updateHandler.UpdateStore(context, storeDetail); err != nil {
|
||||
globals.SugarLogger.Debugf("err := %v,storeID : %s,storeName :%s , vendorId : %d", err, storeDetail.VendorStoreID, storeDetail.Name, storeDetail.VendorID)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ====================================第三方店铺创建=============================
|
||||
func updateOrCreateCourierStore(ctx *jxcontext.Context, storeDetail *dao.StoreDetail2) (isCreated bool, err error) {
|
||||
globals.SugarLogger.Debugf("updateOrCreateCourierStore %s, storeID:%d, vendorStoreID:%s", model.VendorChineseNames[storeDetail.VendorID], storeDetail.ID, storeDetail.VendorStoreID)
|
||||
@@ -2329,7 +2356,13 @@ func UpdateOrCreateCourierStores(ctx *jxcontext.Context, storeID int, isForceUpd
|
||||
}
|
||||
|
||||
func formalizeStore4Courier(storeDetail *dao.StoreDetail2) *dao.StoreDetail2 {
|
||||
storeDetail.Name = fmt.Sprintf("%s-%s-%s", model.ShopChineseNames[model.VendorIDJD], storeDetail.CityName, storeDetail.Name)
|
||||
// 获取品牌名称
|
||||
brandInfo, err := dao.GetBrands(dao.GetDB(), "", storeDetail.BrandID, "", false, "")
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
storeDetail.Name = fmt.Sprintf("%s-%s-%s", strings.ReplaceAll(brandInfo[0].Name, " ", ""), strings.ReplaceAll(storeDetail.CityName, " ", ""), strings.ReplaceAll(storeDetail.Name, " ", ""))
|
||||
if storeDetail.PayeeName == "" {
|
||||
storeDetail.PayeeName = "店主"
|
||||
}
|
||||
|
||||
@@ -221,13 +221,19 @@ func Init() {
|
||||
"04:00:00",
|
||||
})
|
||||
|
||||
// 每天更新美团门当的结算信息和配送费等等
|
||||
// 每天更新美团-门店结算方式[结算给企业/结算给个人]
|
||||
ScheduleTimerFunc("LoadingStoreOrderSettleAmount", func() {
|
||||
delivery.LoadingStoreOrderSettleAmount(0, 0, nil)
|
||||
}, []string{
|
||||
"19:50:00",
|
||||
})
|
||||
|
||||
ScheduleTimerFunc("UpdateStoreName ", func() {
|
||||
cms.UpdateStoreName()
|
||||
}, []string{
|
||||
"13:35:00",
|
||||
})
|
||||
|
||||
// 定时任务更新昨天的都要商品和本地商品id的映射关系
|
||||
//ScheduleTimerFunc("RefreshStoreOperator", func() {
|
||||
// t := time.Now()
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/platformapi/mtpsapi"
|
||||
"git.rosy.net.cn/jx-callback/business/jxcallback/orderman"
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/dadaapi"
|
||||
@@ -42,6 +43,17 @@ var (
|
||||
"虞山街道": "虞山镇",
|
||||
"常福街道": "虞山镇",
|
||||
}
|
||||
complaintReasonsMap = map[int]string{
|
||||
1: "骑手态度恶劣",
|
||||
2: "骑手接单后未取货",
|
||||
3: "骑手取货太慢",
|
||||
4: "骑手送货太慢",
|
||||
5: "货品未送达",
|
||||
6: "货品有损坏",
|
||||
7: "骑手违规收取顾客其他费用",
|
||||
69: "骑手恶意取消订单",
|
||||
71: "骑手提前点击取货/送达",
|
||||
}
|
||||
)
|
||||
|
||||
type DeliveryHandler struct {
|
||||
@@ -176,12 +188,6 @@ func (c *DeliveryHandler) callbackMsg2Waybill(msg *dadaapi.CallbackMsg) (retVal
|
||||
}
|
||||
|
||||
func StoreDetail2ShopInfo(storeDetail *dao.StoreDetail2) (shopInfo *dadaapi.ShopInfo) {
|
||||
// 获取品牌名称
|
||||
brandInfo, err := dao.GetBrands(dao.GetDB(), "", storeDetail.BrandID, "", false, "")
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
lng := jxutils.IntCoordinate2Standard(storeDetail.Lng)
|
||||
lat := jxutils.IntCoordinate2Standard(storeDetail.Lat)
|
||||
cityName := storeDetail.CityName
|
||||
@@ -197,7 +203,7 @@ func StoreDetail2ShopInfo(storeDetail *dao.StoreDetail2) (shopInfo *dadaapi.Shop
|
||||
}
|
||||
shopInfo = &dadaapi.ShopInfo{
|
||||
OriginShopID: storeDetail.VendorStoreID,
|
||||
StationName: brandInfo[0].Name + "-" + storeDetail.Name,
|
||||
StationName: storeDetail.Name,
|
||||
Business: dadaapi.BusinessTypeConvStore, // 故意设置成这个的
|
||||
CityName: cityName,
|
||||
AreaName: districtName,
|
||||
@@ -546,14 +552,48 @@ func (c *DeliveryHandler) GetRiderInfo(orderId string, deliveryId int64, mtPeiso
|
||||
// 待接单,待取货(小于一分钟,大于十五分钟)不扣钱
|
||||
// 待取货1-15分钟内取消扣两元
|
||||
func (c *DeliveryHandler) GetDeliverLiquidatedDamages(orderId string, deliverId string) (money int64, err error) {
|
||||
orderStatus, err := orderman.FixedOrderManager.GetWayBillStatusList(orderId, deliverId, model.VendorIDDada)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
dadaOrder, err := api.DadaAPI.QueryOrderInfo(orderId)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
// 本地状态兑换金额
|
||||
var localPrice int64 = 0
|
||||
for i := len(orderStatus) - 1; i >= 0; i-- {
|
||||
if orderStatus[i].VendorStatus == utils.Int2Str(dadaapi.OrderStatusCanceled) {
|
||||
continue
|
||||
}
|
||||
if orderStatus[i].VendorStatus == utils.Int2Str(dadaapi.OrderStatusFinished) || orderStatus[i].VendorStatus == utils.Int2Str(dadaapi.OrderStatusDelivering) || orderStatus[i].VendorStatus == utils.Int2Str(dadaapi.OrderStatusReturningInOrder) {
|
||||
localPrice = utils.Float64TwoInt64(dadaOrder.DeliveryFee * float64(100))
|
||||
break
|
||||
}
|
||||
if orderStatus[i].VendorStatus == utils.Int2Str(dadaapi.OrderStatusAccepted) {
|
||||
nowTime := time.Now().Unix()
|
||||
fetchTime := orderStatus[i].StatusTime.Unix()
|
||||
timeDiffer := nowTime - fetchTime
|
||||
if timeDiffer > 15*60 || timeDiffer < 60 {
|
||||
localPrice = 0
|
||||
} else {
|
||||
localPrice = 200
|
||||
}
|
||||
break
|
||||
}
|
||||
if orderStatus[i].VendorStatus == utils.Int2Str(dadaapi.OrderStatusWaitingForAccept) {
|
||||
localPrice = 0
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// 平台状态兑换金额
|
||||
var vendorPrice int64 = 0
|
||||
// 未接单不扣款
|
||||
if dadaOrder.AcceptTime == "" {
|
||||
return 0, nil
|
||||
vendorPrice = 0
|
||||
}
|
||||
|
||||
// 有了接单时间,订单变成了待取货
|
||||
@@ -562,20 +602,19 @@ func (c *DeliveryHandler) GetDeliverLiquidatedDamages(orderId string, deliverId
|
||||
fetchTime := utils.Str2Time(dadaOrder.AcceptTime).Unix()
|
||||
timeDiffer := nowTime - fetchTime
|
||||
if timeDiffer > 15*60 || timeDiffer < 60 {
|
||||
return 0, nil
|
||||
vendorPrice = 0
|
||||
}
|
||||
return 200, nil
|
||||
vendorPrice = 200
|
||||
}
|
||||
|
||||
// fetchTime 已经有时间了,代表已经取货.次数取消扣除此订单全部金额
|
||||
// 达达存在多个订单的运单违约金额统计在一起的情况
|
||||
if dadaOrder.FetchTime != "" {
|
||||
bill, err := partner.CurOrderManager.LoadWaybill(deliverId, model.VendorIDDada)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return bill.DesiredFee, nil
|
||||
vendorPrice = utils.Float64TwoInt64(dadaOrder.DeliveryFee * float64(100))
|
||||
}
|
||||
|
||||
return 0, err
|
||||
if localPrice > vendorPrice {
|
||||
return localPrice, nil
|
||||
}
|
||||
return vendorPrice, nil
|
||||
}
|
||||
|
||||
@@ -109,12 +109,6 @@ func (c *DeliveryHandler) IsErrStoreNotExist(err error) bool {
|
||||
}
|
||||
|
||||
func (c *DeliveryHandler) UpdateStore(ctx *jxcontext.Context, storeDetail *dao.StoreDetail2) (err error) {
|
||||
// 获取品牌名称
|
||||
brandInfo, err := dao.GetBrands(dao.GetDB(), "", storeDetail.BrandID, "", false, "")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// 获取蜂鸟门店id
|
||||
fnStore, err := api.FnAPI.GetStore(storeDetail.VendorStoreID)
|
||||
if err != nil {
|
||||
@@ -139,7 +133,7 @@ func (c *DeliveryHandler) UpdateStore(ctx *jxcontext.Context, storeDetail *dao.S
|
||||
BusinessLicencePicHash: storeDetail.Licence,
|
||||
}
|
||||
if storeDetail.Name != fnStore.Name {
|
||||
updateStore.HeadShopName = brandInfo[0].Name + "-" + storeDetail.Name
|
||||
updateStore.HeadShopName = storeDetail.Name
|
||||
updateStore.BranchShopName = storeDetail.Name
|
||||
}
|
||||
if updateStore.OwnerName == "" {
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/platformapi/mtpsapi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxcallback/orderman"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -343,10 +344,10 @@ func (c *DeliveryHandler) OnWaybillExcept(msg *fnpsapi.AbnormalReportNotify) (re
|
||||
return retVal
|
||||
}
|
||||
|
||||
// 查询订单配送费
|
||||
// 查询订单配送费(蜂鸟加4毛)
|
||||
func GetDesiredFee(vendorOrderID string) (desiredFee, acuteFee int64) {
|
||||
if result, err := api.FnAPI.QueryOrder(vendorOrderID); err == nil {
|
||||
return result.OrderTotalAmountCent + int64(utils.WayBillDeliveryMarkUp), result.OrderActualAmountCent
|
||||
return result.OrderTotalAmountCent, result.OrderActualAmountCent
|
||||
}
|
||||
return desiredFee, acuteFee
|
||||
}
|
||||
@@ -415,16 +416,49 @@ func (c *DeliveryHandler) GetDeliverLiquidatedDamages(orderId string, deliverId
|
||||
return 0, err
|
||||
}
|
||||
|
||||
// 本地状态兑换金额
|
||||
var localPrice int64 = 0
|
||||
orderStatus, err := orderman.FixedOrderManager.GetWayBillStatusList(orderId, deliverId, model.VendorIDFengNiao)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
for i := len(orderStatus) - 1; i >= 0; i-- {
|
||||
if orderStatus[i].VendorStatus == utils.Int2Str(fnpsapi.OrderStatusAcceptCacle) {
|
||||
continue
|
||||
}
|
||||
if orderStatus[i].VendorStatus == utils.Int2Str(fnpsapi.OrderStatusArrived) || orderStatus[i].VendorStatus == utils.Int2Str(fnpsapi.OrderStatusDelivering) || orderStatus[i].VendorStatus == utils.Int2Str(fnpsapi.OrderStatusDelivered) {
|
||||
localPrice = order.OrderTotalAmountCent
|
||||
break
|
||||
}
|
||||
if orderStatus[i].VendorStatus == utils.Int2Str(fnpsapi.OrderStatusAssigned) {
|
||||
nowTime := time.Now().Unix()
|
||||
fetchTime := orderStatus[i].StatusTime.Unix()
|
||||
timeDiffer := nowTime - fetchTime
|
||||
if timeDiffer > 15*60 || timeDiffer < 60 {
|
||||
localPrice = 0
|
||||
} else {
|
||||
localPrice = 200
|
||||
}
|
||||
break
|
||||
}
|
||||
if orderStatus[i].VendorStatus == utils.Int2Str(fnpsapi.OrderStatusAcceptCreate) || orderStatus[i].VendorStatus == utils.Int2Str(fnpsapi.OrderStatusAccept) {
|
||||
localPrice = 0
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// 已经分配骑手,且超过十五分钟,不扣款
|
||||
var vendorPrice int64 = 0
|
||||
if len(order.EventLogDetails) != model.NO {
|
||||
for i := len(order.EventLogDetails) - 1; i >= 0; i-- {
|
||||
switch order.EventLogDetails[i].OrderStatus {
|
||||
case fnpsapi.OrderStatusDelivered, fnpsapi.OrderStatusArrived, fnpsapi.OrderStatusDelivering: // 送达,到店,配送中 取消订单全额扣款
|
||||
return order.OrderTotalAmountCent, nil
|
||||
vendorPrice = order.OrderTotalAmountCent
|
||||
break
|
||||
case fnpsapi.OrderStatusAcceptCacle, fnpsapi.OrderStatusException: // 取消和异常状态,跳过查看上一状态
|
||||
continue
|
||||
case fnpsapi.OrderStatusAcceptCreate, fnpsapi.OrderStatusAccept: // 生成运单和系统接单取消不扣除费用
|
||||
return 0, nil
|
||||
vendorPrice = 0
|
||||
case fnpsapi.OrderStatusAssigned:
|
||||
if time.Now().UnixNano()/1e6-order.EventLogDetails[i].OccurTime > fnpsapi.WayBillPressureOrderTime {
|
||||
return 0, nil
|
||||
@@ -433,8 +467,9 @@ func (c *DeliveryHandler) GetDeliverLiquidatedDamages(orderId string, deliverId
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return 0, err
|
||||
if localPrice > vendorPrice {
|
||||
return localPrice, nil
|
||||
}
|
||||
return vendorPrice, nil
|
||||
}
|
||||
|
||||
@@ -71,12 +71,7 @@ func (c *DeliveryHandler) CreateStore(ctx *jxcontext.Context, storeDetail *dao.S
|
||||
if shopInfo.ShopLat <= 9999999 {
|
||||
shopInfo.ShopLat *= 10
|
||||
}
|
||||
// 获取品牌名称
|
||||
brandInfo, err := dao.GetBrands(dao.GetDB(), "", storeDetail.BrandID, "", false, "")
|
||||
if err != nil {
|
||||
return "", -1, err
|
||||
}
|
||||
shopInfo.ShopName = brandInfo[0].Name + "-" + storeDetail.Name
|
||||
|
||||
if globals.EnableStoreWrite {
|
||||
shopStatus, err = api.MtpsAPI.ShopCreate(shopInfo)
|
||||
if err == nil {
|
||||
@@ -174,7 +169,6 @@ func (c *DeliveryHandler) IsErrStoreExist(err error) bool {
|
||||
|
||||
func (c *DeliveryHandler) UpdateStore(ctx *jxcontext.Context, storeDetail *dao.StoreDetail2) (err error) {
|
||||
if globals.EnableStoreWrite {
|
||||
// err = api.MtpsAPI.PagePoiUpdate(storeDetail.VendorStoreID, storeDetail.PayeeName, storeDetail.Tel1, fakeContactEmail)
|
||||
shopInfo := &mtpsapi.ShopInfo{
|
||||
ShopID: utils.Int2Str(storeDetail.ID),
|
||||
ContactName: storeDetail.PayeeName,
|
||||
@@ -182,6 +176,7 @@ func (c *DeliveryHandler) UpdateStore(ctx *jxcontext.Context, storeDetail *dao.S
|
||||
ShopAddress: storeDetail.Address,
|
||||
ShopLat: storeDetail.Lat,
|
||||
ShopLng: storeDetail.Lng,
|
||||
ShopName: storeDetail.Name,
|
||||
}
|
||||
_, err = api.MtpsAPI.ShopUpdate(shopInfo)
|
||||
}
|
||||
|
||||
@@ -86,6 +86,17 @@ func (c *DeliveryHandler) OnWaybillExcept(msg *mtpsapi.CallbackOrderExceptionMsg
|
||||
|
||||
func (c *DeliveryHandler) onWaybillMsg(msg *mtpsapi.CallbackOrderMsg) (retVal *mtpsapi.CallbackResponse) {
|
||||
order := c.callbackMsg2Waybill(msg)
|
||||
// 多次取消,只处理第一次
|
||||
if msg.Status == mtpsapi.OrderStatusCanceled {
|
||||
bill, err := partner.CurOrderManager.LoadWaybill(msg.MtPeisongID, model.VendorIDMTPS)
|
||||
if err != nil {
|
||||
return mtpsapi.Err2CallbackResponse(err, fmt.Sprintf("%s", "获取订单状态错误"))
|
||||
}
|
||||
if bill.Status == model.OrderStatusCanceled {
|
||||
return mtpsapi.SuccessResponse
|
||||
}
|
||||
}
|
||||
|
||||
switch msg.Status {
|
||||
case mtpsapi.OrderStatusWaitingForSchedule:
|
||||
data, err := api.MtpsAPI.QueryOrderStatus(msg.DeliveryID, msg.MtPeisongID)
|
||||
@@ -493,29 +504,33 @@ func (c *DeliveryHandler) GetDeliverLiquidatedDamages(orderId string, deliverId
|
||||
return 0, err
|
||||
}
|
||||
|
||||
bill, err := partner.CurOrderManager.LoadWaybill(deliverId, model.VendorIDMTPS)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
// 已经分配骑手,且超过十五分钟,不扣款
|
||||
if len(statusList) != model.NO {
|
||||
for i := len(statusList) - 1; i >= 0; i-- {
|
||||
switch statusList[i].VendorStatus {
|
||||
case utils.Int2Str(mtpsapi.OrderStatusWaitingForSchedule): // 待调度
|
||||
return 0, nil
|
||||
case utils.Int2Str(mtpsapi.OrderStatusCanceled): // 取消不管
|
||||
continue
|
||||
case utils.Int2Str(mtpsapi.OrderStatusDeliverred): // 送达
|
||||
continue
|
||||
case utils.Int2Str(mtpsapi.OrderStatusAccepted): // 接单
|
||||
// 接单取消扣凉快
|
||||
return 200, nil
|
||||
case utils.Int2Str(mtpsapi.OrderStatusPickedUp): // 取货
|
||||
bill, err := partner.CurOrderManager.LoadWaybill(deliverId, model.VendorIDMTPS)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return bill.DesiredFee, nil
|
||||
|
||||
}
|
||||
for i := len(statusList) - 1; i >= 0; i-- {
|
||||
// 取消不管
|
||||
if statusList[i].VendorStatus == utils.Int2Str(mtpsapi.OrderStatusCanceled) {
|
||||
continue
|
||||
}
|
||||
// 送达
|
||||
if statusList[i].VendorStatus == utils.Int2Str(mtpsapi.OrderStatusDeliverred) {
|
||||
return bill.DesiredFee, nil
|
||||
}
|
||||
// 到店
|
||||
if statusList[i].VendorStatus == utils.Int2Str(mtpsapi.OrderStatusPickedUp) {
|
||||
return bill.DesiredFee, nil
|
||||
}
|
||||
// 接单
|
||||
if statusList[i].VendorStatus == utils.Int2Str(mtpsapi.OrderStatusAccepted) {
|
||||
return 200, nil
|
||||
}
|
||||
// 待调度
|
||||
if statusList[i].VendorStatus == utils.Int2Str(mtpsapi.OrderStatusWaitingForSchedule) {
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
}
|
||||
return 0, err
|
||||
}
|
||||
|
||||
@@ -543,6 +543,11 @@ func GetVendorRiderInfo(wayBillVendorId, vendorId int, vendorOrderId, vendorWayb
|
||||
}
|
||||
|
||||
}
|
||||
if riderInfo.CourierName != "" && riderInfo.CourierPhone != "" {
|
||||
riderInfo.LogisticsContext = fmt.Sprintf(riderInfo.LogisticsContext, riderInfo.CourierName, riderInfo.CourierPhone)
|
||||
} else {
|
||||
riderInfo.LogisticsContext = fmt.Sprintf(riderInfo.LogisticsContext, "暂无", "暂无")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@@ -404,3 +404,7 @@ func getReallyStoreID(storeID, jxStoreID int) int {
|
||||
return storeID
|
||||
}
|
||||
}
|
||||
|
||||
func (c *DeliveryHandler) UpdateStoreName(storeId, name string) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -5,14 +5,13 @@ import (
|
||||
"encoding/base64"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/authz/autils"
|
||||
"git.rosy.net.cn/jx-callback/business/partner/delivery/dada"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||
beego "github.com/astaxie/beego/server/web"
|
||||
|
||||
@@ -476,7 +475,7 @@ func getDataCityCodeFromOrder(order *model.GoodsOrder, db *dao.DaoDB) (retVal st
|
||||
}{}
|
||||
if err = dao.GetRow(db, codeInfo, sql, jxStoreID); err != nil {
|
||||
if err == nil {
|
||||
err = dada.ErrCanNotFindDadaCityCode
|
||||
err = errors.New("不能找到美团配送站点配置")
|
||||
}
|
||||
return "", err
|
||||
}
|
||||
|
||||
@@ -62,7 +62,6 @@ func pay4OrderByKs(ctx *jxcontext.Context, order *model.GoodsOrder, vendorPayTyp
|
||||
}
|
||||
// 预下单
|
||||
prePayInfo, err := api.KuaiShouApi.PreCreateOrder(param)
|
||||
globals.SugarLogger.Debugf("=======err : %v", err)
|
||||
if err == nil {
|
||||
orderPay = &model.OrderPay{
|
||||
PayOrderID: order.VendorOrderID, // 抖音订单id
|
||||
@@ -72,8 +71,8 @@ func pay4OrderByKs(ctx *jxcontext.Context, order *model.GoodsOrder, vendorPayTyp
|
||||
VendorID: order.VendorID,
|
||||
Status: 0,
|
||||
PayCreatedAt: time.Now(),
|
||||
PrepayID: "",
|
||||
CodeURL: prePayInfo, // 抖音支付token
|
||||
PrepayID: prePayInfo.OrderNo,
|
||||
CodeURL: prePayInfo.OrderInfoToken, // 抖音支付token
|
||||
TotalFee: int(order.ActualPayPrice),
|
||||
}
|
||||
}
|
||||
|
||||
10
main.go
10
main.go
@@ -164,12 +164,12 @@ func main() {
|
||||
return
|
||||
}
|
||||
|
||||
//if web.BConfig.RunMode != "jxgy" {
|
||||
if err := tasks.RefreshFnToken(); err != nil {
|
||||
globals.SugarLogger.Errorf("RefreshFnToken failed with error:%s", err)
|
||||
return
|
||||
if web.BConfig.RunMode != "jxgy" {
|
||||
if err := tasks.RefreshFnToken(); err != nil {
|
||||
globals.SugarLogger.Errorf("RefreshFnToken failed with error:%s", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
//}
|
||||
if err := tasks.RefreshQywxToken(); err != nil {
|
||||
globals.SugarLogger.Errorf("RefreshQywxToken failed with error:%s", err)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user