This commit is contained in:
邹宗楠
2022-10-31 15:00:10 +08:00
parent d6cef286c2
commit efd68f9150
12 changed files with 36 additions and 28 deletions

View File

@@ -449,6 +449,7 @@ func (c *DeliveryHandler) GetRiderInfo(orderId string, deliveryId int64, mtPeiso
CourierPhone: order.TransporterPhone,
LogisticsProviderCode: mtpsapi.DaDaCode,
LogisticsStatus: order.StatusCode,
LogisticsContext: "",
Latitude: order.TransporterLat,
Longitude: order.TransporterLng,
}
@@ -458,16 +459,22 @@ func (c *DeliveryHandler) GetRiderInfo(orderId string, deliveryId int64, mtPeiso
// result.LogisticsStatus = model.WaybillStatusCourierAssigned
case 100: // 骑手到店
result.LogisticsStatus = model.WaybillStatusCourierArrived
result.LogisticsContext = model.RiderGetOrder
case 3: // 配送中
result.LogisticsStatus = model.WaybillStatusDelivering
result.LogisticsContext = model.RiderGetOrderDelivering
case 4: // 完成
result.LogisticsStatus = model.WaybillStatusDelivered
result.LogisticsContext = model.RiderGetOrderDelivered
case 5: // 取消
result.LogisticsStatus = model.WaybillStatusCanceled
result.LogisticsContext = model.RiderGetOrderCanceled
case 9: // 配送异常
result.LogisticsStatus = model.WaybillStatusDeliverFailed
result.LogisticsContext = model.RiderGetOrderDeliverFailed
default:
result.LogisticsStatus = 0
result.LogisticsContext = model.RiderGetOrderDeliverOther
}
return result, nil

View File

@@ -319,18 +319,25 @@ func (c *DeliveryHandler) GetRiderInfo(orderId string, deliveryId int64, mtPeiso
switch order.OrderStatus {
case 20: // 骑手接单
result.LogisticsStatus = model.WaybillStatusCourierAssigned
result.LogisticsContext = model.RiderGetOrder
case 80: // 骑手到店
result.LogisticsStatus = model.WaybillStatusCourierArrived
result.LogisticsContext = model.RiderToStore
case 2: // 配送中
result.LogisticsStatus = model.WaybillStatusDelivering
result.LogisticsContext = model.RiderGetOrderDelivering
case 3: // 完成
result.LogisticsStatus = model.WaybillStatusDelivered
result.LogisticsContext = model.RiderGetOrderDelivered
case 4: // 取消
result.LogisticsStatus = model.WaybillStatusCanceled
result.LogisticsContext = model.RiderGetOrderCanceled
case 5: // 配送异常
result.LogisticsStatus = model.WaybillStatusDeliverFailed
result.LogisticsContext = model.RiderGetOrderDeliverFailed
default:
result.LogisticsStatus = 0
result.LogisticsContext = model.RiderGetOrderDeliverOther
}
return result, nil

View File

@@ -411,14 +411,19 @@ func (c *DeliveryHandler) GetRiderInfo(orderId string, deliveryId int64, mtPeiso
switch int(utils.MustInterface2Int64(order["status"])) {
case 20: //已接单
result.LogisticsStatus = model.WaybillStatusCourierAssigned
result.LogisticsContext = model.RiderGetOrder
case 30: //已取货
result.LogisticsStatus = model.WaybillStatusDelivering
result.LogisticsContext = model.RiderGetOrderDelivering
case 50: //已送达
result.LogisticsStatus = model.WaybillStatusDelivered
result.LogisticsContext = model.RiderGetOrderDelivered
case 90: //已取消
result.LogisticsStatus = model.WaybillStatusCanceled
result.LogisticsContext = model.RiderGetOrderCanceled
default:
result.LogisticsStatus = model.WaybillStatusDeliverFailed
result.LogisticsContext = model.RiderGetOrderDeliverOther
}
return result, nil

View File

@@ -2,10 +2,8 @@ package tiktok_store
import (
tiktokShop "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/tiktok_api"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jxutils"
"git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-callback/globals"
"git.rosy.net.cn/jx-callback/globals/api"
)
@@ -13,8 +11,6 @@ import (
func OnOrderMsg(msgId string, msg interface{}) (response *tiktokShop.CallbackResponse) {
if CurPurchaseHandler != nil {
orderId, _ := api.TiktokStore.GetCallbackOrderId(msgId, msg)
globals.SugarLogger.Debugf("======orderId:%s", orderId)
globals.SugarLogger.Debugf("======msg:%s", utils.Format4Output(msg, false))
jxutils.CallMsgHandler(func() {
response = CurPurchaseHandler.onOrderMsg(msgId, orderId, msg)

View File

@@ -70,7 +70,8 @@ func (p *PurchaseHandler) getStatusFromVendorStatus(vendorStatus int64) int {
}
func (c *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *model.GoodsOrder) {
order, _, _ = c.getOrder("", orderData["vendorOrderID"].(string), "")
globals.SugarLogger.Debugf("Map2Order=====:%s", utils.Format4Output(orderData, false))
order, _, _ = c.getOrder(orderData["VendorOrgCode"].(string), orderData["vendorOrderID"].(string), "")
return order
}

View File

@@ -183,21 +183,14 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
// 根据本地商品id获取线上商品是否存在,存在则只创建子商品
var tiktokResultProductId int64 = 0
// 获取本地存储映射关系
globals.SugarLogger.Debugf("=======storeSku.SkuID :%d", storeSku.SkuID)
globals.SugarLogger.Debugf("=======storeSku :%s", utils.Format4Output(storeSku, false))
localThing, err := dao.GetThingToTiktokMapList(dao.GetDB(), model.VendorIDDD, int64(storeSku.SkuID))
globals.SugarLogger.Debugf("=======localThing :%s", utils.Format4Output(localThing, false))
globals.SugarLogger.Debugf("=======localThing :%s", utils.Format4Output(localThing, false))
globals.SugarLogger.Debugf("localThing=======err :%s", err)
if len(localThing) == 0 { // 线上不存在创建
tiktokResult, err := api.CreateStoreCommodity(param) // 创建主商品
if err != nil {
globals.SugarLogger.Debugf("CreateStoreCommodity=======err :%s", err)
failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDDD], syncType)
storeSku.VendorSkuID = utils.Int2Str(storeSku.SkuID)
continue
}
globals.SugarLogger.Debugf("tiktokResult=======err :%s", utils.Format4Output(tiktokResult, false))
tiktokResultProductId = tiktokResult.ProductId
var attrId []string
@@ -438,10 +431,7 @@ func GetDeliveryTemp(api *tiktokShop.API, vendorStoreID string, storeDetail *dao
tempDetail.Template.TemplateName += "满减运费模板"
tempDetail.Columns = Columns // 满减
}
globals.SugarLogger.Debugf("tempDetail ========= %s", utils.Format4Output(tempDetail, false))
temp, err := api.FreightTemplateCreate(tempDetail)
globals.SugarLogger.Debugf("FreightTemplateCreate =err %s", utils.Format4Output(temp, false))
globals.SugarLogger.Debugf("FreightTemplateCreate =err %s", err)
if err != nil {
return 0, err
}