Merge remote-tracking branch 'origin/mark' into jdshop

This commit is contained in:
苏尹岚
2020-06-17 18:31:53 +08:00
8 changed files with 144 additions and 88 deletions

View File

@@ -1007,10 +1007,9 @@ func GetOrderSimpleInfo(ctx *jxcontext.Context, vendorOrderID string) (getOrderS
func SaveJdsOrders(ctx *jxcontext.Context, orderCreatedStart, orderCreatedEnd time.Time) (err error) {
var (
pageNo = 1
pageSize = 20
)
orderResult, err := jdshop.CurPurchaseHandler.GetJdsOrders(ctx, utils.Time2Str(orderCreatedStart), utils.Time2Str(orderCreatedEnd), pageNo, pageSize)
orderResult, err := jdshop.CurPurchaseHandler.GetJdsOrders(ctx, utils.Time2Str(orderCreatedStart), utils.Time2Str(orderCreatedEnd), 1, pageSize)
if err != nil {
noticeMsg := fmt.Sprintf("京东商城保存订单出错多半是cookie过期了,err :[%v]", err)
ddmsg.SendUserMessage(dingdingapi.MsgTyeText, "DDC5657B43EE11E9A9FF525400E86DC0", "cookie", noticeMsg)
@@ -1018,11 +1017,18 @@ func SaveJdsOrders(ctx *jxcontext.Context, orderCreatedStart, orderCreatedEnd ti
return err
}
orders, err := result2Orders(ctx, orderResult)
if orderResult.TotalCount > pageSize {
for pageNO := 2; pageNO < orderResult.TotalCount/pageSize+1; pageNO++ {
orderResult, _ := jdshop.CurPurchaseHandler.GetJdsOrders(ctx, utils.Time2Str(orderCreatedStart), utils.Time2Str(orderCreatedEnd), pageNO, pageSize)
orders2, _ := result2Orders(ctx, orderResult)
orders = append(orders, orders2...)
}
}
for _, order := range orders {
// order.StoreID = 102919
// order.JxStoreID = 102919
// order.StoreName = "商城模板(成都发货)"
// order.VendorStoreID = model.JdShopMainVendorStoreID
order.StoreID = 102919
order.JxStoreID = 102919
order.StoreName = "商城模板(成都发货)"
order.VendorStoreID = model.JdShopMainVendorStoreID
partner.CurOrderManager.OnOrderNew(order, model.Order2Status(order))
globals.SugarLogger.Debugf("SaveJdsOrders order: [%v]", utils.Format4Output(order, false))
noticeMsg := fmt.Sprintf("京东商城新订单,订单号:[%v] ,将要发到的门店id[%v] , 门店名:[%v]", order.VendorOrderID, order.StoreID, order.StoreName)
@@ -1084,13 +1090,7 @@ func result2Orders(ctx *jxcontext.Context, result *jdshopapi.AllOrdersResult) (o
order.ConsigneeLng = jxutils.StandardCoordinate2Int(lng)
order.ConsigneeLat = jxutils.StandardCoordinate2Int(lat)
}
// if order.StoreName != "" {
// storeMaps, _ := dao.GetStoresMapList(dao.GetDB(), []int{model.VendorIDJDShop}, nil, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", order.StoreName)
// if len(storeMaps) > 0 {
// order.StoreID = storeMaps[0].StoreID
// order.VendorStoreID = storeMaps[0].VendorStoreID
// }
// } else {
storeList, err := common.GetStoreListByLocation(ctx, jxutils.IntCoordinate2Standard(order.ConsigneeLng), jxutils.IntCoordinate2Standard(order.ConsigneeLat), 5000, false, true)
if err != nil {
globals.SugarLogger.Debugf("jds GetStoreListByLocation error: %v", err.Error())
@@ -1098,6 +1098,10 @@ func result2Orders(ctx *jxcontext.Context, result *jdshopapi.AllOrdersResult) (o
}
order.StoreID = storeList[0].ID
order.StoreName = storeList[0].Name
storeMaps, _ := dao.GetStoresMapList(dao.GetDB(), []int{model.VendorIDJDShop}, []int{order.StoreID}, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", "")
if len(storeMaps) > 0 {
order.VendorStoreID = storeMaps[0].VendorStoreID
}
// }
//如果是暂停,表示是预订单
if jdsOrder.OrderStatus == jdshopapi.JdsOrderStatusPause {