暂时不拉银豹,京东订单修改

This commit is contained in:
苏尹岚
2020-07-01 11:57:56 +08:00
parent c443b873c4
commit 39178f2528
4 changed files with 35 additions and 31 deletions

View File

@@ -417,7 +417,7 @@ func doDailyWork() {
//刷新物料订单状态
localjx.RefreshAllMatterOrderStatus(jxcontext.AdminCtx)
//同步银豹到京西
cms.CurVendorSync.SyncStoreSkusFromYb(jxcontext.AdminCtx, nil, true, true)
// cms.CurVendorSync.SyncStoreSkusFromYb(jxcontext.AdminCtx, nil, true, true)
//刷新京东商城订单结算价
orderman.RefreshJdShopOrdersEarningPrice(jxcontext.AdminCtx, time.Now().AddDate(0, 0, -3).Format("20060102"), time.Now().Format("20060102"))
//同步上架京东商城待售商品

View File

@@ -125,18 +125,32 @@ func (c *PurchaseHandler) OnOrderInfoChangeMsg(vendorOrgCode string, msg *jdapi.
}
func (c *PurchaseHandler) onOrderInfoChangeMsg(vendorOrgCode string, msg *jdapi.CallbackOrderInfoChangeMsg) (retVal *jdapi.CallbackResponse) {
a := getAPI(vendorOrgCode)
order, _, err := c.getOrder(a, msg.BillID)
db := dao.GetDB()
order, err := dao.GetSimpleOrder(db, msg.BillID)
if err == nil {
globals.SugarLogger.Debugf("onOrderInfoChangeMsg orderID:%s", msg.BillID)
orderInfoChangeSet(order, msg)
globals.SugarLogger.Debugf("onOrderInfoChangeMsg2: %v", order)
db := dao.GetDB()
globals.SugarLogger.Debugf("onOrderInfoChangeMsg msg:%v", utils.Format4Output(msg, false))
if msg.BuyerFullAddress != "" {
order.ConsigneeAddress = msg.BuyerFullAddress
}
if msg.BuyerFullName != "" {
order.ConsigneeName = msg.BuyerFullName
}
if msg.BuyerMobile != "" {
order.ConsigneeMobile = msg.BuyerMobile
}
if msg.BuyerLat != "" {
order.ConsigneeLat = jxutils.StandardCoordinate2Int(utils.Str2Float64(msg.BuyerLat))
}
if msg.BuyerLng != "" {
order.ConsigneeLng = jxutils.StandardCoordinate2Int(utils.Str2Float64(msg.BuyerLng))
}
if msg.OrderBuyerRemark != "" {
order.BuyerComment = msg.OrderBuyerRemark
}
_, err = dao.UpdateEntity(db, order, "ConsigneeAddress", "ConsigneeName", "ConsigneeMobile", "ConsigneeLat", "ConsigneeLng", "BuyerComment")
weixinmsg.NotifyOrderChanged(order)
// partner.CurOrderManager.ChangeOrderInfo(order)
}
return retVal
return jdapi.SuccessResponse
}
func updateOrderBySettleMent(order *model.GoodsOrder, orderSettlement *jdapi.OrderSettlementInfo) {
@@ -579,24 +593,3 @@ func (c *PurchaseHandler) ConfirmSelfTake(ctx *jxcontext.Context, order *model.G
}
return err
}
func orderInfoChangeSet(order *model.GoodsOrder, msg *jdapi.CallbackOrderInfoChangeMsg) {
if msg.BuyerFullAddress != "" {
order.ConsigneeAddress = msg.BuyerFullAddress
}
if msg.BuyerFullName != "" {
order.ConsigneeName = msg.BuyerFullName
}
if msg.BuyerMobile != "" {
order.ConsigneeMobile = msg.BuyerMobile
}
if msg.BuyerLat != "" {
order.ConsigneeLat = jxutils.StandardCoordinate2Int(utils.Str2Float64(msg.BuyerLat))
}
if msg.BuyerLng != "" {
order.ConsigneeLng = jxutils.StandardCoordinate2Int(utils.Str2Float64(msg.BuyerLng))
}
if msg.OrderBuyerRemark != "" {
order.BuyerComment = msg.OrderBuyerRemark
}
}

View File

@@ -23,6 +23,10 @@ var (
sensitiveWordRegexp = regexp.MustCompile(`商品名称中含有敏感词(\[.*\])`)
)
const (
addErr1 = "商品已存在"
)
func (p *PurchaseHandler) CreateStoreSkus(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeSkuList []*dao.StoreSkuSyncInfo) (failedList []*partner.StoreSkuInfoWithErr, err error) {
if globals.EnableYbStoreWrite {
storeSku := storeSkuList[0]
@@ -34,6 +38,14 @@ func (p *PurchaseHandler) CreateStoreSkus(ctx *jxcontext.Context, storeID int, v
result, err = api.YinBaoAPI.AddProductInfo(buildProductInfoParam(storeSku))
}
if err != nil {
// if strings.Contains(err.Error(), addErr1) {
// queryProductByBarcodeResult, err := api.YinBaoAPI.QueryProductByBarcodes([]string{storeSku.YbBarCode})
// if err != nil && len(queryProductByBarcodeResult) > 0 {
// if queryProductByBarcodeResult[0].Enable == model.SkuStatusDeleted {
// api.YinBaoAPI.SaveProduct(userId, keyword, saveProductParam)
// }
// }
// }
failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDYB], "创建商品")
} else {
storeSku.VendorSkuID = utils.Int64ToStr(result.UID)

View File

@@ -216,7 +216,6 @@ func (c *DjswController) UpdateSku() {
func (c *DjswController) OrderAddTips() {
c.orderStatus()
}
func (c *DjswController) OrderInfoChange() {
if c.Ctx.Input.Method() == http.MethodPost {
callbackResponse := c.handleMsg(func(a *jdapi.API, obj interface{}) (callbackResponse *jdapi.CallbackResponse) {